🌐
Linux Command Library
linuxcommandlibrary.com › man › powerstat
powerstat man | Linux Command Library
powerstat linux command man page: Measure system power consumption statistics
🌐
CommandMasters
commandmasters.com › commands › powerstat-linux
How to Use the Command 'powerstat' (with examples)
The -a flag enables all of powerstat’s detailed statistical options. The first argument (5) sets the interval for metrics collection to 5 seconds. The second argument (20) determines that the command will take 20 samples.
🌐
GoLinuxHub
golinuxhub.com › 2018 › 06 › how-to-measure-power-consumption-in-watts-powerstat-linux-examples
How to measure power consumption in watts using powerstat in Linux with examples | GoLinuxHub
June 18, 2018 - I will be running below command in one of the terminal to put some load on the node · # stress -c 18 -i 13 -m 3 stress: info: [5200] dispatching hogs: 18 cpu, 13 io, 3 vm, 0 hdd ... # powerstat -R -c -z Running for 60.0 seconds (60 samples at 1.0 second intervals).
🌐
Ubuntu Manpages
manpages.ubuntu.com › manpages › jammy › man8 › powerstat.8.html
Ubuntu Manpage: powerstat - a tool to measure power consumption
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 using ...
🌐
Command Examples
commandexamples.com › linux › powerstat
Examples of powerstat Command in Linux - Command Examples
April 27, 2024 - Linux Commands · powerstat · Measures the power consumption of a computer that has a battery power source or supports the RAPL interface. More information: https://manned.org/powerstat.
🌐
Ubuntu
manpages.ubuntu.com › manpages › trusty › man8 › powerstat.8.html
Ubuntu Manpage: powerstat - a tool to measure laptop power consumption.
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 ...
🌐
The Geek Diary
thegeekdiary.com › powerstat-command-examples-in-linux
powerstat Command Examples in Linux – The Geek Diary
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 ...
Top answer
1 of 1
8

Speaking on the power devices builtin statistics reporting capabilities level, not all devices support providing statistics ... Use the upower command of UPower to list power devices with the option -e like so(this is a demonstration on a test system):

$ upower -e
/org/freedesktop/UPower/devices/line_power_ADP0
/org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/DisplayDevice

Then check the information of the device you want with the option -i ... Names are pretty descriptive, so the direct power line:

$ upower -i /org/freedesktop/UPower/devices/line_power_ADP0
  native-path:          ADP0
  power supply:         yes
  updated:              Fri 11 Aug 2023 03:45:32 PM +03 (68 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              yes
    icon-name:          'ac-adapter-symbolic'

and as you can see, it doesn't have statistics ... So, information about current power consumption (among other information) can't be pulled from that device.

While the battery:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               LGC
  model:                L16L2PB2
  serial:               5545
  power supply:         yes
  updated:              Fri 11 Aug 2023 03:47:33 PM +03 (2 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              5.06 Wh
    energy-empty:        0 Wh
    energy-full:         17.99 Wh
    energy-full-design:  30 Wh
    energy-rate:         9.238 W
    voltage:             7.744 V
    charge-cycles:       N/A
    time to full:        1.4 hours
    percentage:          28%
    capacity:            59.9667%
    technology:          lithium-polymer
    icon-name:          'battery-low-charging-symbolic'
  History (charge):
    1691758053  28.000  charging
  History (rate):
    1691758053  9.238   charging

does have statistics and among those is energy-rate: which you can isolate and format for printing with something like this:

$ upower --show-info /org/freedesktop/UPower/devices/battery_BAT0 |
awk '/energy-rate:/{print $2}'
10.828 # <--- output

However, the statistics update interval might vary and updated: shows the time the statistics were last updated, but you can force statistics refresh of a certain device with for example:

busctl call org.freedesktop.UPower \
/org/freedesktop/UPower/devices/battery_BAT0 \
org.freedesktop.UPower.Device Refresh

and you can pull for e.g. energy-rate every for example three seconds with something like this:

while sleep 3
do
# Refresh device statistics
busctl call org.freedesktop.UPower \
/org/freedesktop/UPower/devices/battery_BAT0 \
org.freedesktop.UPower.Device Refresh
# Query the device statistics
upower -i /org/freedesktop/UPower/devices/battery_BAT0 |
awk '/energy-rate:/{print $2}'
done
Find elsewhere
🌐
Forrestcli
forrestcli.com › tools › powerstat
Important commands for the CLI tool "powerstat" | Forrest
List of all important CLI commands for "powerstat" and information about the tool, including 5 commands for Linux, MacOs and Windows.
🌐
Hectic Geek
hecticgeek.com › home › powerstat: power consumption calculator for ubuntu linux
powerstat: Power Consumption Calculator for Ubuntu Linux - Hectic Geek
October 9, 2021 - This will save the average power consumption on a file called ‘average_power_consumption.txt’ on your ‘Home’ folder. You can play with the ‘-d0’ or can remove it completely if you prefer as well. For learning more about ‘powerstat, you can refer to its manual using the below command.
🌐
Abilian
lab.abilian.com › Tech › Green IT › Power consumption (Linux servers)
Power consumption (Linux servers) - Abilian Innovation Lab
Powerstat: Tracks and logs power consumption: bash sudo apt install powerstat powerstat -d 0 1 60 · Customizable for intervals and sampling frequency, providing averaged and peak power data. For precise and reliable power usage metrics, external power meters such as Kill A Watt or intelligent ...
🌐
Code Tools
code.tools › man › 8 › powerstat
powerstat (8): Linux man pages – code.tools
Note that running powerstat as root will provide extra information about processes that have fork'd, exec'd and exited.
🌐
Linux Mint Community
community.linuxmint.com › software › view › powerstat
Linux Mint - Community
Powerstat measures the power consumption of a mobile PC that has a battery power source. 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. ... Command line base.
🌐
Baeldung
baeldung.com › home › administration › finding the power consumption of a machine in linux
Finding the Power Consumption of a Machine in Linux | Baeldung on Linux
March 18, 2024 - $ powerstat Running for 300.0 seconds (30 samples at 10.0 second intervals). Power measurements will start in 180 seconds time. Waiting 180 seconds before starting (gathering samples).
🌐
Alpine Linux
pkgs.alpinelinux.org › package › edge › testing › x86 › powerstat
powerstat - Alpine Linux packages
linux-headers · so:libc.musl-x86.so.1 · Required by (0) None · Sub Packages (2) powerstat-bash-completion · powerstat-doc · Provides (1) cmd:powerstat ·