Improving Energy Efficiency Through Automatic Refactoring

  • Luis Cruz University of Porto
  • Rui Abreu University of Lisbon / INESC-ID

Abstract

The ever-growing popularity of mobile phones has brought additional challenges to the software development lifecycle. Mobile applications ought to provide the same set of features as conventional software, with limited resources: such as limited processing capabilities, storage, screen and, not less important, power source. Although energy efficiency is a valuable requirement, developers often lack knowledge of best practices. In this paper, we propose a tool to improve the energy efficiency of Android applications using automatic refactoring — Leafactor. The tool features five energy code smells that tend to go unnoticed. In addition, we study whether automatic refactoring can aid developers to ship energy efficient mobile applications with a dataset of 140 free and open source apps. As a result, we detect and fix code smells in 45 Android apps, from which 40% have successfully merged our changes into the official repository.

Downloads

Download data is not yet available.

References

Agolli, T., Pollock, L., and Clause, J. (2017). Investigating decreasing energy usage in mobile apps via indistinguishable color changes. In Proceedings of the 4th International Conference on Mobile Software Engineering and Systems, pages 30–34. IEEE Press

Banerjee, A. and Roychoudhury, A. (2016). Automated refactoring of Android apps to enhance energy-efficiency. In Proceedings of the International Workshop on Mobile Software Engineering and Systems, pages 139–150. ACM.

Couto, M., Carção, T., Cunha, J., Fernandes, J. P., and Saraiva, J. (2014). Detecting anomalous energy consumption in Android applications. In Brazilian Symposium on Programming Languages, pages 77–91. Springer

Cruz, L. and Abreu, R. (2017). Performance-based guidelines for energy efficient mobile applications. In Proceedings of the 4th International Conference on Mobile Software Engineering and Systems, pages 46–57. IEEEPress.

Cruz, L.and Abreu,R.(2018). Using automatic refactoring to improve energy efficiency of android apps. In CIbSE XXI Ibero-American Conference on Software Engineering.

Cruz, L. and Abreu, R. (2019). Catalog of energy patterns for mobile applications. Empirical Software Engineering.

Cruz, L., Abreu, R., and Rouvignac, J.-N. (2017). Leafactor: Improving energy efficiency of Android apps via automatic refactoring. In Proceedings of the 4th International Conference on Mobile Software Engineering and Systems, MOBILESoft’17, pages 205–206. IEEEPress.

DiNucci,D., Palomba,F., Prota,A., Panichella,A., Zaidman,A., and DeLucia,A. (2017). Petra: a software-based tool for estimating the energy profile of Android applications. In Proceedings of the 39th International Conference on Software Engineering Companion, pages 3–6. IEEEPress

Ebert,J. , Riediger,V., and Winter,A. (2008). Graph technology in reverse engineering–the tgraph approach. In Proc. Cruzetal. 2019 10th Workshop Software Reengineering. GI Lecture Notes in Informatics. Citeseer.

Etzkorn, L., Davis, C., and Li, W. (1998). A practical look at the lack of cohesion in methods metric. In Journal of Object-Oriented Programming. Citeseer

Gottschalk, M., Josefiok, M., Jelschen, J., and Winter, A. (2012). Removing energy code smells with reengineering services. GI-Jahrestagung, 208:441–455

Hao, S., Li, D., Halfond, W. G., and Govindan, R. (2013). Estimating mobile application energy consumption using program analysis. In Software Engineering (ICSE), 2013 35th International Conference on, pages92–101. IEEE.

Hecht, G., Rouvoy, R., Moha, N., and Duchien, L. (2015). Detecting antipatterns in Android apps. In Proceedings of the Second ACM International Conference on Mobile Software Engineering and Systems, pages 148–149. IEEE Press.

Li, D. and Halfond, W. G. (2014). An investigation into energy-saving programming practices for Android smartphone app development. In Proceedings of the 3rd International Workshop on Green and Sustainable Software, pages46–53. ACM.

Li, D. and Halfond, W. G. (2015). Optimizing energy of http requests in Android applications. In Proceedings of the 3rd International Workshop on Software Development Lifecycle for Mobile, pages 25–28. ACM

Li, D., Hao, S., Gui, J., and Halfond, W. G. (2014). An empirical study of the energy consumption of Android applications. In Software Maintenance and Evolution (ICSME), 2014 IEEE International Conference on, pages 121–130. IEEE.

