You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bazel's --profile output covers wall time, CPU time, memory, and critical path, but nothing about actual power draw. On Linux that data already exists; /sys/class/powercap/intel-rapl:*/energy_uj gives cumulative package energy in microjoules, readable by any unprivileged process, no special permissions needed. Sampling it before and after a build (or per-action, if you want finer grain) gets you watts for free.
Why this is worth having: builds on a 20+ core desktop or a beefy CI runner pull real power- I measured mine hitting ~170W sustained under full load, versus ~16W idle. Right now the only way to answer it is bolting on an external tool like powerstat or turbostat and manually correlating timestamps against Bazel's own trace log. That's clunky and it means the profile you already trust for time/memory tells you nothing about energy.
Possible breakdown:
Linux: sample intel-rapl (Intel) or the AMD equivalent under /sys/class/powercap at build start/end, folded into the existing build-metrics proto as an extra field
macOS: powermetrics exposes something similar, though it needs elevated privileges, which is a real constraint
Windows: no clean equivalent I know of- might have to ship as Linux/macOS-only to start
Should be opt-in (--profile_power or similar), since not every machine exposes these counters and reading them shouldn't be silently mandatory
I checked the issue tracker, the proposals repo, and Discussions (Ideas/Design proposals/Q&A/General) for prior mentions of this- nothing exists on power or energy tracking of any kind. Posting here as an Idea rather than an Issue since it's more of an open question than a scoped, ready-to-implement request. If there's interest I'll write up a fuller design doc for the proposals repo.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Bazel's
--profileoutput covers wall time, CPU time, memory, and critical path, but nothing about actual power draw. On Linux that data already exists;/sys/class/powercap/intel-rapl:*/energy_ujgives cumulative package energy in microjoules, readable by any unprivileged process, no special permissions needed. Sampling it before and after a build (or per-action, if you want finer grain) gets you watts for free.Why this is worth having: builds on a 20+ core desktop or a beefy CI runner pull real power- I measured mine hitting ~170W sustained under full load, versus ~16W idle. Right now the only way to answer it is bolting on an external tool like
powerstatorturbostatand manually correlating timestamps against Bazel's own trace log. That's clunky and it means the profile you already trust for time/memory tells you nothing about energy.Possible breakdown:
intel-rapl(Intel) or the AMD equivalent under/sys/class/powercapat build start/end, folded into the existing build-metrics proto as an extra fieldpowermetricsexposes something similar, though it needs elevated privileges, which is a real constraint--profile_poweror similar), since not every machine exposes these counters and reading them shouldn't be silently mandatoryI checked the issue tracker, the
proposalsrepo, and Discussions (Ideas/Design proposals/Q&A/General) for prior mentions of this- nothing exists on power or energy tracking of any kind. Posting here as an Idea rather than an Issue since it's more of an open question than a scoped, ready-to-implement request. If there's interest I'll write up a fuller design doc for theproposalsrepo.All reactions