Runs a spinloop, used for CPU scheduler testing
authorAndy Bavier <acb@cs.princeton.edu>
Tue, 29 Jan 2008 20:47:42 +0000 (20:47 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Tue, 29 Jan 2008 20:47:42 +0000 (20:47 +0000)
qaapi/qa/tests/busyloop.py [new file with mode: 0755]

diff --git a/qaapi/qa/tests/busyloop.py b/qaapi/qa/tests/busyloop.py
new file mode 100755 (executable)
index 0000000..8cff8a5
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import sys
+import time
+
+def main(sec):                         
+    now = time.time()
+    stop = now + float(sec)
+    print 'about to busy-wait for', sec, 'seconds'
+    while now < stop:
+        now = time.time()
+
+if __name__ == "__main__":
+    main(sys.argv[1])