Help us shape the future of Go! Take the 2026 Go Developer Survey

cpudiag

command
v0.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Command cpudiag is a one-shot CPU-topology diagnostic (10-04-PLAN, Rule 2 deviation): it prints what a Go process on this host believes about its own parallelism, for comparison against the host's REAL CPU allotment.

Why this exists: tools/bench/runner invokes `codegraph index --force --quiet` without ever passing --workers, so the extraction worker pool defaults to runtime.NumCPU() (internal/indexer/extract.go, internal/indexer/pipeline.go, internal/indexer/sync.go all default this way). runtime.NumCPU() reports HOST-VISIBLE CPUs, not a container's cgroup CPU quota — on a runner where those two numbers diverge, Go spawns far more OS threads/goroutines than the cgroup can actually run concurrently, and the resulting scheduler contention shows up as wall-clock throughput variance with stable memory usage, not as a code regression. This tool exists to check that hypothesis before acting on it, per the "run the control before concluding" lesson in tools/bench/BASELINE.md.

This is a diagnostic, not a gate: it never fails the process (no os.Exit(1) path) and it is never invoked by any CI gate — only by the `task diag:cpu` target, itself only ever dispatched manually.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL