Ohm's Law
| Ohm's Law | ||
|---|---|---|
| E = I * R | E = Voltage (Volts V) | E = P / I |
| I = E / R | I = Current (Amps A) | I = P / E |
| R = E / I | R = Resistance (Ohms Ω) | |
| P = Power (Watts W) | P = E * I |
lm-sensors can monitor the CPU voltage, and the current used, so it can derive the power (in watts) by calculating watts = voltage * current.
Answer from K7AAY on askubuntu.comOn my system I can obtain the power drawn from the battery from
cat /sys/class/power_supply/BAT0/power_now
9616000
On Thinkpads if the tp_smapi module is loaded, the file is
cat /sys/devices/platform/smapi/BAT0/power_now
The value seems to be in µW, though. You can convert it with any tool you're comfortable with, e.g. awk:
awk '{print $1*10^-6 " W"}' /sys/class/power_supply/BAT0/power_now
9.616 W
In case you cannot find the location within the sysfs file system, you can search for it:
find /sys -type f -name power_now 2>/dev/null
Additionally, the package lm-sensors may be used to determine the system power usage on some machines:
# sensors power_meter-acpi-0
power_meter-acpi-0
Adapter: ACPI interface
power1: 339.00 W (interval = 1.00 s)
My laptop has none of these (it also has no battery currently), but it does have a "powercap" device.
It seems this device is able to set restrictions on the user power.
And it (naturally) can read the power draw in order to enforce them.
The power draw can be found at the energy_uj file, i.e.:
cat /sys/class/powercap/*/energy_uj
It'll show the lecture (or lectures, if you have many powercap devices) in micro-Joules. This is actually a counter of the energy consumed, so you need to divide it by a time delta in order to get the power.
Is this the power drawn by my laptop, or just a part of it? I don't know.
embedded - power consumption of sensors - Electrical Engineering Stack Exchange
How do you monitor power consumption?
Concerning power watt reading from lm-sensors
lm-sensors power measurement not read by sensors plugin
Since power usage (at least cpu-wise) is fairly easy to monitor in windows (hwinfo). Is there is a cli equivalent for linux?
Hello!
I have a fujitsu futro s920 pc I'm setting pfSense up on. I was a bit concerned about NIC temps so I loaded ubuntu on it to check the temps.
Running sensors command
fam15h_power-pci-00c4
Adapter: PCI Adapter
Power1: 20.40W (interval = 0.01 2, crit= 14.98W)
The other temps were fine but this was concerning to me. I assume it's the cpu since the critical Wattage is the same as the listed TDP. But it is reading 20w, is this safe? should I be concerned? cheers any help appreciated
Once lm-sensors is installed you need to reach for your terminal:
type
sudo sensors-detect
just press ENTER for everything it suggests (shown in Uppercase)
At the end it will ask you whether to add what it finds to /etc/modules. If you are happy with the findings type "yes".
More information about lm-sensors and how to tailor it for your system can be found on the lm-sensors installation wiki page
Typing
sensors
will display the values for the sensors detected previously.
e.g.
acpitz-virtual-0
Adapter: Virtual device
temp1: +55.0°C (crit = +90.0°C)
lm-sensors 
is a set of tools to control and view sensors that may be present on your hardware. Included are several applications that run from the command line:
- sensors: shows the current readings of all sensor chips.
- sensord: daemon to periodically log sensor readings to syslog
- fancontrol: calculates fan speeds from temperatures and sets the corresponding PWM outputs
- pwmconfig: tests the PWM outputs of sensors and configures fancontrol
- and more (see lm-sensors documentation for details)
To run these programs open a terminal and type the name of the application (including optional parameters, see manpages for details). This will give an output similar as shown here for sensors:
~$ sensors
k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp: +30.0°C
Core0 Temp: +30.0°C
Core1 Temp: +29.0°C
Core1 Temp: +36.0°C
it8718-isa-0228
Adapter: ISA adapter
[...] # shortened
Configuration of lm-sensors is done by configuration files in /etc/sensors3.conf and in /etc/sensors.conf (for details see manpage for sensors.conf).