Skip to content

Instantly share code, notes, and snippets.

@terryjbates
Created February 12, 2016 01:17
Show Gist options
  • Save terryjbates/5d0353f990e4179bf230 to your computer and use it in GitHub Desktop.
Save terryjbates/5d0353f990e4179bf230 to your computer and use it in GitHub Desktop.
Ramping load generator from Sys Perf book
#!/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