| 1 |
""" |
| 2 |
Program that just does busywork, yields stdout/stderr and ignores stdin. |
| 3 |
|
| 4 |
Useful for measuring CPU usage of the code interfacing with it without |
| 5 |
expecting the test environment to have much of anything. |
| 6 |
|
| 7 |
Accepts a single argv argument, which is the number of cycles to run. |
| 8 |
""" |
| 9 |
|
| 10 |
import sys |
| 11 |
import time |
| 12 |
|
| 13 |
|
| 14 |
num_cycles = int(sys.argv[1]) |
| 15 |
|
| 16 |
for i in range(num_cycles): |
| 17 |
out = "[{}] This is my stdout, there are many like it, but...\n".format(i) |
| 18 |
print(out, file=sys.stdout, flush=True) |
| 19 |
err = "[{}] To err is human, to stderr is superhuman\n".format(i) |
| 20 |
print(out, file=sys.stderr, flush=True) |
| 21 |
time.sleep(0.1) |