Green Software Lab

New Paper in JSS

SPELLing Out Energy Leaks: Aiding Developers Locate Energy Inefficient Code  – Rui Pereira, Tiago Carção, Marco Couto, Jácome Cunha, João Paulo Fernandes and João Saraiva

Although hardware is generally seen as the main culprit for a computer’s energy usage, software too has a tremendous impact on the energy spent. Unfortunately, there is still not enough support for software developers so they can make their code more energy-aware.

This paper proposes a technique to detect energy inefficient fragments in the source code of a software system. Test cases are executed to obtain energy consumption measurements, and a statistical method, based on spectrum-based fault localization, is introduced to relate energy consumption to the source code. The result of our technique is an energy ranking of source code fragments pointing developers to possible energy leaks in their code. This technique was implemented in the SPELL toolkit.

Finally, in order to evaluate our technique, we conducted an empirical study where we asked participants to optimize the energy efficiency of a software system using our tool, while also having two other groups using no tool assistance and a profiler, respectively. We showed statistical evidence that developers using our technique were able to improve the energy efficiency by 43\% on average, and even out performing a profiler for energy optimization

New Paper in EMSE

Catalog of energy patterns for mobile applications – Luis Cruz and Rui Abreu

Software engineers make use of design patterns for reasons that range from performance to code comprehensibility. Several design patterns capturing the body of knowledge of best practices have been proposed in the past, namely creational, structural and behavioral patterns. However, with the advent of mobile devices, it becomes a necessity a catalog of design patterns for energy efficiency. In this work, we inspect commits, issues and pull requests of 1027 Android and 756 iOS apps to identify common practices when improving energy efficiency. This analysis yielded a catalog, available online, with 22 design patterns related to improving the energy efficiency of mobile apps. We argue that this catalog might be of relevance to other domains such as Cyber-Physical Systems and Internet of Things. As a side contribution, an analysis of the differences between Android and iOS devices shows that the Android community is more energy-aware.

New Paper in EMSE

To the Attention of Mobile Software Developers: Guess What, Test your App! – Luis Cruz, Rui Abreu, and David Lo

Software testing is an important phase in the software development lifecycle because it helps in identifying bugs in a software system before it is shipped into the hand of its end users. There are numerous studies on how developers test general-purpose software applications. The idiosyncrasies of mobile software applications, however, set mobile apps apart from general-purpose systems (e.g., desktop, stand-alone applications, web services). This paper investigates working habits and challenges of mobile software developers with respect to testing. A key finding of our exhaustive study, using 1000 Android apps, demonstrates that mobile apps are still tested in a very ad hoc way, if tested at all. However, we show that, as in other types of software, testing increases the quality of apps (demonstrated in user ratings and number of code issues). Furthermore, we find evidence that tests are essential when it comes to engaging the community to contribute to mobile open source software. We discuss reasons and potential directions to address our findings. Yet another relevant finding of our study is that Continuous Integration and Continuous Deployment (CI/CD) pipelines are rare in the mobile apps world (only 26% of the apps are developed in projects employing CI/CD) – we argue that one of the main reasons is due to the lack of exhaustive and automatic testing.

New Paper @ ICSE-NIER’19

EMaaS: Energy Measurements as a Service for Mobile Applications -Luis Cruz and Rui Abreu

Measuring energy consumption is a challenging task faced by developers when building mobile apps. This paper presents EMaaS: a system that provides reliable energy measurements for mobile applications, without requiring a complex setup. It combines estimations from an energy model with – typically more reliable, but also expensive – hardware-based measurements. On a per scenario basis, it decides whether the energy model is able to provide a reliable estimation of energy consumption. Otherwise, hardware-based measurements are provided. In addition, the system is accessible to the community of mobile software practitioners/researchers in the form of a Software as a Service. With this service, we aim at solving current problems in the field of energy efficiency in mobile software engineering: the complexity of hardware-based power monitor tools, the reliability of energy models, and the continuous need of data to build energy models.

Energyware Engineering: Techniques and Tools for Green Software Development – Rui Pereira’s PhD

Rui Alexandre Afonso Pereira concluded his PhD on October, 29th 2018, at Informatics Department (DI) of the  University of Minho (DI-UMinho), with a thesis entitled “Energyware Engineering: Techniques and Tools for Green Software Development“. He was advised by Professors João Saraiva and Jácome Cunha (DI/UMinho) and his research was also hosted by the research center HASLab/INESCTEC.

Abstract – Energy consumption is nowadays one of the most important concerns worldwide. While hardware is generally seen as the main culprit for a computer’s energy usage, software too has a tremendous impact on the energy spent, as it can cancel the efficiency introdued by the hardware. Green Computing is not a new field of study, but the focus has been,
until recently, on hardware. While there has been advancements in Green Software techniques, there is still not enough support for software developers so they can make their code more energy-aware, with various studies arguing there is both a lack of knowledge and lack of tools for energy-aware development.
This thesis intends to tackle these two problems and aims at further pushing forward research on Green Software. This software energy consumption issue is faced as a software engineering question. By using systematic, disciplined, and quantifiable approaches to the development, operation, and maintenance of software we defined several techniques, methodologies, and tools within this document. These focus on providing software developers more knowledge and tools to help with energy-aware software development, or Energyware Engineering.
Insights are provided on the energy influence of several stages performed during a software’s development process. We look at the energy efficiency of various popular programming languages, understanding which are the most appropriate if a developer’s concern is energy consumption. A detailed study on the energy profiles of different Java data structures is also presented, along with a technique and tool, further providing more knowledge on what energy efficient alternatives a developer has to choose from. To help developers with the lack of tools, we defined and implemented a technique to detect energy inefficient fragments within the source code of a software system. This technique and tool has been shown to help developers improve the energy efficiency of their programs, and even outperforming a runtime profiler.

Finally, answers are provided to common questions and misconceptions within this field of research, such as the relationship between time and energy, and how one can improve their software’s energy consumption. This thesis provides a great effort to help support both research and education on this topic, helps continue to grow green software out of its infancy, and contributes to solving the lack of knowledge and tools which exist for Energyware Engineering.




New Paper Accepted @ ASE’18

jStanley: Placing a Green Thumb on Java Collections – Rui Pereira, Pedro Simão, Jácome Cunha, João Saraiva

Software developers are more and more eager to understand their code’s energy performance. However, even with such knowledge it is difficult to know how to improve the code. Indeed, little tool support exists to understand the energy consumption profile of a software system and to eventually (automatically) improve its code.

In this paper we present a tool termed jStanley which automatically finds collections in Java programs that can be replaced by others with a positive impact on the energy consumption as well as on the execution time. In seconds, developers obtain information about energy-eager collection usage. jStanley will further suggest alternative collections to improve the code, making it use less time, energy, or a combination of both. The preliminary evaluation we ran using jStanley shows energy gains between 2% and 17%, and a reduction in execution time between 2% and 13%.

GSL members win Best Paper Award @ CIbSE’18

The article “Using Automatic Refactoring to Improve Energy Efficiency of Android Apps“, authored by Luis Cruz and Rui Abreu, was awarded the Best Paper Award at CIbSE’18.

The ever-growing popularity of mobile phones has brought additional challenges to the software development lifecycle. Mobile applications (apps, for short) 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 study whether or not automatic refactoring can aid developers ship energy efficient apps. We leverage a tool, Leafactor, with five energy code smells that tend to go unnoticed. We use Leafactor to analyze code smells in 140 free and open source apps. As a result, we detected and fixed code smells in 45 apps, from which 40% have successfully merged our changes into the official repository.

New Paper Accepted @ GREENS’18

Helping developers write energy efficient Haskell through a data-structure evaluation – Gilberto Melfe, Alcides Fonseca, João Paulo Fernandes

How a program is written has implications in the energy consumption of the running system, with economical and environmental consequences.

In this context, understanding the energy consumption of operations on data-structures is crucial when optimizing software to execute under power constricted environments. Existing studies have not focused on the different components of energy consumption that processors expose, rather considering the global consumption.

To understand the relationship between CPU and memory energy consumptions with execution time, we instrument a microbenchmark suite to collect such values, and we analyze the results.

Our benchmark suite is comprised of 16 implementations of functional sequences, collections and associative collections while measuring detailed energy and time metrics. We further investigate the energy consumption impact of using different compilation optimizations.

We have concluded that energy consumption is directly proportional to execution time. Additionally, DRAM and Package energy consumptions are directly proportional, with the DRAM representing between 15 and 31% of the total energy consumption. Finally, we also conclude that optimizations can have both a positive or a negative impact on energy consumption.



GSL members win Best Paper Award @ SBLP’17

The article “Towards a Green Ranking for Programming Languages”, authored by HASLab/INESC TEC & UMinho researchers Marco Couto, Rui Pereira, Francisco Ribeiro, Rui Rua and João Saraiva, was awarded the Best Paper Award at SBLP 2017.

In this work, the researchers analysed and compared the energy efficiency of various programming languages. More specifically, this award-winning research used a set of benchmarking programs and problems in 10 different programming languages in order to compare the energy efficiency of each. In a second phase, the execution time data of the programs was collected, in order to try to understand the relation between energy consumption and execution time.

Finally, while the obtained results showed that the C language is, unsurprisingly, the most efficient language in terms of both energy consumption and performance, the study also showed languages which are slower than others yet consume less energy. It should be noted that execution time and energy consumption vary in different and not directly related ways, since some languages are more efficient in some cases and less in others. Therefore, this study will allow not only the optimisation of energy consumption, but also the optimisation of the execution time of each program.

The 21st Brazilian Symposium on Programming Languages (SBLP 2017) took place on the 21st and 22nd of September, in Fortaleza, Brazil, and is one of the conferences that compose the Brazilian Conference on Software (CBSOFT).

New Paper Accepted @ SLE’17

Energy Efficiency across Programming Languages: How does energy, time, and memory relate? – Rui Pereira, Marco Couto, Francisco Ribeiro, Rui Rua, Jácome Cunha, João Paulo Fernandes, João Saraiva

This paper presents a study of the runtime, memory usage and energy consumption of twenty seven well-known software languages. We monitor the performance of such languages using ten different programming problems, expressed in each of the languages. Our results show interesting findings, such as, slower/faster languages consuming less/more energy, and how memory usage influences energy consumption. We show how to use our results to provide software engineers support to decide which language to use when
energy efficiency is a concern.