The purpose of idlestat is to measure how long we have been in the different idle and operating states.

Idlestat uses kernel's FTRACE function to monitor and capture C-state and P-state transitions of CPUs over a time interval. It extracts the following information from trace file:

  1. Times when CPUs entered and exited a certain C-state
  2. Times when CPUs entered and exited a certain P-state
  3. Raised IRQs

Following a successful run, idlestat calculates and reports the following information:

  1. Total, average, minimum and maximum time spent in each C-state, per-CPU.
  2. Total, average, minimum and maximum time spent in each P-state, per-CPU.
  3. Total, average, minimum and maximum time during which all CPUs in a cluster were in the same C-state, per-cluster.
  4. Number of times a certain IRQ caused a CPU to exit idle state, per-CPU and per-IRQ

Source Code


File bugs in the Idlestat bugzilla


Trace mode:

  sudo ./idlestat --trace -f /tmp/mytrace -t 10

Reporting mode (/tmp/mytrace already contains traces):

  sudo ./idlestat --import -f /tmp/mytrace

Trace mode with workload (e.g. sleep, cyclictest, rt-app):

  sudo ./idlestat --trace -f /tmp/mytrace -t 10 -- /bin/sleep 10

  sudo ./idlestat --trace -f /tmp/mytrace -t 10 -- cyclictest -t 4 -i 2000 -q -D 5

  sudo ./idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app mp3.json 

Selective trace output:

  sudo ./idlestate --import -f /tmp/mytrace -w

  sudo ./idlestate --import -f /tmp/mytrace -c -p

  sudo ./idlestate --import -f /tmp/mytrace -p -w


  1. It must be run as root in order to access /sys/kernel/debug.
  2. It requires tracing to be enabled in the kernel


Please send email to [email protected] for feedback or contributions. The plan is to use linux-pm for future development.


  1. How is idlestat different from powertop?

idlestat is another PM analysis tool with some overlap with the powertop functionality. However, it is designed to be a non-interactive, architecture-agnostic tool that tries to be very accurate in capturing all P-state and C-state transitions of all CPUs while minimising overhead from trace capturing.

From the captured traces, idlestat can deduce the idle time for a cluster as an intersection between the idle times of all the cpus belonging to the same cluster. This data is useful to analyse and optimise scheduling behaviour.

Feature Status

Features implemented

  • CPU idle states (C-states)
  • CPU performance states (P-states)
  • Find source of wakeup (irq #, IPI).
  • Make consistent trace ouput options.
  • Ability to import trace-cmd traces

New Feature ideas

  • Ability to import topology of target CPU to allow trace collection on target and post-processing on host.
  • Allow a diff mode to compare two traces and output the difference. This could be used to gather traces with and without some patchset and then know if there was a regression in behaviour.

  • Add a 'runs' option that automatically calculates statistics for a number of runs (iterations) and prints average statistics
  • Allow a SoC energy model to be supplied and calculate the energy consumption of a workload
  • Dynamic buffer size to prevent overflow and to handle external workloads

WorkingGroups/PowerManagement/Resources/Tools/Idlestat (last modified 2014-08-08 11:56:22)