idlestat(1)
π idlestat β the CPU power-state analysis tool π
okay so bestie, welcome to idlestat(1) β that's the man page for the idlestat utils, and honestly? it's giving "your CPU is doing something shady when it says it's sleeping" and we're gonna catch it. β¨
πΈ NAME πΈ
idlestat β a CPU power-state analysis tool. she watches your CPUs nap and tells you exactly how long they napped for. π€
π¦ SYNOPSIS π¦
so there's two whole modes and here's how you summon them:
Trace mode:
idlestat --trace -f|--trace-file filename -t|--duration seconds
[OPTION] [command]
Reporting mode:
idlestat --import -f|--trace-file filename [OPTION]
β¨ DESCRIPTION β¨
idlestat rolls with two modes, periodt:
- trace mode β she measures how long the CPUs have been in the different idle and operating states, analyzes the captured events, logs them, and generates a report.
- reporting mode β she reads the trace file, analyzes the logged events in that trace file, and generates a report.
A report by idlestat shows statistics of power related states. Currently she handles P-states, C-states, and IRQ states. π
For trace mode, idlestat relies on the kernel's FTRACE function to monitor and capture C-state and P-state transitions of CPUs over a time interval. That means, for trace mode, idlestat needs a kernel with FTRACE related configurations enabled. And since it uses FTRACE, root privilege is needed when running in trace mode. π
idlestat extracts the following info from the trace file:
- Times when CPUs entered and exited a certain C-state
- Times when CPUs entered and exited a certain P-state
- Raised IRQs
Following a successful run, idlestat calculates and reports this:
- Total, average, minimum, and maximum time spent in each C-state, per-CPU.
- Total, average, minimum, and maximum time spent in each P-state, per-CPU.
- Total, average, minimum, and maximum time during which all CPUs in a cluster were in a "shallowest" (closest to running) state of all the constituent CPUs.
- Number of times a certain IRQ caused a CPU to exit idle state, per-CPU and per-IRQ
π OPTIONS π
here's the whole flag menu, no skips, we read every single one bestie:
--traceβ Runidlestatin trace mode. As noted above, root privilege is needed. Used with-tand-fto specify running duration and trace output filename, respectively.--importβ Runidlestatin reporting mode. Used with-fto specify the trace file to import.-f,--trace-filefilename β Specify the trace filename to generate (for--trace) or read (for--import).-t,--durationseconds β Time to capture in seconds[command]β If the command argument is given,idlestatwill fork a child to run the command so that you can capture related states when the command is running. Note that if the running command does not terminate before the time specified by-t,idlestatwill send aSIGTERMto the child process to ask it to terminate. If the command to run lasts less than the time specified by-t,idlestatwill terminate after the command finished.
When there is no command, idlestat does trace capture and other works dutifully. π«‘
-b,--baseline_tracebaseline_filename β Specify baseline filename for trace comparison. See COMPARISON and EXAMPLES for more information.-c,--idleβ Show idle, C-state in ACPI term, statistics. This is the default mode if neither-wnor-pis set. Note that-w,-c, and-pare not exclusive, that is, you can choose any combination of the three.-e,--energy-model-fileenergy_model β Specify energy model file. See ENERGY MODEL for the description of the energy file format.-h,--help,-?β Print simple help messages.-o,--output-filefilename β Specify the file name to output statistics. If not specified, statistics are printed tostdout.-p,--frequencyβ Show cpufreq (or say P-state) statistics.-r,--report-formatβ Specify the report format. Valid types are:default,boxless,csv, andcomparison.-v,--verboseβ Specify the verbosity level. This option could be specified multiple times. Each copy of the option increases verbosity level by one, currently the highest verbosity level used for any message is2.-w,--wakeupβ Show wakeup statistics.-B,--boxlessβ Set the report format to boxless-C,--csvβ Set the report format to comma separated values (CSV)-I,--poll-intervalβ Set kernel polling interval, which is used to determine if it's time move data from kernel FTRACE buffer to other places.-S,--buffer-sizeβ Set the kernel FTRACE buffer size to use.-V,--versionβ Showidlestatversion information and exit.
π COMPARISON π
The comparison report is used to compare changes between the active trace (specified by -f,--trace-file) and the baseline trace. It becomes active by providing a baseline trace (-b,--baseline_trace) and specifying the comparison report style with "-r comparison".
β‘ ENERGY MODEL β‘
The following describes the format of idlestat energy model files (using the included energy_model file as an example):
Lines starting with # or which are blank are ignored. π
First, specify how many clusters there are.
clusters 1
For each cluster (named clusterA, clusterB, etc.) specify how many cap states and C states there are. idlestat will check that the correct number of clusters are provided.
#
clusterA: 16 cap states 5 C states
Then specify the name, cluster power and core power for each P-state (idlestat will check if there are the correct number of P-states provided) in the cluster.
P-states:
# speed, cluster power, core power
2901 6200 3200
2900 6190 3190
2800 6180 3180
2700 6170 3170
2500 6160 3160
2400 6150 3150
2300 6140 3140
2200 6130 3130
2000 6120 3120
1900 6110 3110
1800 6100 3100
1700 6090 3090
1600 6080 3080
1400 6070 3070
1300 6060 3060
1200 6050 3050
Then specify the name, cluster power and core power for each C-state (idlestat will check if there are the correct number of C-states provided) in the cluster.
C-states:
C1-IVB 25 0
C1E-IVB 30 0
C3-IVB 35 0
C6-IVB 40 0
C7-IVB 35 0
Finally, specify the wakeup power.
wakeup 210 6
Repeat for each cluster. π
π§ TRACE FILE FORMAT π§
idlestat has its own trace file format, which is based on ftrace's format (see Documentation/trace/ftrace.txt in kernel source). Besides standard FTRACE entries, idlestat adds CPU topology, C-state information, and some artificial P-State entries. idlestat can also import standard FTRACE format and "trace-cmd report" format. Note that since there is no CPU topology and C-state information in FTRACE or trace-cmd trace files, they should be used on the machines those traces are captured. π
π REPORT FORMATS π
Currently, idlestat supports four report formats: default, boxless, csv, and comparison.
default: show C-state, P-State, and IRQ state statistics tables if corresponding-c,-p, and-wcommand line options are set. Tables come with-and|as boundaries.boxless: it's the default without-and|as table boundaries. This is more Braille terminal friendly than the default onecsv: comma separated values. This is easier to process with scripting languages, such asawkandperl. Also it's easier to be processed with spreadsheet software.comparison: This is similar to default report style, except that it displays changes in active trace compared to the baseline trace. It becomes active by providing a baseline trace (--baseline) and specifying the comparison report style with"-r comparison".
π EXAMPLES π
Assuming the idlestat binary is in your PATH.
- Run a trace, post-process the results (default is to show only C-state statistics):
sudo idlestat --trace -f /tmp/mytrace -t 10
- Run a trace, post-process the results and print all statistics:
sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w
- Run a trace with an external workload, post-process the results:
sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app
/tmp/mp3.json
- Post-process a trace captured earlier:
idlestat --import -f /tmp/mytrace
- Run a trace, post-process the results and print all statistics into a file:
sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -o
/tmp/myreport
- Run a comparison trace, say, before and after making changes to system behavior
sudo idlestat --trace -f /tmp/baseline -t 10
sudo idlestat --trace -f /tmp/changedstate -t 10
idlestat --import -f /tmp/changedstate -b /tmp/baseline -r
comparison
π LIMITATIONS π
During the acquisition, idlestat tries to stay quiescent to prevent disturbing the traces. For this reason the traces are buffered in a fixed buffer size. If the duration of the acquisition produces more traces than what the buffer is capable to store, that will result in a truncated result. so like, watch out. π«Ά
π AUTHOR π
Started by Daniel Lezcano with contributions from others. See the git log of the source code (https://git.linaro.org/power/idlestat.git) for all the contributors.
π REPORTING BUGS π
Send mail to sched-tools@linaro.org. Or, submit bugs at https://bugs.linaro.org/enter_bug.cgi under Product "power management", Component "idlestat".
β COPYRIGHT β
Copyright Β© 2015, Linaro Limited. License GPLv2: GNU GPL version 2 http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Or, say, there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
πΈ SEE ALSO πΈ
trace-cmd(1), trace-cmd-format(1), trace-cmd.dat(5)
and that's the whole page bestie π this was version 0.1, dated 2015-01-10, from the idlestat utils β go forth and catch those CPUs mid-nap, ily, bye πβ¨
π¦ where this page comes from
- debian bookworm: idlestat 0.8-6 Β· GPL-2.0-only
- debian trixie: idlestat 0.8-8 Β· GPL-2.0-only
- ubuntu jammy: idlestat 0.8-5 Β· GPL-2.0-only
- ubuntu noble: idlestat 0.8-8 Β· GPL-2.0-only
- ubuntu questing: idlestat 0.8-8
- ubuntu resolute: idlestat 0.8-10 Β· GPL-2.0-only
- ubuntu stonking: idlestat 0.8-12 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms