Skip to content

Instantly share code, notes, and snippets.

@westmaas
Created February 6, 2014 00:52
Show Gist options
  • Save westmaas/8836484 to your computer and use it in GitHub Desktop.
Save westmaas/8836484 to your computer and use it in GitHub Desktop.
[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()
print
os.unlink(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment