Last active
April 7, 2016 17:34
-
-
Save yuuki/8d5d386115b0f01b5371 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
#!/usr/bin/env python | |
# # Prepare test files. | |
# rm /tmp/test_*.wsp; for i in `seq 0 99`;do bin/whisper-create.py /tmp/test_$i.wsp 60s:25h 5m:21d 1h:90d 1d:2y; done | |
# Execute benchmark. | |
# sync; echo 3 | sudo tee /proc/sys/vm/drop_caches ; python bin/whisper-update-many-fadvice-test.py f | grep read | |
import random | |
import time | |
import sys | |
import ftools | |
import os | |
import whisper | |
pid = os.getpid() | |
argvs = sys.argv | |
argc = len(argvs) | |
if argc > 1: | |
now = int(time.time()) | |
datapoints = [(now + i*60, random.randrange(100000)) for i in xrange(-99, 0)] | |
for j in range(0,99): | |
for i in range(0,99): | |
path = "/tmp/test_" + str(i) + ".wsp" | |
if argvs[1] == 'n': | |
whisper.update_many(path, [ datapoints[j] ]) | |
elif argvs[1] == 'f': | |
whisper.FADVISE_RANDOM = True | |
whisper.update_many(path, [ datapoints[j] ]) | |
for line in open('/proc/' + str(pid) + '/io', 'r'): | |
print line, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment