Lengthen worker measurements to reduce CPU counter quantization

This commit is contained in:
Ludovic Marie
2026-10-03 21:17:49 +02:00
parent 7b3840ea8f
commit b718bef555
2 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -46,13 +46,18 @@ python3 tools/build_mod.py --benchmark-workers
```
`dist/worker-pacing-benchmark.txt` records three runs per mode and requested budget,
using 2,000 jobs with a nominal ten-microsecond workload after warm-up. It compares
using 50,000 jobs with a nominal ten-microsecond workload after warm-up. It compares
the actual upstream executor with a subclass using the original pacing routine.
Worker CPU time and allocation counters exclude allocations on the producer thread.
This is a timer/allocation microbenchmark, not Minecraft FPS, player TPS or a full
terrain generation benchmark. Hosted Linux, macOS and Windows runs produce their
own artifacts; contention and warm-up can change the results.
The first 2,000-job Windows runs exposed CPU-counter quantization: a single worker
could appear above one core or at zero CPU during a very short interval. Those
figures are not reliable CPU-duty results. The longer workload provides a larger
measurement window; counters and scheduling still have finite precision.
Deterministic tests simulate multiple job sizes, timer overshoot, configuration
changes, idle time and invalid ratios. Native game validation must also check terrain
progress, frame/tick capture and clean shutdown. On the M2 Pro, compare balanced,
+3 -1
View File
@@ -108,7 +108,7 @@ def benchmark_workers():
for ratio in ["0.5", "0.05"]:
for mode in ["upstream", "precise"]:
subprocess.run(["java", "-cp", os.pathsep.join([str(tests), classpath]),
"dev.horizonlab.budget.WorkerPacingBenchmark", ratio, "10000", "2000", mode],
"dev.horizonlab.budget.WorkerPacingBenchmark", ratio, "10000", "50000", mode],
stdout=report, check=True)
print(output.read_text(), end="")
@@ -118,6 +118,8 @@ if __name__ == "__main__":
parser.add_argument("--test-only", action="store_true")
parser.add_argument("--benchmark-workers", action="store_true", help="Measure tiny-job executor pacing; not Minecraft FPS")
args = parser.parse_args()
if args.test_only and args.benchmark_workers:
parser.error("--benchmark-workers requires the compiled mod; omit --test-only")
test_metrics()
if not args.test_only:
build()