Difference between revisions of "How to measure power consumption"

From ThinkWiki
Jump to: navigation, search
(tp_smapi)
m (Added Dstat command-line to track power usage)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
==Direct measurement during operation==
 
To monitor the laptop's power consumption while it is running, unplug the AC power and run:
 
To monitor the laptop's power consumption while it is running, unplug the AC power and run:
 
:{{cmdroot|watch -n1 'cat /proc/acpi/battery/BAT0/*'}}
 
:{{cmdroot|watch -n1 'cat /proc/acpi/battery/BAT0/*'}}
Line 9: Line 10:
 
:{{cmdroot|watch -n1 'cat /sys/devices/platform/smapi/BAT0/power_avg'}}
 
:{{cmdroot|watch -n1 'cat /sys/devices/platform/smapi/BAT0/power_avg'}}
  
The former provides the instantaneous power draw, and the latter is (roughly) an average over the last minute.
+
The former provides the instantaneous power draw, and the latter is (roughly) an average over the last minute. It's OK to use  [[tp_smapi]]'s <tt>force_discharge</tt> function instead of physically disconnecting AC power.
  
 
Note that running on battery power may activate power-saving mechanisms, so unless you take care to deactivate them this does not reflect power consumption under AC power.
 
Note that running on battery power may activate power-saving mechanisms, so unless you take care to deactivate them this does not reflect power consumption under AC power.
  
 +
Dstat is another way to track your laptop's power consumption, run the following with AC power unplugged to relate power usage (in Watts) and battery information:
 +
 +
[dag@moria ~]$ dstat --time --power --battery --battery-remain 10
 +
----system---- power batt remai
 +
      time    |usage|bat0| bat0
 +
15-06 08:53:55|0.000|  94| 4h29
 +
15-06 08:54:05|15.74|  94| 4h30
 +
15-06 08:54:15|15.56|  94| 4h30
 +
15-06 08:54:25|15.52|  94| 4h30
 +
15-06 08:54:35|15.60|  93| 4h29
 +
 +
==Measurement script==
 +
See [[Script_for_monitoring_power_consumption]].
 +
 +
==Measurement for synthetic workloads==
 +
Use the [http://bltk.sourceforge.net Battery Life Tool Kit] tool.
 +
 +
==Measurement during suspend==
 
To measure power consumption while the laptop is suspended, use the [[ACPI sleep power drain test script]].
 
To measure power consumption while the laptop is suspended, use the [[ACPI sleep power drain test script]].
  
 +
==Hardware-measurement on line or ac-adapter==
 +
The best (imho) method to measure power consumption is to measure the power drawn by the laptop from the ac-adapter or the power drawn by the ac-adapter itself by a wattmeter. If you want to measure drawn only by the laptop itself, you'll have to build a little adapter.
 +
 +
==See also==
 
For reducing power consumption, see [[How to reduce power consumption]].
 
For reducing power consumption, see [[How to reduce power consumption]].

Latest revision as of 08:03, 15 June 2010

Direct measurement during operation

To monitor the laptop's power consumption while it is running, unplug the AC power and run:

# watch -n1 'cat /proc/acpi/battery/BAT0/*'

This requires ACPI to be enabled. The value given is (roughly) an averge over the last minute.

Alternatively, load the tp_smapi module and run the following with AC power unplugged:

# watch -n1 'cat /sys/devices/platform/smapi/BAT0/power_now'

or

# watch -n1 'cat /sys/devices/platform/smapi/BAT0/power_avg'

The former provides the instantaneous power draw, and the latter is (roughly) an average over the last minute. It's OK to use tp_smapi's force_discharge function instead of physically disconnecting AC power.

Note that running on battery power may activate power-saving mechanisms, so unless you take care to deactivate them this does not reflect power consumption under AC power.

Dstat is another way to track your laptop's power consumption, run the following with AC power unplugged to relate power usage (in Watts) and battery information:

[dag@moria ~]$ dstat --time --power --battery --battery-remain 10
----system---- power batt remai
     time     |usage|bat0| bat0
15-06 08:53:55|0.000|  94| 4h29
15-06 08:54:05|15.74|  94| 4h30
15-06 08:54:15|15.56|  94| 4h30
15-06 08:54:25|15.52|  94| 4h30
15-06 08:54:35|15.60|  93| 4h29

Measurement script

See Script_for_monitoring_power_consumption.

Measurement for synthetic workloads

Use the Battery Life Tool Kit tool.

Measurement during suspend

To measure power consumption while the laptop is suspended, use the ACPI sleep power drain test script.

Hardware-measurement on line or ac-adapter

The best (imho) method to measure power consumption is to measure the power drawn by the laptop from the ac-adapter or the power drawn by the ac-adapter itself by a wattmeter. If you want to measure drawn only by the laptop itself, you'll have to build a little adapter.

See also

For reducing power consumption, see How to reduce power consumption.