Created
February 6, 2014 00:52
-
-
Save westmaas/8836484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@21-129-18-537886 ~]# cat write-test.py | |
#/usr/bin/env python | |
import os | |
import sys | |
import time | |
blksz = 1024 * 1024 | |
iters = 64 | |
filename = sys.argv[1] | |
if os.path.exists(filename): | |
print '%s exists' % filename | |
sys.exit(0) | |
blk = 'a' * blksz | |
f = open(filename, 'w') | |
for x in range(iters): | |
start = time.time() | |
f.write(blk) | |
f.flush() | |
end = time.time() | |
if (end - start) < 1: | |
print '.', | |
else: | |
print "\n%s" % (end - start) | |
f.close() | |
os.unlink(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment