import random, time | |
f = open('/dev/sda', 'rb') | |
L = 1000 ** 4 * 2 | |
bs = 4096 | |
while bs <= 1024 * 1024 * 128: | |
count = 0 | |
start = time.time() | |
while time.time() - start < 30: | |
f.seek(random.randrange(0, L, bs), 0) | |
f.read(bs) | |
count += 1 | |
took = time.time() - start | |
size = bs * count | |
print 'bs=%dk' % (bs / 1024), 'read=%d' % count, 'size=%.1f MB' % (size / 1024**2), 'speed=%.1f MB/s' % (size / took / 1024**2) | |
bs *= 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment