УДК 004

Defining the correct metrics for energy consumption by software applications

Сарсенов Ерлан Нурланулы – магистрант Казахстанско-Британского технического университета, г. Алматы, Казахстан.

Abstract: The article examines the issues of low power consumption in high-performance computer systems, with a particular focus on portable devices. An analysis of methods for reducing energy consumption is conducted at both hardware and software levels. The research results in the development of effective techniques and precise metrics for measuring application energy consumption.

Keywords: energy consumption, programming, random access memory, central processing unit, Android OS, embedded software.

1. Problem statement

The low power consumption of high-performance computer systems has become a major research challenge both at the application level in industry and in the laboratory. Especially energy consumption is critical for portable devices, as it determines their battery life, their weight, the maximum possible degree of integration, as well as issues of their cooling and reliability [1]. Often software engineers have a limited supply of power for their applications to use, and this is a major challenge as there is a trade-off between performance and limited charge. Increasing performance, such as increasing clock speed, usually results in higher power consumption. The development of low power devices depends on both hardware and software running on embedded processor cores. Therefore, in order to reduce the consumption of electricity by the system, techniques are being developed both in the field of hardware and software. Hence, there certainly must be correct metrics for measuring energy consumption by software applications.

2. Literature review

The general goal of most research is to reduce the dynamic power dissipation that occurs due to the charging and discharging of circuit capacitance. Hardware techniques minimize power consumption by optimizing target parameters such as supply voltage, number of logic gates, transistor size, operating frequency. On the other hand, methodologies from the field of software development usually affect higher levels of the system design hierarchy, and as a result, the results of energy savings after software optimization are more significant [2].

A large number of metrics for the internal parameters of software products, such as program size, complexity, functionality, structure, modularity, were once developed and actively applied and applied to software products. The energy consumption of a program depends on its dynamic behavior, and on the hardware platform on which the program is running, so it is necessary to extend the existing graph diagram programming model to unambiguously determine the parameters of the software execution time [3]. Since the main sources of energy consumption in computer systems are processor operations and memory access operations, it is necessary to develop measures for the dynamic characteristics of these operations.

Research aimed for creating energy-efficient software began with the development of energy models at the instruction set level, which estimated the power consumption of the processor. These models can be applied to the program under study both after its execution in order to obtain a trace of executed instructions, or by applying static analysis methods at the source code level to estimate the number of instructions being executed [4]. Based on measurements that showed that transition from one instruction to another costs different energy for different pairs of instructions [4], several techniques were proposed to optimize energy consumption, which used scheduling algorithms (determining the sequence of execution of instructions, or programs) to minimize energy consumption. To assess the complex impact of software and hardware optimization on energy efficiency, instruction level models with high cycle accuracy were used (processor operation was simulated up to each of its operation cycles).

Other literature regarding energy efficient software design describes methodologies related to the power consumption of RAM. They propose the transformation of the program code in such a way as to organize work with smaller areas of memory and with less energy consumption for each memory access operation [5].

Given the above, there is a need for metrics to assess the energy efficiency of the designed and analyzed software. With the help of such metrics, it is possible to identify the most efficient implementation among several programs that consumes less power during operation. This will allow us to create indicators that could help improve the quality of the software, and understand the necessary balance of hardware and software when designing the system as a whole. Energy metrics should be simple and computable, intuitive, consistent, and, as far as possible, independent from the programming language.

3. What Is Missing In Other Researches?

However, despite all previous work, the energy consumption of a particular program has always been estimated using a specific target architecture. However, no attempt has been made to define energy metrics that could be used to compare software design, regardless of the underlying hardware. More- over, the issues of designing energy-efficient software were not considered in relation to the energy consumption as a result of the combined operation of the processor and RAM. There have also been no studies of the effect of various variants of the program code on energy consumption.

It should be noted that existing methods use instruction tracing of the programs under study, and the amount of time required for a given process for large applications becomes prohibitively long. Transferring calculations for the optimal ra tio of power consumption and performance to higher levels of abstraction becomes inevitable, especially when large amounts of software design work must be completed in a short period of time. Therefore in this work the main platforms of research become devices on Android OS.

4. My Plan And Expected Result

The purpose of this work is to highlight the thesis about the influence of software on the energy consumption of the underlying hardware, as well as to consider energy consumption as one of the design parameters in software engineering. According to the goal, the paper explores energy efficiency measures that can be used to assess the energy consumption of the program, as well as the definition of program energy metrics. The effectiveness of the proposed metrics will be demonstrated on various implementations of the algorithms, which will be experimentally evaluated in terms of performance and energy consumption using a processor simulator using the proposed parameters.

5. Methodology

During program execution on a processor, energy consumption arises from two primary sources, with variations dependent on the specific architecture and software employed. So, the main receivers of the battery’s energy are the CPU and the RAM.

The power usage of a processor is attributed to the operation of its electrical circuits when executing program instructions. The decoding and execution of instructions involve switching actions in the digital processor circuit nodes, which involve charging and discharging the capacitances of these nodes. As a result, there is dynamic energy dissipation. To evaluate this energy consumption aspect, models for instruction-level energy consumption have been developed. These models are based on the premise that by measuring the current flow of a processor while it executes a specific set of instructions, one can gather most of the necessary information to estimate the power consumption of a program running on that processor [6]. Over time, this assumption has been supplemented and refined. The calculation of total energy consumption cannot be achieved by simply adding up the energy consumed for each individual processor instruction. Extensive research has demonstrated the necessity of considering circuit state changes occurring between consecutive instructions in order to develop precise models for instruction-level power consumption. The instruction level energy consumption model comprises two primary constituents: basic energy costs and overhead energy costs. Base energy costs refer to the expenses incurred in performing fundamental processing tasks necessary for executing out an instruction [7]. This consumption is approximated as the mean current expenditure during the execution of a single cycle in the processing of multiple occurrences of the identical instruction. Energy overhead arises from the switching operations within the processor circuitry as well as the secondary energy expenses incurred by the execution of neighboring instructions, which involve recalculating cycle indices and determining memory addresses. In this particular scenario, specific instruction sequences are employed to gauge the average current value [8]. Hence, the aggregate power utilization of a program operating on a processor can be derived by combining the cumulative expenses of both fundamental power usage and supplementary power overhead throughout the program’s execution.

Memory energy expenditures arise from accessing instructions or data, with power usage per access operation contingent on memory size. Consequently, the power consumption for expansive off-chip memory modules exceeds that of compact on-chip memory. This energy component is additionally influenced by the executed software. The energy consumption of the memory employed for storing instructions is influenced by two main factors: the size of the program code, which determines the memory usage, and the number of executed instructions, which determines the frequency of memory fetches. On the other hand, the energy consumption of the memory used for storing data is contingent upon the volume of data processed by the application and the level of interaction with the data, specifically the frequency of data access [7]. As outlined in a typical energy consumption model, memory access operations account for energy consumption and are directly proportional to the number of access operations, the size and quantity of memory I/O ports, supply voltage, and the manufacturing technology employed. Based on this, the power consumption is influenced by the number of instructions executed in two ways: first, through the execution of instructions by the processor, and second, through the retrieval of instructions from memory. In contrast, the impact of memory access operations on power consumption is considered as a single factor [9]. However, the expense of electricity associated with data manipulation in memory surpasses the cost of accessing instructions or the energy expended on executing instructions by the processor. The energy characteristics of these supplementary components will be considered in greater detail when establishing the energy metrics of software.

Рисунок3

Figure1. Experimental design for assessing energy consumption

Energy measures are developed by leveraging the program flow graph, a directed graph that captures the instruction flow of a program. This graph is crucial for determining the valid S-structured graphs to which any program flow graph belongs [10]. In order to assess the energy usage of software design features, we establish the subsequent two hierarchical metrics by attributing values to individual components within the fundamental S-graphs, as well as values to the nesting and ordering functions.

To demonstrate the efficacy of the suggested approaches in characterizing hardware behavior, the execution of each program was simulated using an ARM emulator. It is worth noting that the count of memory access operations is error- free, whereas the count of executed machine instructions incorporates an average error resulting from certain assumptions

made during the compilation of C program code into machine instructions.

The executed instruction count (EIC) is a quantitative metric that reflects the quantity of instructions carried out by the processor core. It is directly linked to the power consumption of the processor and is determined through the application of instruction-level power

consumption models. Likewise, the EIC is also utilized to assess the power consumption of the processor’s instruction memory, as each executed instruction necessitates an instruction fetch operation from the memory.

The memory access count (MAC) is a metric that quantifies the frequency of memory access operations. Specifically, it represents the number of times data memory access operations are performed during program operand retrieval operations.

In this work, the utilization of graph diagrams is expanded to include the assessment of non-static attributes. The inefficiency of graph diagrams in representing dynamic parameters stems mainly from the existence of repetitive and conditional structures where the behavior of the program at runtime cannot be predicted, except in certain cases. For repetitive structures, each loop is annotated with comments indicating the precise number of iterations or an estimated value provided by the developer [11]. While imprecise loop iteration counts may result in significant absolute errors, particularly when multiple nested loops are involved, comparing various implementations of the same algorithm and determining the most efficient one reveals that these counts maintain a reasonably high level of accuracy, as demonstrated subsequently. In situations involving selection structures, the focus is on the most energetically demanding branch, and the program’s energy usage is evaluated based on the highest possible threshold.

Conclusion

The efficient use of power in embedded software poses a significant hurdle in the development of portable devices. While hardware design choices have an impact on power consumption in digital systems, the software executed on embedded processor cores largely governs the switching activity in processor circuitry, which is the primary contributor to power consumption. This scholarly article emphasizes the necessity of defining suitable energy metrics for assessing the software under development and its influence on the power consumption of the underlying hardware. Hierarchical energy measures extracted from the program diagram are employed to ascertain the count of executed instructions (commands) and data memory access operations. These measures serve as the basis for determining software energy efficiency metrics, which evaluate the power consumption of the processor as well as data and instruction memory access operations. The metrics are then applied to applications that implement matrix algebra algorithms. The stability and accuracy of these metrics are demonstrated, highlighting the significance of considering energy factors during the software design phase. Future endeavors in this area will focus on establishing more comprehensive and advanced metrics to assist developers in creating power-efficient software.

References

  1. Pereira,H.Matalonga,M.Couto,F.Castor,B.Cabral,P.Carvalho, S. M. de Sousa, and J. P. Fernandes, “Greenhub: a large-scale collaborative dataset to battery consumption analysis of android devices,” Empirical Software Engineering, vol. 26, 5 2021.
  2. WangandJ.Yan,“Integratinghardware,softwareandmindwareforsustainableecosystemdevelopment:Principlesandmethodsofecologicalengineeringinchina1,”pp.277–289,1998.
  3. C.Venters,R.Capilla,S.Betz,B.Penzenstadler,T.Crick,S.Crouch, E. Y. Nakagawa, C. Becker, and C. Carrillo, “Software sustainability: Research and practice from a software architecture viewpoint,” pp. 174– 188, 4 2018.
  4. Tiwari,S.Malik,andA.Wolfe,“Poweranalysisofembeddedsoftware:Afirststeptowardssoftwarepowerminimization,”1994.
  5. Dasigenis,N.Kroupis,A.Argyriou,K.Tatas,D.Soudris, A. Thanailakis, and N. Zervas, “A memory management approach for efficient implementation of multimedia kernels on programmable architectures*.”
  6. Duboc, B. Penzenstadler, J. Porras, S. A. Kocak, S. Betz, R. Chitchyan, O. Leifler, N. Seyff, and C. C. Venters, “Requirements engineering for sustainability: an awareness framework for designing software systems for a better tomorrow,” Requirements Engineering, vol. 25, pp. 469–492, 12 2020.
  7. Albertao, J. Xiao, C. Tian, Y. Lu, K. Q. Zhang, and C. Liu, “Measuringthe sustainability performance ofsoftware projects,” 2010, pp.369–373.
  8. Ullah, F. Al-Turjman, and A. Nayyar, “Iot-based green city architecture using secured and sustainable android services,” Environmental Technology and Innovation, vol. 20, 11 2020.
  9. T. Hai, P. H. Hai, C. L. Thai, J. Huge´, A. Ahenkan, L. X. Quynh, V. van Hieu, N. L. T. Tung, and L. Hens, “Software for sustainability assessment: A case study in quang tri province, vietnam,” Environmental Modeling and Assessment, vol. 16, pp. 541–550, 2011.
  10. McIntosh,S.Hassan,andA.Hindle,“Whatcanandroidmobileapp developers do about the energy consumption of machine learning?”Empirical Software Engineering, vol. 24, pp. 562–601, 4 2019.
  11. Cruz, “Tools to measure software energy consumption from your computer,” http://luiscruz.github.io/2021/07/20/measuring-energy.html, 2021, blog post.