Hourly or daily power consumption or power average consumption
2
votes
0
answers
526
views
I've read countless posts about reducing power consumption, and that's not why I'm here.
I'm looking to get daily or hourly power usage statistics, so that I can estimate the cost of keeping equipment running 24/7.
How do I do that??
I don't need an exact value, I'm ok with a good estimate.
I've looked into
powertop
and /sys/class/powercap/*/energy_uj
, but I don't know if I'm reading those correctly, for example:
powertop says I use 351J for a sample of 60 seconds:
$ powertop -t 60 -C powertop.csv ; cat powertop.csv | grep 'The power consumed was'
modprobe cpufreq_stats failedLoaded 65 prior measurements
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask d
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask d
Devfreq not enabled
glob returned GLOB_ABORTED
Preparing to take measurements
To show power estimates do 250 measurement(s) connected to battery only
Taking 1 measurement(s) for a duration of 60 second(s) each.
the port is sda
PowerTOP outputing using base filename powertop.csv
The power consumed was : 351 J;
for the same 60 seconds interval, all the energy_uj files give a completely different value:
$ v0=$(cat /sys/class/powercap/intel-rapl\:0/energy_uj); \
v00=$(cat /sys/class/powercap/intel-rapl\:0\:0/energy_uj); \
v01=$(cat /sys/class/powercap/intel-rapl\:0\:1/energy_uj); \
sleep 60; \
v1=$(cat /sys/class/powercap/intel-rapl\:0/energy_uj); \
v10=$(cat /sys/class/powercap/intel-rapl\:0\:0/energy_uj); \
v11=$(cat /sys/class/powercap/intel-rapl\:0\:1/energy_uj); \
echo "(($v1 - $v0) + ($v10 - $v00) + ($v11 -$v01)) / 1000000" | bc -l
132.10661700000000000000
Thanks all!
Asked by Syco
(196 rep)
Dec 3, 2021, 12:55 PM