Antonin Carette

A journey into a wild pointer

The Hot-Pepper approach

Posted at — Sep 1, 2016

Note: These observations are reported in my research report here, and a research paper is currently drafted on this. The source code of this approach is visible in Github.

During my final internship at LATECE in Montreal, I developed an approach, supported by a Python framework, to evaluate the energy consumption of Android bad practices, using the source code of the app. This approach is called Hot-Pepper. Hot-Pepper helped us to find that 3 popular Android code smells may be considered as energy code smells: HashMap Usage, Internal Getter/Setter and Member Ignoring Method. Also, it permits to evaluate picture practices, in terms of energy consumption, like formats (PNG vs JPEG), picture size (original JPEG and compressed JPEG, without degrading the quality of the picture) and picture bitmap formats to use (ARGB_8888 vs RGB_565).

Using this approach, we improved the energy consumption of 5 popular Android apps.

The approach is automated and really easy to use. It required:

The output of this approach is the source code of the most energy-efficient Android app, and the associated APK to deploy it immediatly in popular app stores.

Hot-Pepper consists in 3 steps:

  1. detect and correct of Android bad practices,
  2. compute energy metrics,
  3. analyze energy metrics.

The first step uses an improved version of Paprika, a Java application to detect statically Android code smells in an Android APK (if you are interested in using this tool, you can contact Geoffrey Hecht here, the creator of Paprika, to obtain an access). The two last steps use Naga Viper, a software that compute and analyze dynamically some energy metrics, collected on an Android app. I developed Naga Viper and some Python libraries during this internship, and it works well!

I am somewhat disappointed to not have developed Naga Viper using anything else than Python (always better than Java but…) and to not have deploy the framework in the cloud. First, I wanted to use Rust or Golang to implement Hot-Pepper. But many students don’t know these programming languages, and are not interested in understanding the advantages of those languages for this project (do you feel the frustration in my words?). The second thing is that my demand to implement the framework with a new language has been understand, and that the framework will be deploy in the cloud after the new version in… Java (-_-).

Also, I tried to develop a tool, called Ghost Pepper, which develop automatically interesting scenarios using user events, for a given Android app. The development of this tool has been more problematic than previously thought, especially to maintain a good ratio between the exploitation and the exploration of the app (the tool uses a genetic algorithm to create a new scenario), and has not been fully tested to use Hot-Pepper on selected apps.

Hot-Pepper takes me less than 4 months to have some accurate and repeatable results.

Even if it works well, the approach may be improved, and I hope Android developers will use this approach to care about the energy consumption of their apps.