Created
February 12, 2016 01:17
-
-
Save terryjbates/5d0353f990e4179bf230 to your computer and use it in GitHub Desktop.
Ramping load generator from Sys Perf book
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 | |
import sys | |
import os | |
import random | |
IOSIZE = 8192 | |
QUANTA = IOSIZE | |
def main(): | |
filename = sys.argv[1] | |
print(filename) | |
FILE = os.open(filename, os.O_RDWR) | |
while True: | |
os.lseek(FILE, int(random.random() * IOSIZE), 0) | |
os.read(FILE, IOSIZE) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment