jouleclaw-energy: a live per-process CPU energy counter for in-process work #123
Loading…
Reference in a new issue
No description provided.
Delete branch "jouleclaw-energy/process-energy"
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?
On macOS 27 an unprivileged process sees IOReport's CPU rails republished only in lumps, so #117 makes
detect_meter()fall back to the Estimator there. The kernel keeps a per-process counter,ri_energy_njfromproc_pid_rusage(getpid(), RUSAGE_INFO_V6), and that one is live. It is a public libproc call, with no privilege.The counter
process::ProcessCpuCounter(macOS) reads that counter; graded HwShunt, gated on the sustained-advance rule, probed once per process.EnergyDomain::ProcessCpu: this process's threads only. Not children, other processes, GPU, ANE or DRAM. Whether AMX work is included is not verified, and the docs say so.EnergyError::NotAdvanced, never a zero.detect_meter()excludes it.detect_in_process_meter()returns it when live, and is otherwise exactlydetect_meter(). mesh-meter treats ProcessCpu as not covering a request.Where it is used, and where not
local_model_econ,swebench_local_coderandswebench_local_suite. Their decode runs in-process on CPU kernels; the judge runs outside the metered window.llama-completionsubprocess. A test pins this.run: the runtime registers GPU kernels.Measured (macOS 27.0.1)
Liveacross 4 threads with 1 probe run. A 200 ms burn reads 1.384 J and sleep 445 µJ; a child that burned 1.867 J left this process's window at 6,620 µJ. IOReport there is stillCpuRailFrozen.Mutations caught:
detect_meterby default;Updates
package-Nzones on every socket. The rebase was clean.rapl, andioreport,rapl,nvml, plustests/process_cpu.rs, mesh-meter, jouledesk-github and harness-econ.🤖 Generated with Claude Code
701c8ba89a191f5d789e191f5d789edf42af5c22