node_exporter icon indicating copy to clipboard operation
node_exporter copied to clipboard

[FEATURE] add processor cstate metrics

Open rtreffer opened this issue 1 month ago • 0 comments

I recently debugged a machine with high c-state transition counts and latency. The problem I found was cstate transitions × cstate latency > 1% wall time

There are several highly relevant files that we should probably export, documented as part of cpuidle

root@goa:/sys/devices/system/cpu/cpu0/cpuidle# grep -Hirn '.*' .
./state3/disable:1:0
./state3/above:1:24243157
./state3/time:1:185600277204
./state3/rejected:1:0
./state3/power:1:0
./state3/residency:1:700
./state3/latency:1:350
./state3/usage:1:50200069
./state3/desc:1:ACPI IOPORT 0x415
./state3/below:1:0
./state3/default_status:1:enabled
./state3/name:1:C3
./state3/s2idle/time:1:4745151344
./state3/s2idle/usage:1:52

General metadata

  • disabled
  • symbolic name (C3)
  • description
  • latency (350µs) - transition latency
  • residency (700µs) - target residency

As well as several counters:

  • usage - number of times the cstate was entered
  • time - time in µs spent in this state
  • above - number of times a higher cstate would have been better (we were below the target residency)
  • below - number of times a lower cstate would have been better

So for my laptop ~50% of the time I would have been better off staying in C2. Which has a latency of 18µs.

I would like to see node_exporter being able to export this data. Several interesting metrics and warnings can be derived from this data.

rtreffer avatar Dec 02 '25 22:12 rtreffer