Skip to content

Instantly share code, notes, and snippets.

@harshavardhana
Last active December 23, 2015 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harshavardhana/6616606 to your computer and use it in GitHub Desktop.
Save harshavardhana/6616606 to your computer and use it in GitHub Desktop.
Script to test XFS open()/creat() delays
#!/usr/bin/env python2
#
# Usage:
# $ cd <xfs_brick>; strace -c python2 /tmp/timecreatefile.py
import os
import timeit
filename = 'foo'
if os.path.exists(filename):
print filename, 'exists. Aborting.'
exit(1)
test = """\
with open("%s", "w"):
pass
""" % filename
timer = timeit.Timer(test)
for i in range(10):
print timer.timeit(1)
os.remove(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment