1POWERSTAT(8) System Manager's Manual POWERSTAT(8)
2
3
4
6 powerstat - a tool to measure power consumption
7
8
10 powerstat [options] [delay [count]]
11
12
14 powerstat measures the power consumption of a computer that has a bat‐
15 tery power source or supports the RAPL (Running Average Power Limit)
16 interface. The output is like vmstat but also shows power consumption
17 statistics. At the end of a run, powerstat will calculate the average,
18 standard deviation, minimum, maximum and geometic mean of the gathered
19 data.
20
21 Note that running powerstat as root will provide extra information
22 about process fork(2), exec(2) and exit(2) activity.
23
24
26 powerstat options are as follow:
27
28 -a enable all statistics gathering options, equivalent to -c, -f,
29 -t and -H.
30
31 -b redo a sample measurement if a system is busy, the default for
32 busy is considered less than 98% CPU idle. The CPU idle thresh‐
33 old can be altered using the -i option.
34
35 -c gather CPU C-state activity and show the % time and count in
36 each C-state at the end of the run.
37
38 -d delay
39 specify delay in seconds before starting, default is 180 seconds
40 when running on battery or 0 seconds when using RAPL. This gives
41 the machine time to settle down and for the battery readings to
42 stabilize.
43
44 -D enable extra power stats showing all the power domain power
45 readings. This currently only applies to the -R RAPL option.
46
47 -f compute the geometric mean of all on-line CPU core frequencies.
48 Unfortunately a CPU core is always active to gather any form of
49 stats because powerstat has to be running to do so, so these
50 statistics are skewed by this. It is best to use this option
51 with a reasonably large delay (more than 5 seconds) between sam‐
52 ples to reduce the overhead of powerstat.
53
54 -h show help.
55
56 -H show histogram of power measurements.
57
58 -i threshold
59 specify the idle threshold (in % CPU idle) to force a re-sample
60 measurement if the CPU is less idle than this level. This option
61 implicitly enables the -b option.
62
63 -n no headings. Column headings are printed when they scroll off
64 the terminal; this option disables this and allows one to cap‐
65 ture the output and parse the data without the need to filter
66 out the headings.
67
68 -p redo a sample measurement if any processes fork(), exec() or
69 exit().
70
71 -r redo if system is not idle and any processes fork(), exec() or
72 exit(), an alias for -p -b.
73
74 -R read power statistics from the RAPL (Running Average Power
75 Limit) domains. This is supported by recent Linux kernels and
76 Sandybridge and later Intel processors. This only covers some
77 of the hardware in the machine, such as the processor package,
78 DRAM controller, CPU core (power plane 0), graphics uncore
79 (power plane 1) and so forth, so the readings do not cover the
80 entire machine.
81 Because the RAPL readings are accurate and available immedi‐
82 ately, the start delay (-d option) is defaulted to zero seconds.
83
84 -s this dumps a log of the process fork(), exec() and exit() activ‐
85 ity on completion.
86
87 -S use standard averaging to calculate power consumption instead of
88 using a 120 second rolling average of capacity samples. This is
89 only useful if the battery reports just capacity values and is
90 an alternative method of calculating the power consumption based
91 on the start and current battery capacity.
92
93 -t gather temperatures from all the available thermal zones on the
94 device. If there are no thermal zones available then nothing
95 will be displayed.
96
97 -z forcibly ignore zero power rate readings from the battery. Use
98 this to gather other statistics (for example when using -c, -f,
99 -t options) if powerstat cannot measure power (not discharging
100 or no RAPL interface).
101
103 Measure power with the default of 10 samples with an interval of 10
104 seconds
105 powerstat
106
107 Measure power with 60 samples with an interval of 1 second
108 powerstat 1 60
109
110 Measure power and redo sampling if we are not idle and we detect
111 fork()/exec()/exit() activity
112 sudo powerstat -r
113
114 Measure power using the Intel RAPL interface:
115 powerstat -R
116
117 Measure power using the Intel RAPL interface and show extra RAPL domain
118 power readings and power measurement histogram at end of the run
119 powerstat -RDH
120
121 Measure power and redo sampling if less that 95% idle
122 powerstat -i 95
123
124 Wait to settle for 1 minute then measure power every 20 seconds and
125 show any fork()/exec()/exit() activity at end of the measuring
126 powerstat -d 60 -s 20
127
128 Measure temperature, CPU frequencies, C-states, power via RAPL domains,
129 produce histograms, don't print repeated headings and measure every 0.5
130 seconds
131 powerstat -tfcRHn 0.5
132
134 vmstat(8), powertop(8), power-calibrate(8)
135
137 powerstat was written by Colin Ian King <colin.i.king@gmail.com>
138
139 This manual page was written by Colin Ian King
140 <colin.i.king@gmail.com>, for the Ubuntu project (but may be used by
141 others).
142
144 Copyright © 2011-2021 Canonical Ltd. Copyright © 2021-2023 Colin Ian
145 King
146 This is free software; see the source for copying conditions. There is
147 NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
148 PURPOSE.
149
150
151
152 24 January 2023 POWERSTAT(8)