Modeling the power profile of mobile applications is a crucial activity to identify the causes behind energy leaks. To this aim, researchers have proposed hardware-based tools as well as model-based and software-based techniques to approximate the actual energy profile. However, all these solutions present their own advantages and disadvantages. Hardware-based tools are highly precise, but at the same time their use is bound to the acquisition of costly hardware components. Model-based tools require the calibration of parameters needed to correctly create a model on a specific hardware device. Software-based approaches do not need any hardware components, but they rely on battery measurements and, thus, they are hardware-assisted. These tools are cheaper and easier to use than hardware-based tools, but they are believed to be less precise. In this paper, we take a deeper look at the pros and cons of software-based solutions investigating to what extent their measurements depart from hardware-based solutions. To this aim, we propose a software- based tool named PETrA that we compare with the hardware- based Monsoon toolkit on 54 Android apps. The results show that PETrA performs similarly to M ONSOON despite not using any sophisticated hardware components. In fact, in all the apps the mean relative error with respect to M ONSOON is lower than 0.05. Moreover, for 95% of the analyzed methods the estimation error is within 5% of the actual values measured using the hardware-based toolkit.
Water Industry Process Automation & Control Monthly - April 2024
Software-Based Energy Profiling of Android Apps: Simple, Efficient and Reliable?
1. Software-Based Energy Profiling
of Android Apps
Simple, Efficient and Reliable?
Andrea De LuciaAnnibale Panichella
Dario Di Nucci Fabio Palomba
Andy Zaidman
Antonio Prota
2. Number of smartphone users worldwide from 2014 to 2020
(in billions)
The statistics portal association.
3. IDC. Top 10 Smartphone Purchase Drivers.
2014. IDC's ConsumerScape 360.
Top 10 Smartphone Purchase Drivers
Battery Life 56% 49% 53%
Ease of Use 33% 39% 38%
Operating System 37% 32% 40%
Touch Screen 34% 34% 37%
Screen Size 37% 22% 34%
4. Users complain about energy
consumption of their apps.
Energy consumption affects user
ratings on app stores.
Commercial apps do not have less
problems than freely available
applications.
Wilke et al. Energy consumption and efficiency in mobile applications: A user feedback study.
2013. IEEE International Conference on Green Computing.
5. “(The faulty batteries were made) because we needed higher
capacity batteries for the Note 7”
Koh Dong-jin
Samsung’s mobile business chief
on Samsung Note 7 battery issue
6. “There is growing consensus that advances in battery
technology and low-power circuit design cannot,
by themselves, meet the energy needs
of future mobile computers”
Flinn and Satyanarayanan
Flinn and Satyanarayanan, Energy-aware adaptation for mobile applications.
1999. ACM Symposium on Operating Systems Principles.
7.
8. Lack of tools for quickly and efficiently measure the energy
consumption of mobile applications
Harman et al. Achievements, open problems and challenges for search based software testing.
2015. IEEE International Conference on Software Testing
9. Hardware-based tools Model-based tools Software-based tools
“Can SW-based tools lead to measurements close to HW-based ones
without any cost overhead?”
Lack of tools for quickly and efficiently measure the energy
consumption of mobile applications
10. Model-based tools Software-based tools
“Can SW-based tools lead to measurements close to HW-based ones
without any cost overhead?”
Lack of tools for quickly and efficiently measure the energy
consumption of mobile applications
Hardware-based tools
+ Best precision
- Require specialized HW
and people
- Sample frequency
problem
11. Hardware-based tools Model-based tools Software-based tools
+ Best precision
- Require specialized HW
and people
- Sample frequency
problem
“Can SW-based tools lead to measurements close to HW-based ones
without any cost overhead?”
+ Not require HW
- Less precise
- Need careful parameters
calibration
Lack of tools for quickly and efficiently measure the energy
consumption of mobile applications
12. Hardware-based tools Model-based tools Software-based tools
+ Best precision
- Require specialized HW
and people
- Sample frequency
problem
+ Not require HW
- Less precise
- Hawthorne effect
“Can SW-based tools lead to measurements close to HW-based ones
without any cost overhead?”
+ Not require HW
- Less precise
- Need careful parameters
calibration
Lack of tools for quickly and efficiently measure the energy
consumption of mobile applications
14. PETrA
Power Estimation Tool for Android
Based on Project Volta
Self-Modeling Paradigm*
Method Level Granularity
Minimize Hawthorne Effect
Strong Integration with Android OS
Does not require any specialized HW
*Dong and Zhong. Self-constructive high-rate system energy modeling for battery-powered mobile
systems. 2011. ACM International Conference on Mobile Systems, Applications, and Services.
16. Smartphone Components
Consumption Info
Powerprofile file
Smartphone Components State
during a Time Frame
PETrA
Energy profile computation
Systrace
Batterystats
Active Methods during a Time
Frame
dmtracedump
Energy Consumption for each
Method Call
18. How close are the estimations from PETrA
to a hardware-based tool?
Empirical Evaluation
RQ
54apps*
Linares-Vasquez et al. Mining energy-greedy api usage patterns in android apps: An empirical study.
2014. Working Conference on Mining Software Repositories.
Monsoon Toolkit*
414.899 API calls*
321 APIs*
Context selection
19. Empirical Evaluation
*Linares-Vasquez et al. Mining energy-greedy api usage patterns in android apps: An empirical study.
2014. Working Conference on Mining Software Repositories.
Test Environment Setup
LG Nexus 4* Monkeyrunner*
Data Analysis Metrics
10runs
20. Empirical Evaluation
*Linares-Vasquez et al. Mining energy-greedy api usage patterns in android apps: An empirical study.
2014. Working Conference on Mining Software Repositories.
Test Environment Setup
LG Nexus 4* Monkeyrunner*
Data Analysis Metrics
10runs
Mean Magnitude
Relative Error
MMRE
21. Empirical Evaluation
*Linares-Vasquez et al. Mining energy-greedy api usage patterns in android apps: An empirical study.
2014. Working Conference on Mining Software Repositories.
Test Environment Setup
LG Nexus 4* Monkeyrunner*
Data Analysis Metrics
10runs
Mean Magnitude
Relative Error
MMRE
Relative Error
Deviation within x
PRED(x)
22. Empirical Evaluation
*Linares-Vasquez et al. Mining energy-greedy api usage patterns in android apps: An empirical study.
2014. Working Conference on Mining Software Repositories.
Test Environment Setup
LG Nexus 4* Monkeyrunner*
Data Analysis Metrics
10runs
Mean Magnitude
Relative Error
MMRE
Relative Error
Deviation within x
PRED(x)
Ratio under/over
estimations
23. Results
In 72% of apps MMRE is within 0.01.
In the worst case MMRE is 0.04
95% of method
consumption estimations
are within 5% of error.
24. Results
89% of estimations are overestimations
11% are underestimations
accumulated noise due to
network usage
strong usage of sensors