CN102750222A - Method for estimating energy consumption of embedded software based on C programming language - Google Patents

Method for estimating energy consumption of embedded software based on C programming language Download PDF

Info

Publication number
CN102750222A
CN102750222A CN2012101801741A CN201210180174A CN102750222A CN 102750222 A CN102750222 A CN 102750222A CN 2012101801741 A CN2012101801741 A CN 2012101801741A CN 201210180174 A CN201210180174 A CN 201210180174A CN 102750222 A CN102750222 A CN 102750222A
Authority
CN
China
Prior art keywords
function
variable
energy consumption
struct
energy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2012101801741A
Other languages
Chinese (zh)
Inventor
郭兵
沈艳
韩洪良
徐阔海
王毅
段林涛
熊伟
张文丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan University
Original Assignee
Sichuan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan University filed Critical Sichuan University
Priority to CN2012101801741A priority Critical patent/CN102750222A/en
Publication of CN102750222A publication Critical patent/CN102750222A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method for estimating energy consumption of embedded software based on C programming language and provides the novel method which is used for quickly predicting the energy consumption of the embedded software and providing a data basis for corresponding energy consumption optimizing research and development work. The method comprises performing researches on a structure of software developed by the C programming language from a source program level, dividing the software energy consumption according to a control structure of a source program, providing methods for estimating energy consumption of a sequential structure, a jump structure, a circulation structure and a function call structure in the program, and providing the method for estimating the energy consumption of the whole program. Experiment results show that compared with the software energy consumption measured by an energy consumption simulator, an error of the software energy consumption calculated by the method is within 10%, and the energy consumption of the embedded software can be accurately reflected.

Description

A kind of embedded software power consumption evaluation method based on the C language
Technical field
The present invention relates to the embedded software power consumption technical field of optimizing, especially relate to a kind of embedded software power consumption evaluation method based on the C language.
Background technology
Under the global energy background that highlights day by day with problem of environmental pollution in short supply, the energy-saving and emission-reduction problem of each ambit receives increasing concern.The whole world has 3,000,000,000 computing machines of surpassing at present, and the year power consumption of these computing machines surpasses 1,000 hundred million kilowatt hours.And in these consume, account for major part with ubiquitous embedded device energy consumption again.Therefore, the energy consumption problem of research embedded device is crucial concerning alleviating the serious day by day energy and environmental problem.
Embedded system partly is made up of embedded hardware part and embedded software, so the energy consumption of embedded system can be divided into hardware energy consumption and software energy consumption two parts.Wherein the hardware energy consumption just is meant system's energy consumption that hardware circuit produced in operational process; And in system's operational process, the execution of software instruction, the storage of data all can drive the hardware circuit activity, and the energy consumption that produces in this case is called software energy consumption.The measurement of embedded software power consumption and estimation are the basic works of carrying out the embedded software power consumption analysis and optimization.
The measurement of embedded software power consumption and evaluation method are had multiple, mainly comprise the hardware platform measuring method; The instruction-level method for estimating power consumption; The source program level method for estimating power consumption.A kind of static parsing method is adopted in the energy consumption estimation of source program level, does not adopt object run platform and simulation run platform, and is more directly perceived more, quick than the estimation of instruction level software energy consumption, more easy of integration with existing developing instrument.The present invention just belongs to the source program level method for estimating power consumption.
Because embedded software adopts the C language development more, the present invention studies the structure of C programmer, has proposed a kind of embedded software power consumption evaluation method based on the C language.
Summary of the invention
The object of the present invention is to provide a kind of embedded software power consumption evaluation method based on the C language.
The step that the present invention solves the technical scheme that its technical barrier adopts is following:
1) because C programmer form by sequential organization, redirect structure, loop structure and function call structure, so the energy consumption of C programmer form by the energy consumption of this several sections, that is:
Figure 2012101801741100002DEST_PATH_IMAGE002
Wherein, The energy consumption of
Figure DEST_PATH_IMAGE004
expression embedded type C program; The energy consumption of sequential organization in
Figure DEST_PATH_IMAGE006
expression c program; The energy consumption of redirect structure in
Figure DEST_PATH_IMAGE008
expression c program; The energy consumption of loop structure in expression c program, the energy consumption of function call in
Figure DEST_PATH_IMAGE012
expression c program;
2)
Figure DEST_PATH_IMAGE014
in the step 1) formula adopts following method to calculate:
Definition data structure:
Struct variable // variable
{
Int variable_kind; // types of variables
Char* variable_name; // variable name
Char* variable_value; // with the value of character string forms storage of variables
Struct variable* next; Next variable structure of // sensing
};
Struct operator // operational symbol
{
Int operator_kind; // operational symbol type
Int operator_treat; When // computing takes place, transform, by the type of process after transforming like need
Int operator_time; // this operational symbol occurrence number is defaulted as 0
Struct operator* next; Next operator structure of // sensing
};
Struct variable_energy // variable energy consumption
{
Int variable_time; // variable occurrence number
Double variable_energy; // variable power consumption values
};
Struct variable* v_list; // variable chained list
Struct variable_energy v_energy [VAR]; // variable energy consumption table
The computing method of
Figure 31292DEST_PATH_IMAGE006
: traversal v_list chained list; Calculate the identical node number of variable_kind; And be stored among the variable_time of respective type node in the v_energy table; The length VAR of table v_energy is the number of whole C linguistic variable types; After the processing that finishes the whole C program; Traversal v_energy table; Variable_time and variable_energy are multiplied each other, obtain the total energy consumption of every type of variable, every type of variable total energy consumption is added up just gets
Figure 479591DEST_PATH_IMAGE006
;
3)
Figure 839422DEST_PATH_IMAGE008
in the step 1) formula adopts following method to calculate:
At first judge redirect structure correct path in the process of implementation according to Fundamentals of Compiling; Obtain correct run time version; Then the run time version of correct in order structure handle, draw the power consumption values
Figure 765789DEST_PATH_IMAGE008
of redirect structure;
4)
Figure 845741DEST_PATH_IMAGE010
adopts following method to calculate in the step 1) formula:
At first judge the round-robin number of times in the loop structure implementation; Structure treatment loop body in order then; Combine loop body at last; And cycle index, carry out accumulation process, obtain the power consumption values of whole circulation structure;
5)
Figure 545024DEST_PATH_IMAGE012
in the step 1) formula adopts following formula to calculate:
Figure DEST_PATH_IMAGE016
The energy consumption called of
Figure DEST_PATH_IMAGE018
expression user function wherein, the energy consumption of
Figure DEST_PATH_IMAGE020
expression system library function call;
6)
Figure 665295DEST_PATH_IMAGE018
in the step 5) formula adopts following method to calculate:
Definition data structure:
Struct user_function // user function
{
Char* function_name; // function name
Int function_return_kind; // function return type
Int function_variable8_quantity; The number of 8 parameters of // function is defaulted as 0
Int function_variable16_quantity; The number of 16 parameters of // function is defaulted as 0
Int function_variable32_quantity; The number of 32 parameters of // function is defaulted as 0
Int function_variable64_quantity; The number of 64 parameters of // function is defaulted as 0
Struct user_function* next; The next user_function structure of // sensing
Int function_time; // function the number of times that is called is defaulted as 0 double function_energy; // function body power consumption values is defaulted as 0
};
Struct user_function* uf_list; // user function chained list
Function_energy wherein can be according to return type, number of parameters and the parameter type of function; Utilize the original function power consumption values try to achieve in advance to calculate, the original function power consumption values is meant an energy consumption that had produced when not only printenv but also the function that do not have a rreturn value be called;
The computing method of
Figure 865332DEST_PATH_IMAGE018
are: traversal uf_list chained list; Obtain the invoked number of times function_time of each function; The function_energy of itself and this function is multiplied each other; Obtain this function total energy consumption in the whole procedure, with the total energy consumption of each function add up just
Figure 186592DEST_PATH_IMAGE018
;
7)
Figure 452839DEST_PATH_IMAGE020
in the step 5) formula adopts following method to calculate:
Except that printf, scanf function, the inside execution route of most C built-in functions is all more fixing, and its power consumption values is relative fixed also, therefore, can measure the single call power consumption values of each built-in function except that printf, scanf function in advance;
Definition data structure:
Struct lib_function // built-in function
Char* lib_function_name; // built-in function title
Int lib_function_time; // built-in function the number of times that is called is defaulted as 0
Struct lib_function* next; The next lib_function structure of // sensing
};
Struct lib_function* lf_list; // built-in function chained list
The computing method of
Figure 721009DEST_PATH_IMAGE020
: traversal lf_list chained list; Lib_function_time and its single call power consumption values of measuring in advance of built-in function are multiplied each other; Obtain the total energy consumption of this built-in function in the whole procedure, with the total energy consumption of each built-in function add up just .
Embodiment
Below in conjunction with instance the present invention is described further.
Choose labyrinth function (MAZE), Joseph's ring function (JOSEPHU), eight queens functions (QUEEN), bubble sort (BUBBULE), matrix multiplication (MATRIX) as test case.
1) use the result of HMSim simulator of energy consumption operation test case to be:
Program name E_model(nJ) E_HMsim(nJ) Error (%)
MAZE 465418.85 462662.34 0.60
JOSEPHU 3059.24 2984.01 2.52
QUEEN 153246.86 145489.04 5.33
BUBBULE 188026.74 171645.95 9.54
MATRIX 2947.25 2875.71 2.49
The Error Calculation formula does in the table
Figure DEST_PATH_IMAGE022
2) result of operation test case is on Winbond W90P71 development board:
Program name E_model(nJ) E_ W90P71 (nJ) Error (%)
MAZE 465418.85 464400 0.21
JOSEPHU 3059.24 2925 4.58
QUEEN 153246.86 140404 9.14
BUBBULE 188026.74 183600 9.08
MATRIX 2947.25 2934 1.03
The Error Calculation formula does in the table
Figure DEST_PATH_IMAGE024
Can know through above two table experimental data contrasts; The measurement power consumption values error of power consumption values and simulator of energy consumption HMSim and Winbond W90P71 development board that adopts method of the present invention estimation is all in 10%; Explain that method that this paper proposes can estimate the power consumption values of embedded software quickly and efficiently, for important basis has been established in embedded software power consumption optimization and analysis.

Claims (1)

1. embedded software power consumption evaluation method based on the C language, the step that it is characterized in that setting up this method is following:
1) because C programmer form by sequential organization, redirect structure, loop structure and function call structure, so the energy consumption of C programmer form by the energy consumption of this several sections, that is:
Figure 2012101801741100001DEST_PATH_IMAGE001
Wherein, The energy consumption of expression embedded type C program; The energy consumption of sequential organization in
Figure 423898DEST_PATH_IMAGE003
expression c program; The energy consumption of redirect structure in
Figure 242950DEST_PATH_IMAGE004
expression c program; The energy consumption of loop structure in
Figure 989058DEST_PATH_IMAGE005
expression c program, the energy consumption of function call in
Figure 842744DEST_PATH_IMAGE006
expression c program;
2)
Figure 487877DEST_PATH_IMAGE007
in the step 1) formula adopts following method to calculate:
Definition data structure:
Struct variable // variable
{
Int variable_kind; // types of variables
Char* variable_name; // variable name
Char* variable_value; // with the value of character string forms storage of variables
Struct variable* next; Next variable structure of // sensing
};
Struct operator // operational symbol
{
Int operator_kind; // operational symbol type
Int operator_treat; When // computing takes place, transform, by the type of process after transforming like need
Int operator_time; // this operational symbol occurrence number is defaulted as 0
Struct operator* next; Next operator structure of // sensing
};
Struct variable_energy // variable energy consumption
{
Int variable_time; // variable occurrence number
Double variable_energy; // variable power consumption values
};
Struct variable* v_list; // variable chained list
Struct variable_energy v_energy [VAR]; // variable energy consumption table
The computing method of
Figure 325383DEST_PATH_IMAGE003
: traversal v_list chained list; Calculate the identical node number of variable_kind; And be stored among the variable_time of respective type node in the v_energy table; The length VAR of table v_energy is the number of whole C linguistic variable types; After the processing that finishes the whole C program; Traversal v_energy table; Variable_time and variable_energy are multiplied each other; Obtain the total energy consumption of every type of variable, every type of variable total energy consumption is added up just gets ;
3)
Figure 848954DEST_PATH_IMAGE004
in the step 1) formula adopts following method to calculate:
At first judge redirect structure correct path in the process of implementation according to Fundamentals of Compiling; Obtain correct run time version; Then the run time version of correct in order structure handle, draw the power consumption values
Figure 412790DEST_PATH_IMAGE004
of redirect structure;
4)
Figure 252439DEST_PATH_IMAGE005
adopts following method to calculate in the step 1) formula:
At first judge the round-robin number of times in the loop structure implementation; Structure treatment loop body in order then; Combine loop body at last; And cycle index, carry out accumulation process, obtain the power consumption values of whole circulation structure;
5)
Figure 653782DEST_PATH_IMAGE006
in the step 1) formula adopts following formula to calculate:
Figure 903366DEST_PATH_IMAGE008
The energy consumption called of
Figure DEST_PATH_IMAGE009
expression user function wherein, the energy consumption of expression system library function call;
6)
Figure 276240DEST_PATH_IMAGE009
in the step 5) formula adopts following method to calculate:
Definition data structure:
Struct user_function // user function
{
Char* function_name; // function name
Int function_return_kind; // function return type
Int function_variable8_quantity; The number of 8 parameters of // function is defaulted as 0
Int function_variable16_quantity; The number of 16 parameters of // function is defaulted as 0
Int function_variable32_quantity; The number of 32 parameters of // function is defaulted as 0
Int function_variable64_quantity; The number of 64 parameters of // function is defaulted as 0
Struct user_function* next; The next user_function structure of // sensing
Int function_time; // function the number of times that is called is defaulted as 0
Double function_energy; // function body power consumption values is defaulted as 0
};
Struct user_function* uf_list; // user function chained list
Function_energy wherein can be according to return type, number of parameters and the parameter type of function; Utilize the original function power consumption values try to achieve in advance to calculate, the original function power consumption values is meant an energy consumption that had produced when not only printenv but also the function that do not have a rreturn value be called;
The computing method of are: traversal uf_list chained list; Obtain the invoked number of times function_time of each function; The function_energy of itself and this function is multiplied each other; Obtain this function total energy consumption in the whole procedure, with the total energy consumption of each function add up just
Figure 176249DEST_PATH_IMAGE009
;
7)
Figure 944485DEST_PATH_IMAGE010
in the step 5) formula adopts following method to calculate:
Except that printf, scanf function, the inside execution route of most C built-in functions is all more fixing, and its power consumption values is relative fixed also, so can measure the single call power consumption values of each built-in function except that printf, scanf function in advance;
Definition data structure:
Struct lib_function // built-in function
{
Char* lib_function_name; // built-in function title
Int lib_function_time; // built-in function the number of times that is called is defaulted as 0
Struct lib_function* next; The next lib_function structure of // sensing
};
Struct lib_function* lf_list; // built-in function chained list
The computing method of
Figure 108619DEST_PATH_IMAGE010
: traversal lf_list chained list; Lib_function_time and its single call power consumption values of measuring in advance of built-in function are multiplied each other; Obtain the total energy consumption of this built-in function in the whole procedure, with the total energy consumption of each built-in function add up just .
CN2012101801741A 2012-06-04 2012-06-04 Method for estimating energy consumption of embedded software based on C programming language Pending CN102750222A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012101801741A CN102750222A (en) 2012-06-04 2012-06-04 Method for estimating energy consumption of embedded software based on C programming language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012101801741A CN102750222A (en) 2012-06-04 2012-06-04 Method for estimating energy consumption of embedded software based on C programming language

