Skip to content

Color CPU frequencies with per-sensor scales in GHz - #608

Open
glutamatt wants to merge 1 commit into
corecoding:developfrom
glutamatt:color-cpu-frequency
Open

glutamatt wants to merge 1 commit into
corecoding:developfrom
glutamatt:color-cpu-frequency

Conversation

@glutamatt

@glutamatt glutamatt commented Oct 16, 2026 •

Copy link
Copy Markdown

Problem

In Processor preferences, Add Color Scale lists a frequency sensor once it is pinned to the panel (for example Max frequency). You can set breakpoints, but the panel never colors the value: colorsKeyForSensor() only accepts the percent format for the processor group, and frequencies use hertz.

Even with hertz accepted, the thresholds would compare the displayed number. That number changes unit with the value: 400 MHz gives 400, 4.5 GHz gives 4.5. So a "red under 1" rule would not work.

My use case: show the fastest core in red when the firmware cuts the power limit and the CPU falls to 400 MHz.

Change

  • helpers/catalog.js: new sensorColorFormats field. These formats take a per-sensor scale only. The processor group gets sensorColorFormats: ['hertz'].
  • The processor All sensors scale stays on usage. Without this, an existing 0 → green, 80 → red usage scale would color every frequency green. getUsageColor() gets a useGroupWide flag for that.
  • values.js: frequency thresholds are in GHz, whatever unit the text shows.
  • prefs.js: the scale title shows the unit (Frequency (fastest core) (GHz) colors). Palette titles are refreshed when sensor discovery ends, so the unit (and unavailable) is right even if the page was opened in the first 2 seconds.

GPU frequencies are not changed: the GPU group still colors percent only.

Testing

A GJS script that runs Values._legible() with fake settings:

fastest core 400 MHz               400.0 MHz  color: rgb(255, 0, 0);
fastest core 950 MHz (shown GHz)   950.0 MHz  color: rgb(255, 0, 0);
fastest core 4.5 GHz               4.5 GHz    color: rgb(0, 255, 0);
avg frequency, no own scale        2.0 GHz    (no color)
usage 90 %                         90%        color: rgb(255, 0, 0);
usage 10 %                         10%        color: rgb(0, 255, 0);
gpu frequency (not colorable)      1.0 GHz    (no color)

Scale: 0 → red, 1 → green on the fastest core, plus an All sensors usage scale 0 → green, 80 → red.

Not tested yet in a running shell or in the preferences window.

Preferences offered a color scale for a pinned frequency sensor, but the
panel never applied it: processor colors only accepted the percent format.

Frequencies now take a per-sensor scale. Thresholds are in GHz, because the
displayed unit changes with the value (400 MHz, 4.5 GHz). The All sensors
scale of the processor page stays on usage, so a 0-100 % scale does not
color a frequency. The scale title shows the unit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant