Last active
December 23, 2015 09:48
-
-
Save harshavardhana/6616606 to your computer and use it in GitHub Desktop.
Script to test XFS open()/creat() delays
This file contains hidden or 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
#!/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