Commit bbcc7db
cpu_information: report turbo/boost state, hardware peak, and P/E class
The existing per-CPU line printed only the kernel governor's scaling
window via scaling_min_freq / scaling_max_freq. On a system with
boost disabled, or on hybrid CPUs where different cores have
different boost ceilings, that window is the same number on every
core and conveys nothing about whether the CPU can actually run
faster than displayed.
Add three signals so the benchmark banner reflects what the silicon
can do:
1. Turbo/boost state -- a single global line. Reads
/sys/devices/system/cpu/cpufreq/boost first (AMD CPB,
acpi-cpufreq, amd-pstate); falls back to
/sys/devices/system/cpu/intel_pstate/no_turbo (intel_pstate,
inverse-sense). Reported as on/off; the line is omitted when
neither file is readable.
2. Hardware peak frequency -- per CPU, when it exceeds the
scaling cap. Reads amd_pstate_max_freq first (the per-core
boost ceiling reported by amd-pstate; differs across cores on
AMD hybrid parts), then cpuinfo_max_freq (Intel turbo cap).
Suppressed when equal to scaling_max_freq so the line stays
short on non-hybrid / boost-on systems.
3. P-core / E-core label -- per CPU. Resolved from
/sys/devices/cpu_core/cpus (P) and /sys/devices/cpu_atom/cpus
(E), the Intel hybrid PMU sysfs. Empty on non-hybrid Intel and
on AMD (where the hardware-peak value already exposes the
split, e.g. 5090 MHz Zen 5 vs 3506 MHz Zen 5c on a Ryzen AI
7 PRO 350).
Sample on the AMD Ryzen AI 7 PRO 350 (boost disabled,
2 GHz scaling cap):
CPU information:
CPUs allowed: 0-1,4-5
Turbo/boost: off
CPU0, scaling [623MHz .. 2000MHz], hw peak 5090MHz
CPU1, scaling [623MHz .. 2000MHz], hw peak 3506MHz
CPU4, scaling [623MHz .. 2000MHz], hw peak 5090MHz
CPU5, scaling [623MHz .. 2000MHz], hw peak 3506MHz
Incidental cleanup: the scaling range now prints [min .. max]
(was [max .. min]) since "scaling ... hw peak X" only reads
naturally with an ascending range.
API shape: cpu_scaling_min_freq / cpu_scaling_max_freq collapse
into a single cpu_info_for(cpu) returning a struct (scaling
min/max, hw peak, core class). cpu_boost_enabled() returns
std::optional<bool>.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 36b3187 commit bbcc7db
3 files changed
Lines changed: 93 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
| 524 | + | |
| 525 | + | |
524 | 526 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
533 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
534 | 544 | | |
535 | 545 | | |
536 | 546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
118 | 148 | | |
119 | 149 | | |
120 | 150 | | |
| |||
141 | 171 | | |
142 | 172 | | |
143 | 173 | | |
144 | | - | |
145 | | - | |
| 174 | + | |
| 175 | + | |
146 | 176 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
150 | 197 | | |
151 | 198 | | |
152 | | - | |
153 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
154 | 203 | | |
155 | | - | |
156 | | - | |
157 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
158 | 209 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
38 | 50 | | |
39 | 51 | | |
40 | | - | |
41 | | - | |
| 52 | + | |
| 53 | + | |
42 | 54 | | |
43 | 55 | | |
0 commit comments