Editing N900 software power management

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
This page may be useful to application developers, as well as those interested in reducing power usage of software by configuring it correctly.
+
This is a work in progress. It is not yet ready for public consumption. Please don't link it into wiki yet.
-
Also refer to http://www.lesswatts.org/projects/applications-power-management/
+
This page may be useful to application developers, as well as those interested in reducing power usage of software by configuring it correctly.
==Why software uses power==
==Why software uses power==
Line 68: Line 68:
The below tools directly measure electrical current usage by the phone. They should be run with the device unplugged from USB. Battery capacity is measured in Amp-Hours. The BL-5J in the N900 has a capacity of 1.4 Ah. It can provide 1 A for a little over an hour, but it's very hard to get it to use that much. If the current drops, the time rises.
The below tools directly measure electrical current usage by the phone. They should be run with the device unplugged from USB. Battery capacity is measured in Amp-Hours. The BL-5J in the N900 has a capacity of 1.4 Ah. It can provide 1 A for a little over an hour, but it's very hard to get it to use that much. If the current drops, the time rises.
-
For example, in standby with wifi and phone enabled but idle, the current usage is around .006 A, leading to a standby life of around 10 days. (1.4 Ah/.006 A = 220 h = 10 days. 0.006 A is a cumbersome figure, so the unit 'Milliamp' - mA - 1/1000th of an amp is used. 6 mA when idle is great, but it is easy if everything does not go right to use lots more than this when idle. For example, if the CPU is constantly active, it will use over 100 mA - draining the battery in around 12 hours.
+
For example, in standby with wifi and phone active but idle, the current usage is around .006 A, leading to a standby life of around 10 days. (1.4 Ah/.006 A = 220 h = 10 days. 0.006 A is a cumbersome figure, so the unit 'Milliamp' - mA - 1/1000th of an amp is used. 6 mA when idle is great, but it is easy if everything does not go right to use lots more than this when idle. For example, if the CPU is constantly active, it will use over 100 mA - draining the battery in around 12 hours.
==Debugging==
==Debugging==
Line 88: Line 88:
if [[ -e /sys/class/power_supply/bq27200-0/current_now ]]
if [[ -e /sys/class/power_supply/bq27200-0/current_now ]]
then
then
-
  current_read='cat /sys/class/power_supply/bq27200-0/current_now'
+
current_read='cat /sys/class/power_supply/bq27200-0/current_now'
-
  echo Using kernel battery driver to read current.
+
echo Using kernel battery driver to read current.
else
else
-
  if  command -v i2cget >/dev/null
+
if  command -v i2cget >/dev/null
-
  then
+
then
-
    current_read='i2cget -y 2 0x55 0x14 w'
+
current_read='i2cget -y 2 0x55 0x14 w'
-
    echo "Using I2C to read charge meter directly"
+
echo Using I2C to read charge meter directly
-
  else
+
else
-
    echo "Cannot find a way to read the charge meter."
+
echo Cannot find a way to read the charge meter.
-
    echo "Either i2ctools from extras-devel must be installed, or the power kernel with the bq27x00_battery module which normally accompanies it."
+
echo Either i2ctools from extras-devel must be installed, or the power kernel with the bq27x00_battery module which normally accompanies it.
-
    echo "Exiting."
+
echo Exiting.
-
    exit
+
exit
-
  fi
+
fi
fi
fi
#                                      Reset timer stats.
#                                      Reset timer stats.
Line 106: Line 106:
while true        #                    Loop while printing stats
while true        #                    Loop while printing stats
do
do
-
  echo 1 >/proc/timer_stats  #          Start gathering stats
+
echo 1 >/proc/timer_stats  #          Start gathering stats
-
  sleep 5                    #          Sleep 5s
+
sleep 5                    #          Sleep 5s
-
  echo 0 >/proc/timer_stats  #          Finish stats.
+
echo 0 >/proc/timer_stats  #          Finish stats.
-
#                                       Print output, assuming sense resistor is 22 milliohms.
+
#                                     Print output, assuming sense resistor is 22 milliohms.
-
  echo `date` $((`$current_read` * 3570 / 22 / 1000))mA `tail -1 /proc/timer_stats`
+
echo `date` $((`$current_read` * 3570 / 22 / 1000))mA `tail -1 /proc/timer_stats`
done
done
</source>
</source>
Line 123: Line 123:
  ...
  ...
-
This shows that immediately after starting, the script measured over the first 5 s (actually for the 5s window that ended before script started) a power consumption of 25 mA. This will discharge in one hour the battery by 25 milliamp-hours. It has a total capacity of around 1200 mAh - so will last about 1200 mAh/25 mA = 75 hours (roughly).
+
This shows that immediately after starting, the script measured over the first 5 s a power consumption of 25 mA. This will discharge in one hour the battery by 25 milliamp-hours. It has a total capacity of around 1200 mAh - so will last about 1200 mAh/25 mA = 75 hours (roughly).
Wifi however uses a significant amount of power. By comparison, this is the result when redirecting the output to a file.
Wifi however uses a significant amount of power. By comparison, this is the result when redirecting the output to a file.
Line 139: Line 139:
===Powertop===
===Powertop===
-
 
-
Obsolete by http://maemo.org/packages/view/zzztop/
 
The output of powertop, when run as root, is shown below, with some comments. Much of the output is probably not directly useful for you.
The output of powertop, when run as root, is shown below, with some comments. Much of the output is probably not directly useful for you.
Line 258: Line 256:
  apt-get install htop
  apt-get install htop
-
Full documentation can be found [http://htop.sourceforge.net/ at the htop project pages on sourceforge] (in case you wonder: the F(n)-keys can get typed on N900 as ESC-<n>, so ESC + "1" for F1)
+
Full documentation can be found [http://htop.sourceforge.net/ at the htop project pages on sourceforge]
[[image:htop.png]]
[[image:htop.png]]

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)