Abstract
Software energy consumption is a performance related non-functional requirement that complicates building software on mobile devices today. Energy hogging applications (apps) are a liability to both the end-user and software developer. Measuring software energy consumption is non-trivial, requiring both equipment and expertise, yet researchers have found that software energy consumption can be modelled. Prior works have hinted that with more energy measurement data we can make more accurate energy models. This data, however, was expensive to extract because it required energy measurement of running test cases (rare) or time consuming manually written tests. In this paper, we show that automatic random test generation with resource-utilization heuristics can be used successfully to build accurate software energy consumption models. Code coverage, although well-known as a heuristic for generating and selecting tests in traditional software testing, performs poorly at selecting energy hungry tests. We propose an accurate software energy model, GreenScaler, that is built on random tests with CPU-utilization as the test selection heuristic. GreenScaler not only accurately estimates energy consumption for randomly generated tests, but also for meaningful developer written tests. Also, the produced models are very accurate in detecting energy regressions between versions of the same app. This is directly helpful for the app developers who want to know if a change in the source code, for example, is harmful for the total energy consumption. We also show that developers can use GreenScaler to select the most energy efficient API when multiple APIs are available for solving the same problem. Researchers can also use our test generation methodology to further study how to build more accurate software energy models.
Similar content being viewed by others
References
Adamsen CQ, Mezzetti G, Møller møller A (2015) Systematic execution of android test suites in adverse conditions. In: Proceedings of the ISSTA 2015, ser. issta 2015, pp 83–93
Aggarwal K, Hindle A, Stroulia E (2015) Greenadvisor: A tool for analyzing the impact of software evolution on energy consumption, Bremen, pp 311–320
Aggarwal K, Zhang C, Campbell JC, Hindle A, Stroulia E (2014) The power of system call traces: Predicting the software energy consumption impact of changes. In: CASCON ’14
Ahmad RW, Gani A, Hamid SHA, Xia F, Shiraz M (2015) A review on mobile application energy profiling: taxonomy, state-of-the-art, and open research issues. J Netw Comput Appl 58:42–59
Alam F, Panda PR, Tripathi N, Sharma N, Narayan S (2014) Energy optimization in android applications through wakelock placement. In: 2014 design
Allix K, Bissyandé TF, Klein J, Le Traon Y (2016) Androzoo: collecting millions of android apps for the research community. In: Proceedings of the 13th international conference on mining software repositories, ser. MSR ’16, pp 468–471
Amalfitano D, Fasolino AR, Tramontana P, De Carmine S, Memon AM (2012) Using gui ripping for automated testing of android applications. In: Proceedings of the 27th IEEE / ACM International Conference on Automated Software Engineering, ser. ASE 2012, pp 258–261
Anand S, Burke EK, Chen TY, Clark J, Cohen MB, Grieskamp W, Harman M, Harrold MJ, Mcminn P (2013) An orchestrated survey of methodologies for automated software test cASE generation. J Syst Softw 86(8):1978–2001
Anand S, Godefroid P, Tillmann N (2008) Demand-driven compositional symbolic execution. In: International conference on tools and algorithms for the construction and analysis of systems. Springer, pp 367–381
Anand S, Naik V, Harrold MJ, Yang H (2012) Automated concolic testing of smartphone apps. In: Proceedings of the ACM sigsoft 20th international symposium on the foundations of software engineering, ser. FSE ’12, pp 59:1–59:11
Arzt S, Rasthofer S, Fritz C, Bodden E, Bartel A, Klein J, Le Traon Y, Octeau D, McDaniel P (2014) Flowdroid: Precise context, flow, field, object-sensitive and lifecycle-aware taint analysis for android apps. In: Proceedings of the 35th ACM SIGPLAN conference on programming language design and implementation, ser. PLDI’14. ACM, New York, pp 259–269. http://doi.ACM.org/10.1145/2594291.2594299
Azim T, Neamtiu I (2013) Targeted and depth-first exploration for systematic testing of android apps. In: Proceedings of the 2013 ACM sigplan international conference on object oriented programming systems languages & #38; applications, ser. OOPSLA’13, pp 641–660
Banerjee A. (2014) Detecting energy Bugs and hotspots in mobile Apps. In: FSE 2014, Hong Kong, pp 588–598
Bauer DF (1972) Constructing confidence sets using rank statistics. J Am Stat Assoc 67(339):687–690
Boonstoppel P, Cadar C, Engler D (2008) Rwset: attacking path explosion in constraint-based test generation. In: International conference on tools and algorithms for the construction and analysis of systems. Springer, pp 351–366
Carroll A, Heiser G (2010) An analysis of power consumption in a smartphone. In: Proceedings of the usenixatc’10
Choi W, Necula G, Sen K (2013) Guided gui testing of android apps with minimal restart and approximate learning. In: Proceedings of the 2013 ACM sigplan international conference on object oriented programming systems languages & #38; applications, ser. OOPSLA ’13, pp 623–640
Choudhary SR, Gorla A, Orso A (2015) Automated test input generation for android: are we there yet?. In: Proceedings of the 2015 30th IEEE/ACM international conference on automated software engineering (ASE), ser. ASE’15, Washington, pp 429–440
Chowdhury S, Luke K, Toukir J, Mohomed I, Varun S, Aggarwal K, Hindle A, Russell G (2015) A system-call based model of software energy consumption without hardware instrumentation. In: IGSC ’15, Las Vegas
Chowdhury S, Varun S, Hindle A (2016) Client-side energy efficiency of HTTP/2 for web and mobile App developers. In: SANER’16, Osaka
Chowdhury SA, Hindle A (2016a) Characterizing energy-aware software projects: are they different?. In: Proceedings of the 13th international conference on mining software repositories, ser. MSR’16, pp 508–511
Chowdhury SA, Hindle A (2016b) Greenoracle: estimating software energy consumption with energy measurement corpora. In: Proceedings of the 13th international conference on mining software repositories, ser. msr ’16, pp 49–60
Chowdhury S, Gil S, Romansky S, Hindle A (2017a) Greenscaler-tools-and-data, https://github.com/shaifulcse/GreenScaler-Tools-and-Data
Chowdhury SA, Nardo S, Hindle A, Jiang Z (2017b) An exploratory study on assessing the energy impact of logging on android applications. Accepted in Empirical Software Engineering Journal
Cliff N (2014) Ordinal methods for behavioral data analysis. Psychology Press, Hove
Dong M, Choi Y-SK, Zhong L (2009) Power modeling of graphical user interfaces on oled displays. In: Proceedings of the 46th annual design automation conference, ser. DAC ’09, pp 652–657
Dong M, Zhong L (2011) Self-constructive high-rate system energy modeling for battery-powered mobile systems. In: Proceedings of the Mobisys ’11
Emma (2006) Emma: a free java code coverage tool, http://emma.sourceforge.net/, (last accessed: 2016-jul-22)
Flinn J, Satyanarayanan M (1999) Powerscope: a tool for profiling the energy usage of mobile applications. In: WMCSA ’99, New Orleans
Gautam N, Petander H, Noel J (2013) A comparison of the cost and energy efficiency of prefetching and streaming of mobile video. In: Proceedings of the 5th workshop on mobile video, ser. MoVid’13, Oslo, pp 7–12
Goodfellow I, Bengio Y, Courville A (2016) Regularization for deep learning. MIT Press, Cambridge. http://www.deeplearningbook.org
Gopinath R, Jensen C, Groce A (2014) Code coverage for suite evaluation by developers. In: Proceedings of the 36th international conference on software engineering, ser. icse 2014, pp 72–82
Gui J, Li D, Wan M, Halfond WGJ (2016) Lightweight measurement and estimation of mobile ad energy consumption. In: Proceedings of the 5th international workshop on green and sustainable software, ser. GREENS ’16, pp 1–7
Gurumurthi S, Sivasubramaniam A, Irwin MJ, Vijaykrishnan N, Kandemir M, Li T, John LK (2002) Using complete machine simulation for software power estimation: the softwatt approach. In: Proceedings of the 8th international symposium on high-performance computer architecture, ser. HPCA ’02, pp 141–150
Hao S, Li D, Halfond WGJ, Govindan R (2013) Estimating mobile application energy consumption using program analysis. In: ICSE ’13, pp 92–101
Hao S, Liu B, Nath S, Halfond WG, Govindan R (2014) Puma: programmable ui-automation for large-scale dynamic analysis of mobile apps. In: Proceedings of the 12th annual international conference on mobile systems, applications and services, ser. MOBISYS ’14, pp 204–217
Harman M, Jia Y, Zhang Y (2015) Achievements open problems and challenges for search bASEd software testing. In: 2015 IEEE 8th international conference on softwaretesting verification and validation (icst), pp 1–12
Hasan S, King Z, Hafiz M, Sayagh M, Adams B, Hindle A (2016) Energy profiles of java collections classes. In: Proceedings of the 38th international conference on software engineering, ser. ICSE ’16, pp 225–236
Hastie T, Tibshirani R, Friedman J (2001a) Linear methods for regression. the elements of statistical learning: data mining. In: Conference and prediction. Springer Series in Statistics
Hastie T, Tibshirani R, Friedman J (2001b) Model assessment and selection. In: The elements of statistical learning: data mining, inference, and prediction. Springer Series in Statistics
Hern, Alex a (2015) Smartphone now most popular way to browse internet – ofcom report, https://www.theguardian.com/technology/2015/aug/06/smartphones-most-popular-way-to-browse-internet-ofcom/ (last accessed: -jul-29)
Hindle A (2012) Green mining: investigating power consumption across versions. In: ICSE ’12, pp 1301–1304
Hindle A, Wilson A, Rasmussen K, Barlow EJ, Campbell JC, Romansky S (2014) GreenMiner: a hardware based mining software repositories software energy consumption framework. In: MSR 2014, Hyderabad, pp 12–21
Hollander M, Wolfe DA, Chicken E (2013) Nonparametric statistical methods. Wiley, New York
Inozemtseva L, Holmes R (2014) Coverage is not strongly correlated with test suite effectiveness. In: Proceedings of the 36th international conference on software engineering, ser. ICSE 2014, pp 435– 445
Jabbarvand R, Sadeghi A, Bagheri H, Malek S (2016) Energy-aware test-suite minimization for android apps. In: Proceedings of the 25th international symposium on software testing and analysis, ser. issta 2016, pp 425–436
Jiffy (2016) Linux man page, http://man7.org/linux/man-pages/man7/time.7.html, (last accessed: 2016-jan-10)
Jones B (2016) Microsoft has found the source of recent surface pro 3 battery woes, http://www.digitaltrends.com/computing/microsoft-surface-pro-3-battery-getting-patch/, (last accessed: 2016-jul-30)
Karagiannopoulos M, Anyfantis D, Kotsiantis SB, Pintelas PE (2015) Feature selection for regression problems, http://www.math.upatras.gr/~dany/Downloads/hercma07.pdf, (last accessed: 2015-Oct-22)
Kochhar PS, Xia X, Lo D, Li S (2016) Practitioners’ expectations on automated fault localization. In: Proceedings of the 25th international symposium on software testing and analysis, ser. ISSTA 2016, pp 165–176
Li D, Hao S, Gui J, Halfond WGJ (2014a) An empirical study of the energy consumption of android applications. In: Proceedings of the 2014 IEEE ICSME. Victoria, pp 121–130
Li D, Tran AH, Halfond WGJ (2014b) Making web applications more energy efficient for OLED smartphones. In: ICSE 2014. Hyderabad, pp 527–538
Li D, Halfond WGJ (2015) Optimizing energy of http requests in android applications. In: Proceedings of the 3rd international workshop on software development lifecycle for mobile, ser. DEMOBILE 2015, pp 25–28
Li D, Lyu Y, Gui J, Halfond WGJ (2016) Automated energy optimization of http requests for mobile applications. In: Proceedings of the 38th international conference on software engineering, ser. ICSE ’16, pp 249–260
Lin YD, Rojas JF, Chu ETH, Lai YC (2014) On the accuracy, efficiency, and reusability of automated test oracles for android devices. IEEE Trans Softw Eng 40(10):957–970
Linares-Vásquez M, Bavota G, Bernal-Cárdenas C, Oliveto R, Di Penta M, 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, ser. MSR 2014, pp 2–11
Linares-Vásquez M, Bavota G, Cárdenas CEB, Oliveto R, Di Penta M, Poshyvanyk D (2015) Optimizing energy consumption of guis in android apps: a multi-objective approach. In: Proceedings of the 2015 10th joint meeting on foundations of software engineering, ser. ESEC/FSE 2015, pp 143– 154
Linares-Vásquez M, White M, Bernal-Cárdenas C, Moran K, Poshyvanyk D (2015) Mining android app usages for generating actionable gui-bASEd execution scenarios. In: Proceedings of the 12th working conference on mining software repositories, ser. MSR ’15, pp 111–122
Liu Y, Xu C, Cheung S, Terragni V (2016) Understanding and detecting wake lock misuses for android applications. In: FSE 2014, Seattle
Machiry A, Tahiliani R, Naik M (2013) Dynodroid: an input generation system for android apps. In: Proceedings of the 2013 9th joint meeting on foundations of software engineering, ser. ESEC/FSE 2013, pp 224–234
Mahmood R, Mirzaei N, Malek S (2014) Evodroid: segmented evolutionary testing of android apps. In: Proceedings of the 22nd ACM sigsoft international symposium on foundations of software engineering, ser. FSE 2014, pp 599–609
Malik H, Zhao P, Godfrey M (2015) Going green: an exploratory analysis of energy-related questions. In: Proceedings of the 12th Working Conference on Mining Software Repositories, ser. MSR ’15, pp 418–421
man-pages project Linux (2016) Intro Linux man page, http://linux.die.net/man/2/intro
Manotas I, Bird C, Zhang R, Shepherd D, Jaspan C, Sadowski C, Pollock L, Clause J (2016) An empirical study of practitioners’ perspectives on green software engineering. In: Proceedings of the 38th international conference on software engineering, ser. ICSE ’16, pp 237–248
Manotas I, Pollock L, Clause J (2014) Seeds: a software engineer’s energy-optimization decision support framework. In: Proceedings of the 36th international conference on software engineering, ser. ICSE 2014, pp 503–514
Mao K, Harman M, Jia Y (2016) Sapienz: multi-objective automated testing for android applications. In: Proceedings of the 25th international symposium on software testing and analysis, ser. ISSTA 2016. ACM, New York, pp 94–105. [Online]. Available: http://doi.ACM.org/10.1145/2931037.2931054
Miettinen AP, Nurminen JK (2010) Energy efficiency of mobile clients in cloud computing. In: Proceedings of the 2nd USENIX conference on hot topics in cloud computing, ser. HotCloud’10, Boston
Mileva YM, Dallmeier V, Zeller A (2010) Mining api popularity. testing – practice and research techniques, pp 173–180
Miranskyy A, Al-zanbouri Z, Godwin D, Bener B (2018) DatabASE engines: evolution of greenness. J Softw Evol Process 30(4):1–25
Mirzaei N, Garcia J, Bagheri H, Sadeghi A, Malek S (2016) Reducing combinatorics in gui testing of android applications. In: Proceedings of the 38th international conference on software engineering, ser. ICSE ’ 16, pp 559–570
Monkey (2018) Ui/application exerciser monkey, https://developer.android.com/studio/test/monkey.html, (last accessed: 2016-may-11)
Moran K, Linares-Vásquez M, Bernal-Cárdenas C, Vendome C, Poshyvanyk D (2016) Automatically discovering, reporting and reproducing android application crashes. In: 2016 IEEE international conference on software testing, verification and validation (icst), pp 33–44
Namin AS, Andrews JH (2009) The influence of size and coverage on test suite effectiveness. In: Proceedings of the issta ’09, pp 57–68
Nucci DD, Palomba F, Prota A, Panichella A, Zaidman A, Lucia AD (2017) Software-based energy profiling of android apps: simple, efficient and reliable?. In: 2017 IEEE 24th international conference on software analysis, evolution and reengineering (SANER), pp 103–114
Othman M, Hailes S (1998) Power conservation strategy for mobile computers using load sharing. SIGMOBILE Mob Comput Commun Rev 2(1):44–51
Pang C, Hindle A, Adams B, Hassan AE (2015) What do programmers know about the energy consumption of software? IEEE software, pp 83–89. http://softwareprocess.ca/pubs/pang2015IEEESoftware.pdf
Pathak A, Hu YC, Zhang M (2011) Bootstrapping energy debugging on smartphones: a first look at energy bugs in mobile devices. In: Proceedings of the 10th ACM workshop on hot topics in networks, ser. HOTNETS-X, pp 5:1–5:6
Pathak A, Hu YC, Zhang M (2012) Where is the energy spent inside my App?: fine grained energy accounting on smartphones with eprof. In: EuroSys ’12, Bern, Switzerland, pp 29–42
Pathak A, Hu YC, Zhang M, Bahl P, Wang YM (2011) Fine-grained power modeling for smartphones using system call tracing, eurosys’11, Salzburg, pp 153–168
Patil PS, Doshi J, Ambawade D (2015) Reducing power consumption of smart device by proper management of wakelocks. In: 2015 IEEE international on advance computing conference (IACC), pp 883–887
Pereira R, Couto M, Saraiva Ja, Cunha J, Fernandes JaP (2016) The influence of the java collection framework on overall energy consumption. In: Proceedings of the 5th international workshop on green and sustainable software, ser. GREENS ’16, pp 15–21
Pinto G, Castor F, Liu YD (2016) Mining questions about software energy consumption. In: MSR 2014, pp 22–31
Pradel M, Huggler M, Gross TR (2014) Performance regression testing of concurrent classes. In: Proceedings of the 2014 international symposium on software testing and analysis, ser. ISSTA 2014, pp 13–25
Rasmussen K, Wilson A, Hindle A (2014) Green mining: energy consumption of advertisement blocking methods. In: GREENS 2014, Hyderabad, pp 38–45
Romansky S, Chowdhury SA, Hindle A, Borle N, Greiner R (2017) Deep green: modelling time-series of software energy consumption. In: 33rd IEEE international conference on software maintenance and evolution (ICSME) (accepted)
Saborido R, Beltrame G, Khomh F, Alba E, Antoniol G (2016) Optimizing user experience in choosing android applications. In: 2016 IEEE 23rd international conference on software analysis evolution, and reengineering (SANER), vol 1, pp 438–448
Sahin C, Pollock L, 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 (ESEM)
Sahin C, Tornquist P, McKenna R, Pearson Z, Clause J (2014) How does code obfuscation impact energy usage?. In: Proceedings of the 30th IEEE international conference on software maintenance and evolution (ICSME)
Sasnauskas R, Regehr J (2014) Intent fuzzer: crafting intents of death. In: Proceedings of the 2014 joint international workshop on dynamic analysis (WODA) and software and system performance testing, debugging, and analytics (PERTEA), ser. woda+pertea 2014, pp 1–5
Seo C, Malek S, Medvidovic N (2008) Component-level energy consumption estimation for distributed java-based software systems. In: Lecture notes in computer science, ser. Lecture notes in computer science. Springer Berlin Heidelberg, vol 5282, pp 97–113
Shamshiri S, Just R, Rojas JM, FrASEr G, McMinn P, Arcuri A (2015) Do automatically generated unit tests find real faults? An empirical study of effectiveness and challenges. In: 2015 30th IEEE/ACM international conference on automated software engineering (ASE), pp 201–211
Shepperd M, Cartwright M, Kadoda G (2000) On building prediction systems for software engineers. Empir Softw Eng 5(3):175–182
Shye A, Scholbrock B, Memik G (2009) Into the wild: studying real user activity patterns to guide power optimizations for mobile architectures. In: IEEE/ACM MICRO 42, New York, pp 168–178
Song W, Qian X, Huang J (2017) Ehbdroid: beyond gui testing for android applications. In: ASE 2017, pp 27–37
StackOverflow (2009) Why are synchronize expensive in java? http://stackoverflow.com/questions/1671089/why-are-synchronize-expensive-in-java, (last accessed: 2016-jul-22)
Thode HC (2002) Testing for normality, vol 164. CRC Press, Boca Raton
Uddin G, Khomh F (2017) Automatic summarization of api reviews. ASE 2017, pp 159–170
van der Merwe H, van der Merwe B, Visser W (2012) Verifying android applications using java pathfinder. SIGSOFT Softw Eng Notes 37(6):1–5
Vapnik V (2000) The nature of statistical learning theory. Springer, Berlin
Wang XS, Balasubramanian A, Krishnamurthy A, Wetherall D (2014) How speedy is SPDY?. In: Proceedings of the 11th USENIX conference on networked systems design and implementation, ser. NSDI’14, Seattle, pp 387–399
Wei C, Chung Chang C, jen Lin C (2010) A practical guide to support vector classification
Woollaston V (2014) Customers really want better battery life, http://www.dailymail.co.uk/sciencetech/article-2715860/,uSwitch.com,(last accessed: 2015-apr-22)
Yandrapally R, Thummalapenta S, Sinha S, Chandra S (2014) Robust test automation using contextual clues. In: Proceedings of the 2014 international symposium on software testing and analysis, ser. ISSTA 2014, pp 304–314
Yang W, Prasad MR, Xie T (2013) A grey-box approach for automated gui-model generation of mobile applications. In: Proceedings of the 16th International Conference on fundamental approaches to Software Engineering, ser. fASE’13, pp 250–265
Ye H, Cheng S, Zhang L, Jiang F (2013) Droidfuzzer: fuzzing the android apps with intent-filter tag. In: Proceedings of international conference on advances in mobile computing & multimedia, ser. MOMM ’13, pp 68:68–68:74
Zerø-Drift INA219 (2015) Bidirectional current/power monitor with i2c interface. Texas Instruments, Dallas. http://www.ti.com/lit/ds/symlink/ina219.pdf
Zhang C (2013) The impact of user choice on energy consumption MSc. Thesis University of Alberta
Zhang C, Hindle A (2014) A green miner’s datASEt: mining the impact of software change on energy consumption. In: Proceedings of the 11th working conference on mining software repositories, pp 400–403
Zhang L, Tiwana B, Qian Z, Wang Z, Dick RP, Mao ZM, Yang L (2010) Accurate online power estimation and automatic battery behavior bASEd power model generation for smartphones. In: Proceedings of the 8th IEEE/ACM/IFIP international conference on hardware/software codesign and system synthesis
Acknowledgments
Shaiful Chowdhury is grateful to the Alberta Innovates - Technology Futures (AITF) to support his PhD research. Abram Hindle is supported by an NSERC Discovery Grant. Stephanie Borle was supported by an NSERC Undergraduate Student Research Award.
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by: Maurizio Morisio
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Chowdhury, S., Borle, S., Romansky, S. et al. GreenScaler: training software energy models with automatic test generation. Empir Software Eng 24, 1649–1692 (2019). https://doi.org/10.1007/s10664-018-9640-7
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10664-018-9640-7