The “powerstat” command is a Linux command that can be used to measure the power consumption of a computer that has a battery power source or supports the RAPL (Running Average Power Limit) interface. This command provides useful information about the power consumption of the system, which can help users optimize power usage and prolong battery life.
The power consumption of a computer can be affected by various factors such as the hardware components, system load, and power management settings. The “powerstat” command can provide information about the real-time power consumption of the system, as well as other statistics such as the energy used and the battery status.
If you encounter the below error while running the command powerstat:
powerstat: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install powerstat |
Ubuntu | apt-get install powerstat |
Kali Linux | apt-get install powerstat |
Raspbian | apt-get install powerstat |
powerstat Command Examples
1. Measure power with the default of 10 samples with an interval of 10 seconds:
# powerstat
2. Measure power with custom number of samples and interval duration:
# powerstat interval number_of_samples
3. Measure power using Intel’s RAPL interface:
# powerstat -R interval number_of_samples
4. Show a histogram of the power measurements:
# powerstat -H interval number_of_samples
5. Enable all statistics gathering options:
# powerstat -a interval number_of_samples