Files
orca/tests/tools/benchmarks/cpu-pressure-worker.mjs
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

22 lines
760 B
JavaScript

#!/usr/bin/env node
/**
* Busy-spins one CPU core to emulate a loaded machine during latency benches
* (the "every workspace is running an agent and the whole box is hot" case).
* Spawn N of these to occupy N cores; kill to release.
*
* Usage: node cpu-pressure-worker.mjs [maxDurationMs]
* The duration failsafe (default 10 min) prevents orphaned spinners if the
* spawning bench dies without cleanup.
*/
const maxDurationMs = Number(process.argv[2]) > 0 ? Number(process.argv[2]) : 10 * 60 * 1000
const deadline = Date.now() + maxDurationMs
let x = 1
while (Date.now() < deadline) {
// Hot integer loop between deadline checks; no yields, no allocation.
for (let i = 0; i < 5_000_000; i++) {
x = (x * 31 + 7) % 1000003
}
}
process.exit(0)