Publications (1)

Publication Number Publication Date
CN102750222A true CN102750222A (en) 2012-10-24

Family

ID=47030432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012101801741A Pending CN102750222A (en) 2012-06-04 2012-06-04 Method for estimating energy consumption of embedded software based on C programming language

Country Status (1)

Country Link
CN (1) CN102750222A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407972A (en) * 2014-11-21 2015-03-11 昆明理工大学 Embedded software energy consumption testing method based on improved neural network
CN115576856A (en) * 2022-12-08 2023-01-06 浪潮通信信息系统有限公司 Energy consumption evaluation method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1766848A (en) * 2005-11-08 2006-05-03 北京大学 Method for estimating power consumption when embedded software running based on simulator
US20090006878A1 (en) * 2007-06-28 2009-01-01 International Business Machines Corporation Method and system for monitoring system processes energy consumption
CN101881995A (en) * 2010-06-04 2010-11-10 四川大学 Hierarchical classification power consumption measurement method for ARM instruction set
CN101901161A (en) * 2010-07-21 2010-12-01 四川大学 Energy consumption related software/hardware partition-oriented hierarchical control and data flow graph modeling method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1766848A (en) * 2005-11-08 2006-05-03 北京大学 Method for estimating power consumption when embedded software running based on simulator
US20090006878A1 (en) * 2007-06-28 2009-01-01 International Business Machines Corporation Method and system for monitoring system processes energy consumption
CN101881995A (en) * 2010-06-04 2010-11-10 四川大学 Hierarchical classification power consumption measurement method for ARM instruction set
CN101901161A (en) * 2010-07-21 2010-12-01 四川大学 Energy consumption related software/hardware partition-oriented hierarchical control and data flow graph modeling method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘啸滨 等: "嵌入式软件体系结构级能耗建模方法", 《软件学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407972A (en) * 2014-11-21 2015-03-11 昆明理工大学 Embedded software energy consumption testing method based on improved neural network
CN115576856A (en) * 2022-12-08 2023-01-06 浪潮通信信息系统有限公司 Energy consumption evaluation method and device

