A tool to detect energy leaks in Android applications
What the tool does
GreenDroid tool can be used to determine the methods of an application that are must likely associated with anomalous energy consumptions. It does that by running a set of tests (typical Android tests, written using the Android test framework) and collecting the information about the methods invoked, the time each test spent and an estimate of the energy consumed per test.
Its workflow is the following:
- Receives the path to the application project and to the test project;
- Intruments the code of both the projects in order to enable tracing and power consumption measuring;
- Uses ant to build the .apk files of both projects;
- Installs them on the connected device;
- Runs the tests of the application;
- When tests are done, it pulls the information out off the device;
- Runs an algorithm to detect methods associated with anomalous energy consumption;
- Classify each method analyzed, and generate the result to a JSON file;
The GreenDroid tool is currently developed in a way that the input needed (application and test project) are set inside the application code. We intend to soon include a property/configuration file, where are the variables can be previously set.