Repository navigation
Add Thermal: flag executions run on a hot or throttled CPU - #3
Open
MatejKocourek wants to merge 3 commits into
Open
MatejKocourek wants to merge 3 commits into
MatejKocourek wants to merge 3 commits into
Conversation
A hot or throttled CPU runs slower, so the numbers measured on it are
suspect. Thermal is both a Hook and a Metric: around every execution it
samples the CPU package temperature (Linux hwmon: coretemp, k10temp) and
reads the kernel's thermal-throttle counters, then emits cpu_temp_max and
cpu_throttle as process samples. Both carry extra={"suspect": True} when
the CPU throttled or came within `margin` degrees of its crit temperature.
Without the sensors it emits nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read CPU thermal zones as well as hwmon, and take each sensor's limit from the hardware (hwmon crit, the zone's lowest passive/hot/critical trip point) instead of a fixed fallback: without a declared limit nothing is flagged as hot. Guard every read and the hook so that missing or broken sensors only mean no samples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On x86 laptops firmware zones such as CPUV match the CPU zone names and declare policy trip points (a 60 C passive one), which flagged nearly every execution. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
A hot or throttled CPU runs slower, so the numbers measured on it are suspect. This adds
Thermal, which records CPU temperature and thermal throttling around every execution and marks the executions where the CPU was at risk.What it does
Thermalis both aHookand aMetric(no changes to the controller, builder or report format). Around each execution it samples the CPU temperature (everyintervals, default 1) and reads the kernel's throttle counters, then emits two process samples:cpu_temp_max(C): the hottest reading during the execution;cpu_throttle: thermal-throttle events counted during it (summed over CPUs).extra={"suspect": True}when the CPU throttled or came withinmargindegrees (default 10) of a limit the hardware declares: hwmon'scrit, or a thermal zone's lowest passive/hot/critical trip point. Without a declared limit nothing is flagged as hot.coretemp,k10temp) and, where no such driver exists (e.g. ARM), thermal zones whose type names the CPU (cpu,pkg,soc). Thermal zones are skipped where hwmon covers the CPU: on x86 laptops they include firmware policy zones (e.g.CPUVwith a 60 °C passive trip) whose trips are not CPU limits. Throttle counters come from/sys/devices/system/cpu/cpu*/thermal_throttle/(where the platform has them).Tests
tests/test_thermal.pybuilds fake sysfs trees: Intel hwmon withcrit, an ARM-style thermal zone with trip points (ignoringactivetrips and non-CPU zones), a firmware zone ignored next to coretemp, AMDk10tempwithout a declared limit, throttling, no sensors, malformed and unreadable sensor files, and a run throughControllerwith the object as hook and metric.ruff,pyrightand the full test suite pass.Tried on two Intel laptops: three 2 s CPU burns read 77–87 °C, not flagged; on an i5-1335U only coretemp (crit 100 °C) is used, not the firmware's
CPUV/TCPUzones.🤖 Generated with Claude Code