Skip to content

Commit 02a389c

Browse files
committed
Added tooling for multiple runs
1 parent c173e16 commit 02a389c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

datamaker.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
ex = Exercizer()
55

6-
ex.makeRandomBinFiles(numFiles = 25, minSizekb = 1,
7-
maxSizekb = 101, outDir = sys.argv[1] )
8-
ex.makeRandomBinFiles(numFiles = 20, minSizekb = 200,
9-
maxSizekb = 10001, outDir = sys.argv[1])
6+
ex.makeRandomBinFiles(numFiles = 50, minSizekb = 1,
7+
maxSizekb = 101, outDir = sys.argv[1], fnPrefix = sys.argv[2] )
8+
ex.makeRandomBinFiles(numFiles = 40, minSizekb = 200,
9+
maxSizekb = 10001, outDir = sys.argv[1], fnPrefix = sys.argv[2])
1010
ex.makeRandomBinFiles(numFiles = 10, minSizekb = 20000,
11-
maxSizekb = 100001, outDir = sys.argv[1])
11+
maxSizekb = 100001, outDir = sys.argv[1], fnPrefix = sys.argv[2])
12+
13+

exercizer.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import os, time
1616
from os.path import join, getsize ,exists
17+
from traceback import format_exc
1718
class Exercizer(object):
1819
def __init__(self):
1920
self.resetTimer()
@@ -22,15 +23,16 @@ def makeRandomBinFiles (self,
2223
outDir='/tmp/smalldir',
2324
numFiles=10,
2425
minSizekb=1,
25-
maxSizekb = 1000001):
26+
maxSizekb = 1000001,
27+
fnPrefix = 'file_'):
2628

2729
if not exists(outDir):
2830
os.makedirs(outDir)
2931
ctr = 1
3032
while ctr <= numFiles:
3133
try:
3234
fileSize = max( 1, ctr * (maxSizekb - minSizekb)/numFiles)
33-
with open(join(outDir,'file_'+ str(fileSize)), 'wb') as fout:
35+
with open(join(outDir,fnPrefix + str(fileSize)), 'wb') as fout:
3436
fout.write(os.urandom(fileSize*1000))
3537
ctr = ctr + 1
3638
except:

0 commit comments

Comments
 (0)