Created
December 3, 2015 16:09
-
-
Save zielmicha/c4ac8974d2f6a55bf548 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
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