Get current CPU power consumption as a single reading

On a 12.1-RELEASE system, I can use sysutils/powermon to display the current power use of the chosen CPU package. As per the powermon man page, "The powermon utility reads the CPU internal power counters, calculates the current power consumption and displays it on a nice curses interface."

Is there a simple way of just obtaining the current power consumption or, if it does not exist, an average of the last x seconds as a single reading instead of as a TUI output? As in a sysctl(8) MIB value that could be read? Having waded through sysctl -a, I see no obvious resource for this. ipmitool is able to give me the power consumption of the whole system in Pwr Consumption, but powermon does it for the CPU(s) only.

Thank you for any pointers that will help me solve this.

Edit: if this is hardware-dependent and the configuration matters, then let it be stated that the computer is a Dell PowerEdge R720 with two E5-2630L v2s.
 
Last edited by a moderator:
On my laptop (ThinkPad T430s) I can get whole power consumption only when laptop is on battery:
Code:
acpiconf -i0 | grep 'Present rate'
Cannot get power consumption when laptop is not on battery (only CPU-GPU package with powermon).
A few weeks back tried to hack powermon into small C program for taskbar/statusbar (so it can be run every N time periods) but gave up. To my understanding (at least for my system): No, you must calculate it, there are no stored values except current power draw which is stored inside CPU register, read by powermon. Your system may have additional voltage or current meters.

Something similar is with CPU utilization - in the end I made small C program which reads kern.cp_time, stores it in temporary file and calculates utilization on the next run.
 
[...] Something similar is with CPU utilization - in the end I made small C program which reads kern.cp_time, stores it in temporary file and calculates utilization on the next run.
You can copy & paste that from the source code of powerd(8) (/usr/src/usr.sbin/powerd/powerd.c) w/o using a tmp file. Maybe there will be an extended version of kern.cp_time(s) which exposes CPU usage fifo, realtime and user_idle in future releases of FreeBSD.
 
You can copy & paste that from the source code of powerd(8) (/usr/src/usr.sbin/powerd/powerd.c) w/o using a tmp file. Maybe there will be an extended version of kern.cp_time(s) which exposes CPU usage fifo, realtime and user_idle in future releases of FreeBSD.
Yes, you can, but purpose of that applet was to be run from statusbar (tint2) every second. Started thinking of creating daemon which will be queried for information but scratched that idea for simpler tmp file because writting that applet was already procrastination :rolleyes:
Anyway, maybe it will be useful for someone else, that applet can be found here: https://github.com/thefallenidealist/scripts/blob/master/src/cpu-usage.c

Thanks for the link, I'll try it
 
Yes, you can, but purpose of that applet was to be run from statusbar (tint2) every second. Started thinking of creating daemon which will be queried for information but scratched that idea for simpler tmp file because writting that applet was already procrastination
In tint2 I use this method: the Executor command is : tail -F /tmp/tint2_cpu_temp, Interval is set to 0 and Continuous output to 1.
The daemon rewrite the /tmp/tint2_cpu_temp file when the CPU temperature changes and tint2 updates the info.
 
Back
Top