PowerTutor Plus
PowerTutor plus is a hack you can apply to your phone that allows PowerTutor to extract additional power metrics on your phone. Specifically this includes Sensors power information (both globally and per application), GPS power per application, and Audio power per application. Before you begin we would like to stress that this process is entirely at your own risk. We will be as detailed as we can in our instructions but if your phone no longer works after attempting this we are not responsible. The steps detailed here all work entirely in VM-land so there should be little risk of permanantly disabling your device.
Preparations
To install PowerTutor Plus you need to following things:
- A rooted android phone
- A machine running some flavor of linux
- The Android Developer Bridge installed and running on your machine
If you don't have 2 there are ways to work around this (for example you can run all of the commands directly on your phone). However no instructions are given here
Installing PowerTutor Plus
With that in mind let's begin. The first step is to figure out where your framework library is stored. Open up a shell on your device with adb and look for the following files (you should only find one):
- /system/framework/framework.odex
- /data/dalvik-cache/system@framework@framework.jar@classes.dex
- /cache/dalvik-cache/system@framework@framework.jar@classes.dex
- /path/to/your/dalvik-cache/system@framework@framework.jar@classes.dex
If you found #1 then your framework library has been pre-optimized. At this point you should run "adb pull /system/framework/framework.odex" to back up your framework library and store this in a safe place. If something goes wrong or you ever want to undo this process you'll need this file.
Moving on, wherever you found your framework library use "adb pull" to grab a copy of it. For the next step you will need the dxcut library. Download binaries or source. Additionally you'll need to download our hook definitions from here. At this point you should be set up to install the hooks.
Assume that the framework library we pulled with adb earlier is named framework.odex. Now run the following commands:
$ ./dxhook_install_hook framework.odex hook.dex framework.hooked.odex $ adb root # May not be needed if adbd is already running as root $ adb remount # Only needed if your framework library was preoptimized. $ adb push framework.hooked.odex /path/to/original/framework.library $ adb reboot # Changes won't take effect until you reboot your phone.
An viola, you should see new information populated in PowerTutor. If you do not it is possible that android saw something unusual in the timestamps for the newly written library and recreated it. Usually repeating the process fixes this.
Removing PowerTutor Plus
If your framework library was pre-optmized than to remove PowerTutor Plus just copy the copy of framework.odex that you saved initially back to its original location. You will need to run "adb remount" prior to this.
Otherwise, simply deleting the framework entry from the dalvik cache will cause it to be regenerated from the original source without the PowerTutor Plus hooks.
Email: powertutor at umich dot edu
News!
Release PowerTutor source Oct. 9th, 2011
Try out PowerTutor Plus!
Updated Power Tutor Oct. 11th, 2010 (changelist)
Updated Power Tutor to 1.3 Oct. 9th, 2010 (changelist)
Updated Power Tutor Aug. 23rd, 2010 (changelist)
Updated Power Tutor to 1.2 Aug. 1st, 2010 (changelist)
Released Power Tutor Nov. 17th, 2009