#stress #cpu #stress-cpu

stress-cpu

Utility that simulates a high cpu load

5 releases (breaking)

0.5.0 Dec 2, 2024
0.4.0 Dec 2, 2024
0.3.0 Dec 2, 2024
0.2.0 Dec 2, 2024
0.1.0 Dec 2, 2024

#5 in #stress

MIT/Apache

5KB

Utility that simulates a high cpu load. It creates N OS native threads each of which spins in a tight loop calculating the sqrt() of a random number.


A simple Rust library for simulating a high cpu load. You can stress your CPU by specifying the number of workers and timeout in seconds. Each worker corresponds a native OS thread. For example,

fn main() {
    stress_cpu::stress(4, 30);
}

Dependencies

~2.5–8.5MB
~61K SLoC