Sunday, April 10, 2011

How Many Ampere Consumed by Ubuntu Laptop?

We can monitor how many ampere consumed by our Ubuntu laptop. Unfortunately, we still can't do them in Ubuntu desktop. ACPI interface will be used to employ this technique.

# Goto /proc/acpi/battery directory
cd /proc/acpi/battery
# There is only one directory and the name is different in accordance with laptop specifications. For example, my folder name is C1AC.
cd C1AC
# You will see three files: alarm, info, and state. Try to show the content of "state" file
cat state
# You will get a technical state about battery like shown here:
present:                 yes
capacity state: ok
charging state: charging
present rate: 1505 mA
remaining capacity: 840 mAh
present voltage: 16410 mV

# We only want to get ampere used, so just grep them
cat state | grep "present rate"
# The output is ampere present rate shown in mA
present rate:            1505 mA

We will use this technique to get power (in Watt) consumed by Ubuntu laptop. Enjoy!

No comments: