You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testWrite.py - Make OS-independent (aka support running test on windows), and add usage info and validation.
Changes:
* Generate a file the size of my current libc instead of relying on finding one via linux-only path
* Navigate to current directory of testWrite.py and use relative paths to test filenames, instead of writing in /home/${USERNAME}/ (now supports windows and non-standard $HOME locations)
* Add --help usage info
* Perform validation on arguments, including number of arguments and validity of the priorities provided
* Minor cleanups and improvements
print ( 'Using containing directory of this file [ %s ] for writes...\n'%( currentDirectory, ) )
142
+
143
+
# Change dir to this directory, so we don't have to use os.sep
144
+
os.chdir(currentDirectory)
58
145
59
146
username=os.environ['USER']
60
147
61
148
# Some values used for the math
62
149
x=13
63
150
y=37
64
-
65
-
# Get some big data
66
-
withopen(BIG_FILE, 'rb') asf:
151
+
152
+
# Get some big data - open a fresh copy so we aren't reading from buffer
153
+
withopen(bigFilename, 'rb') asf:
67
154
before=time.time()
68
155
data=f.read()
69
156
after=time.time()
70
157
71
-
sys.stdout.write('Time to read: %f\n'%(after-before,))
158
+
print ('Time to read %d bytes: %f\n'%(len(data), after-before,) )
159
+
160
+
print ( 'Running through IO priorities, %d -> %d (inclusive),\n whilst running simultaneous math calculations to test interactivity\n and I/O rate at each level...\n\n%s\n\n'%( startPrio, endPrio, '-'*50, ) )
72
161
73
162
# Expand that big data
74
163
data=data*50
75
164
76
165
dataLen=len(data)
77
166
78
167
# Iterate through the I/O priorities, do the operation, and show the score.
0 commit comments