Add macos_thermal_pressure and macos_soc_power tables#83
Merged
grahamgilbert merged 3 commits intomainfrom Mar 16, 2026
Merged
Conversation
Adds two new macOS-only tables powered by powermetrics: - `macos_thermal_pressure`: exposes the OS thermal pressure state (Nominal/Light/Moderate/Heavy/Sleeping) and a derived `is_throttling` integer, using the `thermal` sampler with a 1000ms default interval. - `macos_soc_power`: exposes CPU, GPU, ANE, and combined SoC power draw in mW plus GPU active ratio, using the `cpu_power,gpu_power,ane_power` samplers with a 3000ms default interval for meaningful averages. Both tables accept a constrainable `interval` column. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add TestThermalPressureGenerate and TestRunPowermetricsStatError to cover the Generate function and the non-ErrNotExist stat error path, bringing coverage from 38.7% to 67.7%. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WardsParadox
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
macos_thermal_pressuretable: exposes Apple's OS-level thermal throttling state (Nominal/Light/Moderate/Heavy/Sleeping) and a derivedis_throttlinginteger viapowermetrics --samplers thermalmacos_soc_powertable: exposes CPU, GPU, ANE (Apple Neural Engine), and combined SoC power draw in mW plus GPU active ratio viapowermetrics --samplers cpu_power,gpu_power,ane_powerintervalcolumn (defaults: 1000ms and 3000ms respectively)energy_impactREADME note to use1000instead of1000msfor the interval defaultTest plan
go test ./tables/thermalthrottling/... ./tables/socpower/...passesselect * from macos_thermal_pressure;returns a row withthermal_pressure = Nominalon an idle deviceselect * from macos_soc_power;returns a row with plausible mW valuesselect * from macos_thermal_pressure where interval = 500;uses the custom interval🤖 Generated with Claude Code