Optimizing App Energy Drain by Finding Tunable App Parameters Qiang Xu Y

Optimizing App Energy Drain by Finding Tunable App Parameters Qiang Xu Y

App Parameter Energy Profiling: Optimizing App Energy Drain by Finding Tunable App Parameters Qiang Xu Y. Charlie Hu Abhilash Jindal Purdue University Purdue University Mobile Enerlytics, LLC ABSTRACT drain using an energy proler (e.g. [21, 23]), and then (2) In this paper, we observe that modern mobile apps come with determining whether and how the energy hotspots can be a large number of parameters that control the app behavior restructured to drain less energy. which indirectly aect the app energy drain, and using in- We observe that this conventional proling-based energy correct or non-optimal values for such app parameters can optimization process can be ineective in detecting app en- lead to app energy drain deciency or even energy bugs. We ergy bugs or deciency due to poorly congured parameters. argue conventional app energy optimization using an energy is is because a conventional energy proler can only pin- proler which pinpoints energy hotspot code segments in point the energy hotspot in the app source code, but the the app source code may be ineective in detecting such energy hotspots are usually controlled by the parameters in- parameter-induced app energy deciency. We propose app directly, e.g., casually data-dependent or control-dependent parameter energy proling which identies tunable app pa- on the parameters in the complex app source code. rameters that can reduce app energy drain without aecting In this paper, we argue that the huge number of param- app functions as a potentially more eective solution for de- eters in an app provides a potential opportunity to aack bugging such app energy deciency. We present the design the type of energy ineciency that can be hard to detect and implementation of Medusa, an app parameter energy with conventional energy prolers yet can be more easily ad- proling framework. Medusa overcomes three key design dressed by simply tuning relevant parameters. In particular, challenges: how to lter out and narrow down candidate pa- we propose app parameter energy proling which proles the rameters, how to pick alternative parameter values, and how energy impact of an app parameter as a potentially eective to perform reliable energy drain testing of app versions with technique to optimize app energy drain. e eectiveness of mutated parameter values. We demonstrate the eectiveness such an approach rests on the answers to two fundamental of Medusa by applying it to a set of Android apps which questions: successfully identies tunable energy-reducing parameters. (1) Are parameter induced energy ineciency common among the apps? 1 INTRODUCTION (2) Can developers routinely reduce energy drain by Most mobile apps come with a large number of parameters tuning parameters in their apps? that control various aspects of the apps. For example, apps To the best of our knowledge, this is the rst eort to study that use the GPS service have parameters controlling the the energy impact of app parameters. location update frequency, apps that oer search function- e prerequisite to such an approach, however, is a tool alities have parameters controlling the number of search that can accurately identify app parameters whose values suggestions, while all apps containing images have some can signicantly aect the app energy drain. parameters controlling the image caching policy. A principle way of developing such a tool is via static arXiv:2009.12156v1 [cs.SE] 22 Sep 2020 In addition to controlling apps’ functionalities, app pa- analysis and runtime energy drain measurement. Such an rameters can also aect the energy consumption of the apps. approach has two steps. First, at compiler time, we can In particular, incorrectly congured parameters can cause perform static analysis to extract the code segment that are unnecessarily high energy drain of an app. For example, data-dependent or control-dependent on each parameter an app may render the map unnecessarily frequently and and instrument such code segments to be surrounded by induce a high energy drain when the location is updated too energy measurement start and stop API calls. We then run frequently. Hence understanding the energy impact of app the instrumented app on an actual phone to measure the parameters is important to optimizing app energy drain. energy drain of the parameter-dependent code segments. e conventional development cycle for optimizing the However, such an approach faces a number of challenges. energy drain of mobile apps is similar to that for optimizing First, the dependencies between an app parameter and the the running time of traditional soware – iterating the pro- relevant code segments are oen hard to track, or require a cess of (1) nding code segments in the app source code that number of ad hoc customizations to achieve good coverage. contribute to a signicant portion of the total app energy For example, we observed that many dependencies are across 1 programming language boundaries, or involve communica- being watched), initial data download, server state, and back- tion with other processes or even remote servers. Second, it ground system activities. We overcome this challenge by is also hard to determine the right granularity of the code using a suite of techniques, including power model-based segments for parameter dependence analysis. Dependence energy measurement, back-to-back interleaved unmodied analysis at the level of branches has the advantage that it and modied app test runs, and hypothesis testing on the is easier to analyze the eect of dierent parameter values measured energy drain from multiple runs. that control branch conditions. However, we observed that We have developed a prototype implementation of the many parameters aect app energy consumption in ways Medusa framework on Pixel 2 and applied it to 5 popular other than controlling branch conditions. For example, app apps from Google Play. e framework automatically nar- energy consumption can be aected by controlling the timer rows down the total number of candidate parameters from duration or thread count. Alternatively, we can perform the 19761 down to 1078, out of which, its automated energy test- analysis at the granularity of methods by tracking the de- ing identies 3 energy-reduction parameters. Our manual pendency between parameters and method call arguments. inspection of the three parameters shows that one of them However, this approach has the disadvantage that the rela- is indeed a valid tunable parameter, while the other two are tion between the parameter value and the method energy false positives as they fail various components of the apps. consumption which depends on many other factors is oen In summary, our study makes the following contributions: opaque, if there is any relation at all. In this paper, we propose a conceptually straightforward • We propose app parameter energy proling, i.e., au- approach to developing such a parameter energy proling tomatically identifying and tuning tunable, energy- tool. In particular, we present a framework that automati- reduction parameters, as a promising new direction cally identies app parameters whose value if changed can to app energy optimization. have a signicant impact on the app energy drain. We denote • We present the design and prototyping of Medusa, such app parameters as valid tunable parameters, or valid an app parameter proling framework that over- parameters for short. comes a number of key challenges in automatic lter- Developing such a framework for Android apps faces sev- ing of candidate parameters and automated energy eral challenges. First, in contrast with conventional server drain testing. soware (e.g., databases and web servers), which explicitly • We present an evaluation of Medusa on a set of 5 exposes their conguration parameters to a central place [34], popular app to validate its eectiveness. parameters in Android apps are scaered all around the source code. 1 To this end, our framework starts with all the To our best knowledge, Medusa is the st app parameter constants in an app in order to have high coverage. energy proling framework and we plan to open source it Second, covering all possible constants in the app code to help foster further research on this important app energy poses another challenge of having too many candidate pa- optimization approach. rameters, making it intractable to measure the energy impact for all of them. To overcome this challenge, we develop a 2 TERMINOLOGIES combination of ltering techniques to signicantly reduce Although we consider all constants in an app, only a portion the number of candidate parameters, by exploiting a key ob- of them are “real” parameters that are actually tunable. For servation that most of the candidates either are not tunable example, values representing failure types should not be or do not aect the app energy drain. changed arbitrarily, as otherwise the app may report the Finally, for each remaining candidate parameter, the frame- wrong kind of failure. On the other hand, some parameters work needs to automatically mutate its default value up and may aect energy consumption, while others do not. For down and measure the energy drain change compared to example, changing the log level of a logger is unlikely to the app energy drain under the default parameter. Reliably cause noticeable energy dierence. To make the rest of the identifying app energy drain change due to parameter value discussion more clear, in this section we dene the dierent changes with minimal false positives and false negatives and types of parameters that concisely embody the discussion faithfully reecting the eect of the parameters is challeng- above. ing as app energy drain can be perturbed by many factors We dene a parameter to be a constant in app source including variations in UI interactions, test data (e.g., videos code that can be changed by app developers. is includes all numeric and boolean constants, enum references, as well 1We speculate that this may be due to the fact that the target users for as values in the XML resource les (Figure 1).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us