A tool to measure laptop power consumption.
powerstat [-b] [-d secs] [-h] [-i idle] [-p] [-r] [-s] [-z] [delay [count]]
powerstat is a program that measures the power consumption of a mobile PC that has a battery power souce. The output is like vmstat but also shows power consumption statistics. At the end of a run, powerstat will calculate the average, standard deviation and min/max of the gathered data.
Note that running powerstat as root will provide extra information about processes that have fork'd, exec'd and exited.
powerstat options are as follow:
-b
redo a sample measurement if a system is busy, the default for busy is considered less than 98% CPU idle. The CPU idle threshold can be altered using the -i option.
-d
specify delay before starting, default is 15 seconds. This gives the machine time to settle down and to dim the laptop display when in idle mode.
-h
show help.
-i
specify the idle threshold (in % CPU idle) to force a re-sample measurement if the CPU is less idle than this level. This option implicitly enables the -b option.
-p
redo a sample measurement if any processes fork(), exec() or exit().
-r
redo if system is not idle and any processes fork(), exec() or exit(), an alias for -p -b
-s
this dumps a log of the process fork(), exec() and exit() activity on completion.
-S
use standard averaging to calculate power consumption instead of using a 120 second rolling average of capacity samples. This is only useful if the battery reports just capacity values and is an alternative method of calculating the power consumption based on the start and current battery capacity.
-z
forcibly ignore zero power rate readings from the battery, don't use this unless you know what you are doing.
Measure power with the default of 10 samples with an interval of 10 seconds
powerstat
Measure power with 60 samples with an interval of 1 second
powerstat 1 60
Measure power and redo sampling if we are not idle and we detect fork()/exec()/exit() activity
sudo powerstat -r
Measure power and redo sampling if less that 95% idle
powerstat -i 95
Wait to settle for 1 minute then measure power every 20 seconds and show any fork()/exec()/exit() activity at end of the measuring
powerstat -d 60 -s 20
powerstat was written by Colin King <[email protected]>
This manual page was written by Colin King <[email protected]>, for the Ubuntu project (but may be used by others).