Similar Documents

Publication Publication Date Title
Capra et al. Is software “green”? Application development environments and energy efficiency in open source applications
Kulkarni et al. Automatic construction of inlining heuristics using machine learning
Pathania et al. HotSniper: Sniper-based toolchain for many-core thermal simulations in open systems
Parikh et al. Instruction scheduling for low power
Coplin et al. Energy, power, and performance characterization of GPGPU benchmark programs
Herdt et al. Towards early validation of firmware-based power management using virtual prototypes: A constrained random approach
Roukh et al. Eco-processing of OLAP complex queries
Ji et al. An artificial neural network model of LRU-cache misses on out-of-order embedded processors
Walker et al. Run-time power estimation for mobile and embedded asymmetric multi-core cpus
CN102750222A (en) Method for estimating energy consumption of embedded software based on C programming language
Lattuada et al. Performance modeling of embedded applications with zero architectural knowledge
Wang et al. An improved instruction-level power model for ARM11 microprocessor
Van Hasselt et al. Comparing the energy efficiency of webassembly and javascript in web applications on android mobile devices
Fu et al. Estimating software energy consumption with machine learning approach by software performance feature
Li et al. Fine-grained energy modeling for the source code of a mobile application
Calore et al. Energy-efficiency tuning of a lattice Boltzmann simulation using MERIC
Sundriyal et al. Runtime power-aware energy-saving scheme for parallel applications
Onnebrink et al. Black box power estimation for digital signal processors using virtual platforms
Béziers la Fosse et al. Annotating executable DSLs with energy estimation formulas
Uddin et al. Signature-based high-level simulation of microthreaded many-core architectures
Li et al. Software power modeling method at architecture level based on complex networks
CN106020982A (en) Method for simulating resource consumption of software component
Yuechuan et al. Analysis method of energy for C source program and its application
Barioni et al. Iterative development, evaluation and optimal parameter estimation of a dynamic simulation model: a case study.
Wang et al. An architecture‐level graphics processing unit energy model

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20121024