This Python script benchmarks how different nice levels affect CPU-bound tasks, measuring throughput and latency. It runs processes with varying nice levels to observe their impact on execution time.
- Python 3.x
- A Unix-like OS with nice support (e.g., Linux, macOS)
Command-line arguments:
-t, --task-size: Sets the task size as a power of 10 (default: 9).-n, --nice-duplicates: Number of processes per nice level (default: 2).
Default run:
sudo python3 nice-bench.pyCustom run without duplicate processes and reduced task size:
sudo python3 nice-bench.py -t 7 -n 1Note: Invocation with sudo is required to set nice level for restricted nice levels.