Measure NixDrv builds from the realiser log; partial samples are lower bounds #25
Loading…
Reference in a new issue
No description provided.
Delete branch "nixdrv-usage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
NixDrv tasks read as idle (
cpu_secs: 0.02, peak_cpus: 0, partial: true), for two reasons:nix build --jsoncarries no timing or CPU.As a result, learned requests collapsed to the 0.25-cpu floor and
--coresto 1, and crane'sCARGO_BUILD_JOBS/RUST_TEST_THREADSfollowed. That is why graph 582 compiled on one core for 30+ minutes.Agent
--log-format internal-json --debug. The daemon's per-buildbuilder for '<drv>' terminated …, user CPU …, system CPU …line, read from the build's cgroup, only reaches the client at debug verbosity.nix::log::NixLog: records each derivation build's span (activity type 105 start/stop) and its CPU. It renders the stream back into the plainname> linebuild log that--print-build-logsgave, keeping info-level messages, errors and warnings and dropping debug chatter. Daemon text arrives re-logged at level 0, so a level-0 message is shown only if it carries error info or reads as an error or warning.proc::run: folds the builds in once stderr is drained. CPU goes intocpu_secs, and each build is spread evenly over its span into the 2 s windowspeak_cpusis taken from (UsageCurve::fold_daemon_builds). The watcher's CPU stays out of a NixDrv's windows so nothing is counted twice; the watcher still supplies memory.nix.rsbecomesnix/mod.rs+nix/log.rs, and the JSON-timingparse_build_resultpath is removed.Control plane
partialsample is treated as a lower bound. With three exact samples only those are learned from. Otherwise all samples are, and the result may raise the payload default but never go below it. This keeps exec tasks' tree-measured CPU on busy nodes instead of discarding it./api/stats/tasksreportspartial_samples.SPEC
§6.2.1 now matches: where NixDrv CPU comes from, how spans enter
peak_cpus, and the partial-sample rule.Tests
proc::runwith a fake realiser, and for the sizing rule.cold, that the builder line is rendered asname> …, and that no raw@nixJSON leaks. It ran against the daemon on ares; in the Nix sandbox, wherenixisn't available, it skips.cargo clippy --workspace --all-targets -D warningsis clean andcargo test --workspacepasses.Limitations and follow-ups
peak_cpusis its average parallelism: a cargo derivation that compiles on every core and links on one reads as somewhere in between. Finer curves would need the watcher to attribute build cgroups by build activity.RUST_TEST_THREADSpin from #23 and its TODO entry can go.🤖 Generated with Claude Code
214f223466' into nixdrv-usage@krisbuild r+
Merged as
64e57fc1c9.