Linares-Vásquez, M., Bavota, G., Bernal-Cárdenas, C., Oliveto, R., Di Penta, M., and Poshyvanyk, D. (2014). Mining energy-greedy api usage patterns in Android apps: an empirical study. In Proceedings of the 11th Working Conference on Mining Software Repositories, pages 2–11. ACM.

Linares-Vásquez, M., Bernal-Cárdenas, C., Bavota, G., Oliveto, R., Di Penta, M., and Poshyvanyk, D. (2017). Gemma: multi-objective optimization of energy consumption of guis in Android apps. In Proceedings of the 39th International Conference on Software Engineering Companion, pages 11–14. IEEEPress.

Malavolta, I., Procaccianti, G., Noorland, P., and Vukmirović,P.(2017). Assessing the impact of service workers on the energy efficiency of progressive web apps. In Proceedings of the 4th International Conference on Mobile Software Engineering and Systems, pages 35–45. IEEEPress.

Palomba, F., Di Nucci, D., Panichella, A., Zaidman, A., and De Lucia, A. (2017). Lightweight detection of android-specific code smells: The a doctor project. In 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), pages 487–491. IEEE.

Pang, C., Hindle, A., Adams, B., and Hassan, A. E. (2015). What do programmers know about the energy consumption of software? PeerJPrePrints, 3:e886v1.

Pathak, A., Hu, Y. C., and Zhang, M. (2012). Where is the energy spent inside my app?:fine grained energy accounting on smartphones with eprof. In Proceedings of the 7th ACM european conference on Computer Systems, pages 29–42.ACM


Pathak, A., Hu, Y. C., Zhang, M., Bahl, P., and Wang, Y.M.(2011). Fine-grained powermodeling for smartphones using system call tracing. In Proceedings of the sixth conference on Computer systems, pages 153–168.ACM.

Pereira,R., Carção,T., Couto,M., Cunha,J., Fernandes,J.P., and Saraiva,J. (2017). Helping programmers improve the energy efficiency of source code. In Proceedings of the 39th International Conference on Software Engineering Companion, pages238–240. IEEEPress

Reimann,J.and Aβmann,U. (2013). Quality-awarere factoring for early detection and resolution of energy deficiencies. In Proceedings of the 2013 IEEE/ACM 6th International Conference on Utility and Cloud Computing, pages 321–326. IEEE ComputerSociety.

Reimann, J., Brylski, M., and Aßmann, U. (2014). A tool-supported quality smell catalogue for Android developers. In Proc. of the conference Modellierung 2014 in the Workshop Modellbasierte und modellgetriebene Software modernisierung–MMSM, volume 2014

Sahin, C., Pollock, L., and Clause, J. (2014). How do code refactorings affect energy usage? In Proceedings of the 8th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, page36. ACM.

Sahin, C., Pollock, L., and Clause, J. (2016). From benchmarks to real apps: Exploring the energy impacts of performance-directed changes. Journal of Systems and Software, 117:307–31

Wilke, C., Richly, S., Gotz, S., Piechnick, C., and Aßmann, U. (2013). Energy consumption and efficiency in mobile applications:A user feedback study. In Green Computing and Communications (GreenCom), 2013 IEEE and Internet of Things (iThings/CPSCom), IEEE International Conference on and IEEECyber, Physical and Social Computing, pages 134–141. IEEE.

Zhang,L., Tiwana,B., Qian,Z., Wang,Z., Dick, R.P.,Mao, Z. M., and Yang, L. (2010). Accurate online power estimation and automatic battery behavior based powermodel generation for smartphones. In Proceedings of the eighth IEEE/ACM/IFIP international conference on Hardware/software codesign and system synthesis, pages 105–114. ACM.
Published
2019-08-17
How to Cite
CRUZ, Luis; ABREU, Rui. Improving Energy Efficiency Through Automatic Refactoring. Journal of Software Engineering Research and Development, [S.l.], v. 7, p. 2:1- 2:9, aug. 2019. ISSN 2195-1721. Available at: <https://sol.sbc.org.br/journals/index.php/jserd/article/view/17>. Date accessed: 17 nov. 2019. doi: https://doi.org/10.5753/jserd.2019.17.
Citation Formats
Section
Research Article