CN107220160B - Method and device for determining electric quantity consumption of application program - Google Patents

Method and device for determining electric quantity consumption of application program Download PDF

Info

Publication number
CN107220160B
CN107220160B CN201710392496.5A CN201710392496A CN107220160B CN 107220160 B CN107220160 B CN 107220160B CN 201710392496 A CN201710392496 A CN 201710392496A CN 107220160 B CN107220160 B CN 107220160B
Authority
CN
China
Prior art keywords
power consumption
processor
determining
unit
application program
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.)
Expired - Fee Related
Application number
CN201710392496.5A
Other languages
Chinese (zh)
Other versions
CN107220160A (en
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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
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 Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201710392496.5A priority Critical patent/CN107220160B/en
Publication of CN107220160A publication Critical patent/CN107220160A/en
Application granted granted Critical
Publication of CN107220160B publication Critical patent/CN107220160B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3058Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations
    • G06F11/3062Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations where the monitored property is the power consumption
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Power Sources (AREA)

Abstract

The invention discloses a method and a device for determining electric quantity consumption of an application program, relates to the technical field of information, and mainly aims to improve the accuracy of electric quantity consumption of the application program. The method comprises the following steps: performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object; analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network flow, a third power consumption parameter corresponding to data flow and a fourth power consumption parameter corresponding to the positioning module through the power consumption information class object and the system file corresponding to the operating system, and respectively determining the power consumption of the processor, the network flow power consumption, the data flow power consumption and the positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter, so as to determine the power consumption of the application program. The method and the device are suitable for determining the power consumption of the application program.

Description

Method and device for determining electric quantity consumption of application program
Technical Field
The present invention relates to the field of information technologies, and in particular, to a method and an apparatus for determining power consumption of an application.
Background
With the continuous development of information technology, people have more and more demands on terminal equipment, and in order to meet the multifunctional demand of the terminal equipment, an application program meeting the demand of a user can be installed on the terminal equipment generally. In order to ensure the service life of the terminal device, it is important to determine the power consumption of the application program and analyze and research the power consumption performance of the application program.
At present, when determining the power consumption of an application, the power consumption of each component of a terminal device where the application is located is usually counted through a router file, and then the power consumption of the application is determined according to the power consumption of each component. However, a plurality of applications are usually installed on the terminal device, and the power consumption of each component counted by the router file may reflect the power consumption of the plurality of applications, and if the power consumption of the application is determined according to the power consumption of each component counted by the router file, the determined power consumption of the application may be inaccurate, so that the accuracy of the power consumption of the application is low.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for determining power consumption of an application, and mainly aims to improve accuracy of power consumption of an application.
According to an aspect of the present invention, there is provided a power consumption determination method for an application program, including:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
According to another aspect of the present invention, there is provided an electricity consumption determination apparatus for an application, including:
the reflection unit is used for performing reflection processing on the internal power consumption information class of the operating system where the application program is located to obtain a power consumption information class object;
the analysis unit is used for analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network flow, a third power consumption parameter corresponding to data flow and a fourth power consumption parameter corresponding to the positioning module through the power consumption information class object reflected by the reflection unit and a system file corresponding to the operating system;
a first determining unit, configured to determine, according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter analyzed by the analyzing unit, a processor power consumption, a network traffic power consumption, a data traffic power consumption, and a positioning module power consumption corresponding to the application program, respectively;
and the second determining unit is used for determining the power consumption of the application program according to the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module determined by the first determining unit.
According to yet another aspect of the invention, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
According to yet another aspect of the present invention, there is provided a power consumption determining apparatus for an application program, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the program:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
Compared with the prior method and device for determining the power consumption of each part of terminal equipment where an application program is located by counting the power consumption of each part through a router file and then determining the power consumption of the application program according to the power consumption of each part, the method and device provided by the invention can obtain a power consumption information class object by performing reflection processing on an internal power consumption information class of an operating system where the application program is located; and through the power consumption information class object and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module can be analyzed. In addition, the processor power consumption, the network flow power consumption, the data flow power consumption and the positioning module power consumption corresponding to the application program can be respectively determined according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter, and determining the power consumption of the application program through the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module, so that the interference of the power consumption situation of other application programs can be overcome, the power consumption of other application programs is prevented from being miscalculated into the power consumption of the application program, the power consumption of the application program is determined only according to the power consumption parameters of the application program, therefore, the accuracy of the electric quantity consumption of the application program can be ensured, and the accuracy of the electric quantity consumption of the application program can be improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a power consumption method for an application according to an embodiment of the present invention;
FIG. 2 is a flow chart of an alternative power consumption method for an application according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating an exemplary power consumption device of an application according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an embodiment of an application power consumption device;
fig. 5 is a schematic structural diagram of a power consumption device of an application according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides an electric quantity consumption method for an application program, as shown in fig. 1, the method includes:
101. and performing reflection processing on the internal power consumption information class of the operating system where the application program is located to obtain a power consumption information class object.
The operating system may be an operating system corresponding to the terminal device of the application program, and the operating system may be an android operating system or the like. Reflection can be a mechanism for dynamically loading, analyzing and using some types of data which are uncertain at a compiling stage during the running period of a program, loading a data type which can be determined only in the running period through reflection processing, analyzing the structure of an internal power consumption information class of an operating system, acquiring internal information, operating the type or an example, accessing the attribute of the power consumption information class, calling a power consumption information class method and creating a power consumption information class object.
In the embodiment of the present invention, if the internal power consumption information class of the operating system in which the application program is located is com. The embodiment of the invention can be applied to determining the power consumption of the application program in the non-root environment of the operating system.
102. And analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network flow, a third power consumption parameter corresponding to data flow and a fourth power consumption parameter corresponding to the positioning module through the power consumption information class object and the system file corresponding to the operating system.
The first power consumption parameter may include a processor cluster step frequency corresponding to each processor cluster used by the application program, a processor power consumption of unit running time of each step frequency under each processor cluster, and a total usage duration of the processor cluster corresponding to the application program, the second power consumption parameter may include a power consumption of unit network traffic and network traffic, the third power consumption parameter may include a power consumption of unit data traffic and data traffic, and the fourth power consumption parameter may include a power consumption of unit positioning time and positioning module positioning duration.
It should be noted that, for different versions of operating systems, the system files used for analyzing the first parameter, the second parameter, the third parameter, and the fourth parameter may be different. For example, if the os is a version above 4.1 of the android os, the system file used may be a system file/proc/net/xt _ qtague/iface _ stat _ all, and if the os is a version below 4.1 of the android os, the system file used may be a system file/proc/net/xt _ qtague/stats.
103. And respectively determining the power consumption of the processor, the network flow power consumption, the data flow power consumption and the positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter.
For the embodiment of the present invention, the operating system may store the power consumption parameters of the application program, and by analyzing the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter of the application program, it is possible to overcome interference of power consumption conditions of other application programs, avoid miscalculating power consumption of other application programs as power consumption of the application program, and determine power consumption of the application program according to the power consumption parameters of the application program only, thereby ensuring accuracy of power consumption of the application program, and further improving accuracy of power consumption of the application program.
104. And determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
In the embodiment of the present invention, the sum of the power consumption of the processor, the power consumption of the network traffic, the power consumption of the data traffic, and the power consumption of the positioning module may be determined as the power consumption of the application program. That is, the power consumption of the application is processor power consumption + network traffic power consumption + data traffic power consumption + positioning module power consumption.
Compared with the method for determining the electric quantity consumption of the application program, which is provided by the embodiment of the invention, the method for determining the electric quantity consumption of the application program has the advantages that the electric quantity consumption of each part of the terminal equipment where the application program is located is counted through a router file at present, and then the electric quantity consumption of the application program is determined according to the electric quantity consumption of each part, the internal electric consumption information class of an operating system where the application program is located is subjected to reflection processing, so that an electric consumption information class object can be obtained; and through the power consumption information class object and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module can be analyzed. In addition, the processor power consumption, the network flow power consumption, the data flow power consumption and the positioning module power consumption corresponding to the application program can be respectively determined according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter, and determining the power consumption of the application program through the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module, so that the interference of the power consumption situation of other application programs can be overcome, the power consumption of other application programs is prevented from being miscalculated into the power consumption of the application program, the power consumption of the application program is determined only according to the power consumption parameters of the application program, therefore, the accuracy of the electric quantity consumption of the application program can be ensured, and the accuracy of the electric quantity consumption of the application program can be improved.
An embodiment of the present invention provides another method for consuming power of an application program, as shown in fig. 2, the method includes:
201. and performing reflection processing on the internal power consumption information class of the operating system where the application program is located to obtain a power consumption information class object.
In step 101, a detailed explanation of the operating system and the reflection processing has been described, and the embodiment of the present invention is not described herein again.
202. And determining the processor cluster step frequency number corresponding to each processor cluster used by the application program through the processor cluster step frequency acquisition attribute corresponding to the power consumption information object, and determining the processor power consumption of unit operation time of each step frequency under each processor cluster through the unit processor power consumption acquisition attribute corresponding to the power consumption information object.
The power consumption information class object may be PowerProfile, the processor cluster step frequency acquisition attribute corresponding to the power consumption information class object may be getnumcopestepincluster of PowerProfile, the processor cluster step frequency number may be CpuSteps, and specifically, CpuSteps may be obtained by traversing each processor cluster and using getnumcopestepincluster. The unit processor power consumption obtaining attribute corresponding to the power consumption information object may be geteveragepowerForcpu of PowerProfile, the processor power consumption of the unit running time may be cpuclusterStepCost, and the cpuclusterStepCost may be obtained by traversing each step frequency and using getAlveragePowerForcpu.
203. And determining the power consumption of unit network flow, the power consumption of unit data flow and the power consumption of unit positioning time through the unit power consumption acquisition attribute corresponding to the power consumption information class object.
The unit power consumption corresponding to the power consumption information class object may be geteveragepower of PowerProfile, the power consumption of unit network traffic may be wifiCost, the power consumption of unit data traffic may be radioCost, and the power consumption of unit positioning time may be gpsCost.
204. And analyzing the system file corresponding to the operating system to obtain the total use time of the processor cluster, the network flow, the data flow and the positioning time of the positioning module corresponding to the application program.
For the embodiment of the present invention, the analyzing the system file corresponding to the operating system to obtain the total usage duration of the processor cluster specifically includes: analyzing a system file corresponding to the operating system to obtain a first running time of the process of the application program in the processor cluster user state, a second running time of the processor cluster kernel state, a third running time of all dead threads in the processor cluster user state, and a fourth running time of all dead threads in the processor cluster kernel state; determining the sum of the first running time, the second running time, the third running time and the fourth running time as the total using time of the processor cluster.
It should be noted that getnumclusterers of PowerProfile may be used to obtain a cluster number cpuscclusternum of a processing cluster, then obtain a process identifier of a current process, and analyze a system file proc/pid/stat corresponding to the operating system to obtain the first running time, the second running time, the third running time, and the fourth running time. For example, if the first running time is time, the second running time is time, the third running time is cutime, the fourth running time is cstime, and the total usage duration of the processor cluster is cputitime, the processor cluster total usage duration cputitime may be determined as follows.
For the embodiment of the present invention, the step of analyzing the system file corresponding to the operating system to obtain the positioning duration of the positioning module may specifically include: analyzing the system file corresponding to the operating system to obtain first calling time for calling a preset positioning updating request function and second calling time for calling a preset positioning updating release function when a positioning module corresponding to the application program runs; and determining the difference between the second calling time and the first calling time as the positioning duration of the positioning module.
The preset request positioning update function and the preset release positioning update function may be switched into an operating system application program interface through a section-oriented programming technology, the preset request positioning update function may be a requestLocationUpdates function, the preset release positioning update function may be a removeUpdates function, when a positioning module corresponding to the application program runs, a first call time of the obtained requestLocationUpdates function may be time1, a second call time of the removeUpdates function may be time2, and the positioning module positioning duration gpsmith may be determined by a following formula gpsmith, namely time 2-time 1, that is, a difference between time2 and time1 is determined as the positioning module positioning duration.
205. And determining the power consumption of the processor used by the application program according to the step frequency of the processor cluster, the power consumption of the processor in unit running time and the total use time of the processor cluster.
For the embodiment of the present invention, in order to determine the power consumption of the processor used by the application program, step 205 may specifically include: determining the quotient of the total using time length of the processor cluster and the total step frequency of the processor cluster as the processor running time of unit step frequency; determining the processor power consumption of each stride frequency under each processor cluster by taking the product of the processor running time of the unit stride frequency and the processor power consumption of the unit running time; and determining the sum of the power consumption of the processors of each step frequency under each processor cluster as the power consumption of the processor used by the application program.
In the embodiment of the present invention, the total usage time of the processor cluster may be cpuTime, the total step frequency of the processor cluster may be totalcppusteps, the totalcppusteps may be obtained by accumulating respective CpuSteps, the processor runtime of the unit step frequency may be averageStepTime, and the averageStepTime may be determined by the following formula: averageStepTime ═ cputatime/totalccpugeps; the processor power consumption per unit running time may be cpuClusterStepPower, and the processor power consumption at a certain stride frequency under a certain processor cluster may be cpuClusterStepPower, and then cpuClusterStepPower may be determined by the following formula: cpuclusteristepppower ═ cpuclusteristeppost ═ averageStepTime; by adding up all the cpuclustersteppowers, the processor power consumption totalcupower used by the application can be determined.
206. And determining the network flow power consumption of the application program according to the network flow and the power consumption of the unit network flow.
For the embodiment of the present invention, step 206 may specifically include: and determining the product of the network flow and the power consumption of the unit network flow as the network flow power consumption of the application program.
In this embodiment of the present invention, if the network traffic is wifi bytes, the power consumption of the unit network traffic is wifi cost, and the power consumption of the network traffic is wifi power, the power consumption of the network traffic of the application program may be determined by the following formula: wifiPower ═ wifiBytes ═ wifiCost.
207. And determining the data flow power consumption of the application program according to the data flow and the power consumption of the unit data flow.
For the embodiment of the present invention, step 207 may specifically include: and determining the product of the data flow and the power consumption of the unit data flow as the data flow power consumption of the application program.
In this embodiment of the present invention, if the data traffic is a radioBytes, the power consumption of the unit data traffic is a radioCost, and the power consumption of the data traffic is a radioPower, the power consumption of the network traffic of the application program may be determined by the following formula: radioPower ═ radioBytes ═ radioCost.
208. And determining the power consumption of the positioning module according to the positioning time and the power consumption of the unit positioning time.
For the embodiment of the present invention, step 208 may specifically include: and determining the product of the positioning time length and the power consumption of the unit positioning time as the power consumption of the positioning module.
In this embodiment of the present invention, if the positioning duration is gpsTime, the power consumption per positioning time is gpsCost, and the power consumption of the positioning module is gpsfower, the power consumption of the positioning module may be determined by the following formula: gpsPower. gpsCost. gpsTime.
209. And determining the sum of the power consumption of the processor, the network flow power consumption, the data flow power consumption and the positioning module as the power consumption of the application program.
In this embodiment of the present invention, the power consumption of the processor may be totalcupower, the power consumption of the network traffic may be wifi power, the power consumption of the data traffic may be radioPower, and the power consumption of the application may be totalPower, and then the totalPower may be determined by the following formula: totalPower ═ radioPower + wifiPower + totalpurpower.
For the embodiment of the invention, a function of generating a power consumption performance analysis report corresponding to the application program is also provided, and the method comprises the following steps: and transmitting the power consumption of the application program to a preset database, so that the preset database can generate a power consumption performance analysis report corresponding to the application program according to the version of the operating system corresponding to the application program, the type of the corresponding terminal equipment and the power consumption.
Compared with the method for determining the electric quantity consumption of the application program, which is provided by the embodiment of the invention, the method for determining the electric quantity consumption of the application program has the advantages that the electric quantity consumption of each part of the terminal equipment where the application program is located is counted through the router file at present, and then the electric quantity consumption of the application program is determined according to the electric quantity consumption of each part, the internal electric consumption information class of the operating system where the application program is located is subjected to reflection processing, so that an electric consumption information class object can be obtained; and through the power consumption information class object and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module can be analyzed. In addition, the processor power consumption, the network flow power consumption, the data flow power consumption and the positioning module power consumption corresponding to the application program can be respectively determined according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter, and determining the power consumption of the application program through the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module, so that the interference of the power consumption situation of other application programs can be overcome, the power consumption of other application programs is prevented from being miscalculated into the power consumption of the application program, the power consumption of the application program is determined only according to the power consumption parameters of the application program, therefore, the accuracy of the electric quantity consumption of the application program can be ensured, and the accuracy of the electric quantity consumption of the application program can be improved.
Further, as a specific implementation of fig. 1, an embodiment of the present invention provides an apparatus for determining power consumption of an application, as shown in fig. 3, where the apparatus includes: reflection means 31, analysis means 32, first determination means 33, and second determination means 34.
The reflection unit 31 may be configured to perform reflection processing on the internal power consumption information class of the operating system where the application program is located, so as to obtain a power consumption information class object.
The analyzing unit 32 may be configured to analyze, through the power consumption information class object reflected by the reflecting unit 31 and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic, and a fourth power consumption parameter corresponding to a positioning module.
The first determining unit 33 may be configured to determine, according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter analyzed by the analyzing unit 32, a processor power consumption, a network traffic power consumption, a data traffic power consumption, and a positioning module power consumption corresponding to the application program, respectively.
The second determining unit 34 may be configured to determine the power consumption of the application according to the power consumption of the processor, the power consumption of the network traffic, the power consumption of the data traffic, and the power consumption of the positioning module determined by the first determining unit 33.
It should be noted that other corresponding descriptions of the functional modules involved in the power consumption determining apparatus for an application according to the embodiment of the present invention may refer to the corresponding description of the method shown in fig. 1, and are not described herein again.
Compared with the prior art that the power consumption of each part of the terminal equipment where the application program is located is counted through a router file, and then the power consumption of the application program is determined according to the power consumption of each part, the device for determining the power consumption of the application program provided by the embodiment of the invention can obtain the power consumption information class object by performing reflection processing on the internal power consumption information class of the operating system where the application program is located; and through the power consumption information class object and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module can be analyzed. In addition, the processor power consumption, the network flow power consumption, the data flow power consumption and the positioning module power consumption corresponding to the application program can be respectively determined according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter, and determining the power consumption of the application program through the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module, so that the interference of the power consumption situation of other application programs can be overcome, the power consumption of other application programs is prevented from being miscalculated into the power consumption of the application program, the power consumption of the application program is determined only according to the power consumption parameters of the application program, therefore, the accuracy of the electric quantity consumption of the application program can be ensured, and the accuracy of the electric quantity consumption of the application program can be improved.
Further, as a specific implementation of fig. 2, an embodiment of the present invention provides another apparatus for determining power consumption of an application, as shown in fig. 4, where the apparatus includes: reflection section 41, analysis section 42, first determination section 43, and second determination section 44.
The reflection unit 41 may be configured to perform reflection processing on the internal power consumption information class of the operating system where the application program is located, so as to obtain a power consumption information class object.
The analyzing unit 42 may be configured to analyze, through the power consumption information class object reflected by the reflecting unit 41 and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic, and a fourth power consumption parameter corresponding to a positioning module.
The first determining unit 43 may be configured to determine, according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter analyzed by the analyzing unit 42, a processor power consumption, a network traffic power consumption, a data traffic power consumption, and a positioning module power consumption corresponding to the application program, respectively.
The second determining unit 44 may be configured to determine the power consumption of the application according to the power consumption of the processor, the power consumption of the network traffic, the power consumption of the data traffic, and the power consumption of the positioning module determined by the first determining unit 43.
For the embodiment of the present invention, the first power consumption parameter includes a processor cluster step frequency number corresponding to each processor cluster used by the application, a processor power consumption of unit running time of each step frequency under each processor cluster, and a total usage duration of the processor cluster corresponding to the application, the second power consumption parameter includes a power consumption and a network traffic of unit network traffic, the third power consumption parameter includes a power consumption and a data traffic of unit data traffic, the fourth power consumption parameter includes a power consumption and a positioning module positioning duration of unit positioning time, and the parsing unit 42 may include: a first determining module 421, a second determining module 422 and an analyzing module 423.
The first determining module 421 may be configured to determine the processor cluster step frequency number by obtaining the attribute of the processor cluster step frequency corresponding to the power consumption information class object, and determine the processor power consumption of the unit running time by obtaining the attribute of the unit processor power consumption corresponding to the power consumption information class object.
The second determining module 422 may be configured to determine the power consumption of the unit network traffic, the power consumption of the unit data traffic, and the power consumption of the unit positioning time according to the unit power consumption obtaining attribute corresponding to the power consumption information class object.
The parsing module 423 may be configured to parse the system file corresponding to the operating system to obtain the total usage duration of the processor cluster, the network traffic, the data traffic, and the positioning duration of the positioning module.
The second determining unit 44 may be specifically configured to determine a sum of the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption as the power consumption of the application.
For the embodiment of the present invention, in order to determine the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption, the first determining unit 43 may include: a third determining module 431, a fourth determining module 432, a fifth determining module 433, and a sixth determining module 434.
The third determining module 431 may be configured to determine the power consumption of the processor used by the application according to the step count of the processor cluster, the power consumption of the unit runtime, and the total usage duration of the processor cluster.
The fourth determining module 432 may be configured to determine the network traffic power consumption of the application according to the network traffic and the power consumption of the unit network traffic.
The fifth determining module 433 may be configured to determine the data traffic power consumption of the application according to the data traffic and the power consumption of the unit data traffic.
The sixth determining module 434 may be configured to determine the power consumption of the positioning module according to the positioning duration and the power consumption per positioning time.
For the embodiment of the present invention, in order to determine the power consumption of the processor used by the application program, the third determining module 431 may include: a first determination sub-module 4311, a second determination sub-module 4312 and a third determination sub-module 4313.
The first determining submodule 4311 may be configured to determine a quotient of a total usage duration of the processor cluster and a total stride frequency of the processor cluster as a processor runtime of a unit stride frequency.
The second determining submodule 4312 may be configured to determine the power consumption of the processor at each stride frequency in each processor cluster according to the product of the processor running time of the unit stride frequency and the power consumption of the processor at the unit running time determined by the first determining submodule 4311.
The third determining sub-module 4313 may be configured to determine, as the power consumption of the processor used by the application, a sum of the power consumption of the processors of the respective processor clusters determined by the second determining sub-module 4312.
The fourth determining module 432 may be specifically configured to determine a product of the network traffic and the power consumption of the unit network traffic as the network traffic power consumption of the application.
The fifth determining module 433 may be specifically configured to determine a product of the data traffic and the power consumption of the unit data traffic as the data traffic power consumption of the application.
The sixth determining module 434 may be specifically configured to determine the product of the positioning duration and the power consumption of the unit positioning time as the power consumption of the positioning module.
For the embodiment of the present invention, in order to analyze the total usage duration of the processor cluster, the analyzing module 423 includes: a first parsing submodule 4231 and a fourth determination submodule 4232.
The first parsing submodule 4231 may be configured to parse a system file corresponding to the operating system to obtain a first running time of the process of the application program in the processor cluster user state, a second running time of the processor cluster kernel state, a third running time of all dead threads in the processor cluster user state, and a fourth running time of all dead threads in the processor cluster kernel state.
The fourth determining submodule 4232 may be configured to determine a sum of the first running time, the second running time, the third running time, and the fourth running time as a total usage duration of the processor cluster.
For the embodiment of the present invention, in order to analyze the positioning duration of the positioning module, the analyzing module 423 may further include: a second parsing submodule 4233 and a fifth determination submodule 4234.
The second parsing submodule 4233 may be configured to parse the system file corresponding to the operating system to obtain a first call time for calling a preset positioning update request function and a second call time for calling a preset positioning update release function when the positioning module corresponding to the application runs;
the fifth determining submodule 4234 may be configured to determine a difference between the second calling time and the first calling time as the positioning module positioning duration.
For the embodiment of the present invention, in order to generate the power consumption performance analysis report corresponding to the application program, the apparatus may further include: a transmission unit 45.
The transmission unit 45 may be configured to transmit the power consumption of the application program to a preset database, so that the preset database generates a power consumption performance analysis report corresponding to the application program according to the operating system version corresponding to the application program, the corresponding terminal device type, and the power consumption.
It should be noted that other corresponding descriptions of the functional modules related to the power consumption determining apparatus for another application program provided in the embodiment of the present invention may refer to the corresponding description of the method shown in fig. 2, and are not described herein again.
In another apparatus for determining power consumption of an application provided in an embodiment of the present invention, the apparatus may be configured with a reflection unit, an analysis unit, a first determination unit, and a second determination unit, and compared with counting power consumption of each component of a terminal device where the application is located through a router file at present, and then determining power consumption of the application according to the power consumption of each component, the apparatus according to the embodiment of the present invention may obtain a power consumption information class object by performing reflection processing on an internal power consumption information class of an operating system where the application is located; and through the power consumption information class object and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module can be analyzed. In addition, the processor power consumption, the network flow power consumption, the data flow power consumption and the positioning module power consumption corresponding to the application program can be respectively determined according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter, and determining the power consumption of the application program through the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module, so that the interference of the power consumption situation of other application programs can be overcome, the power consumption of other application programs is prevented from being miscalculated into the power consumption of the application program, the power consumption of the application program is determined only according to the power consumption parameters of the application program, therefore, the accuracy of the electric quantity consumption of the application program can be ensured, and the accuracy of the electric quantity consumption of the application program can be improved.
In order to achieve the above object of improving the accuracy of power consumption of an application program, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor, and the computer program implements the following steps: performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object; analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system; determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter; and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
In order to achieve the above purpose of improving the accuracy of the power consumption of the application program, an embodiment of the present invention further provides a schematic structural diagram of the large-flow high-lift circulation pump hydraulic model determination device, as shown in fig. 5, including a memory 52, a processor 51, and a computer program stored on the memory 52 and capable of running on the processor 51, where the processor 51 implements the following steps when executing the program: performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object; analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system; determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter; and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
The embodiment of the invention also provides the following technical scheme:
a1, a method for determining power consumption of an application, comprising:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
A2, the method according to a1, wherein the first power consumption parameter includes a processor cluster step frequency corresponding to each processor cluster used by the application, a processor power consumption per unit running time of each step frequency of each processor cluster, and a total usage duration of the processor cluster corresponding to the application, the second power consumption parameter includes a power consumption per unit network traffic and a network traffic, the third power consumption parameter includes a power consumption per unit data traffic and a data traffic, and the fourth power consumption parameter includes a power consumption per unit positioning time and a positioning module positioning duration; analyzing a first power consumption parameter corresponding to the power consumption of a processor used by the application program, a second power consumption parameter corresponding to the power consumption of network traffic, a third power consumption parameter corresponding to the power consumption of data traffic, and a fourth power consumption parameter corresponding to the power consumption of a positioning module by using the power consumption information class object and the system file corresponding to the operating system includes:
obtaining an attribute through the processor cluster step frequency corresponding to the power consumption information class object, determining the processor cluster step frequency, and obtaining the attribute through the unit processor power consumption corresponding to the power consumption information class object, and determining the processor power consumption of the unit operation time;
obtaining attributes through unit power consumption corresponding to the power consumption information class object, and determining the power consumption of the unit network flow, the power consumption of the unit data flow and the power consumption of the unit positioning time;
analyzing a system file corresponding to the operating system to obtain the total service time of the processor cluster, the network flow, the data flow and the positioning time of the positioning module;
determining the power consumption of the application according to the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption comprises:
and determining the sum of the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module as the power consumption of the application program.
A3, the method as in A2, wherein the determining the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption corresponding to the application according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter respectively includes:
determining the power consumption of the processor used by the application program according to the step frequency of the processor cluster, the power consumption of the processor in the unit running time and the total use time of the processor cluster;
determining the network flow power consumption of the application program according to the network flow and the power consumption of the unit network flow;
determining the data flow power consumption of the application program according to the data flow and the power consumption of the unit data flow;
and determining the power consumption of the positioning module according to the positioning time length and the power consumption of the unit positioning time.
A4, the method of A3, wherein the determining the processor power consumption used by the application program according to the processor cluster step count number, the processor power consumption per unit runtime, and the total usage duration of the processor cluster comprises:
determining the quotient of the total using time length of the processor cluster and the total step frequency of the processor cluster as the processor running time of unit step frequency;
determining the processor power consumption of each stride frequency under each processor cluster by taking the product of the processor running time of the unit stride frequency and the processor power consumption of the unit running time;
and determining the sum of the power consumption of the processors of each step frequency under each processor cluster as the power consumption of the processor used by the application program.
A5, the method of A3, wherein the determining the network traffic power consumption of the application based on the network traffic and the power consumption per unit network traffic comprises:
determining the product of the network flow and the power consumption of the unit network flow as the network flow power consumption of the application program;
determining the data traffic power consumption of the application based on the data traffic and the power consumption per data traffic comprises:
determining a product of the data traffic and the power consumption per data traffic as the data traffic power consumption of the application;
the determining the power consumption of the positioning module according to the positioning duration and the power consumption of the unit positioning time comprises:
and determining the product of the positioning time length and the power consumption of the unit positioning time as the power consumption of the positioning module.
A6, the method as in a2, where the analyzing the system file corresponding to the operating system to obtain the total usage duration of the processor cluster includes:
analyzing a system file corresponding to the operating system to obtain a first running time of the process of the application program in the processor cluster user state, a second running time of the processor cluster kernel state, a third running time of all dead threads in the processor cluster user state, and a fourth running time of all dead threads in the processor cluster kernel state;
determining the sum of the first running time, the second running time, the third running time and the fourth running time as the total using time of the processor cluster.
A7, the method as in a2, where the parsing the system file corresponding to the operating system to obtain the positioning duration of the positioning module includes:
analyzing the system file corresponding to the operating system to obtain first calling time for calling a preset positioning updating request function and second calling time for calling a preset positioning updating release function when a positioning module corresponding to the application program runs;
and determining the difference between the second calling time and the first calling time as the positioning duration of the positioning module.
A8, the method of any one of A1-A7, further comprising, after determining the power consumption of the application:
and transmitting the power consumption of the application program to a preset database so that the preset database can generate a power consumption performance analysis report corresponding to the application program according to the operating system version corresponding to the application program, the corresponding terminal equipment type and the power consumption.
B9, an apparatus for determining power consumption of an application, comprising:
the reflection unit is used for performing reflection processing on the internal power consumption information class of the operating system where the application program is located to obtain a power consumption information class object;
the analysis unit is used for analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network flow, a third power consumption parameter corresponding to data flow and a fourth power consumption parameter corresponding to the positioning module through the power consumption information class object reflected by the reflection unit and a system file corresponding to the operating system;
a first determining unit, configured to determine, according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter analyzed by the analyzing unit, a processor power consumption, a network traffic power consumption, a data traffic power consumption, and a positioning module power consumption corresponding to the application program, respectively;
and the second determining unit is used for determining the power consumption of the application program according to the power consumption of the processor, the power consumption of the network flow, the power consumption of the data flow and the power consumption of the positioning module determined by the first determining unit.
The apparatus of B10, according to B9, where the first power consumption parameter includes a processor cluster step frequency corresponding to each processor cluster used by the application, a processor power consumption per unit running time of each step frequency of each processor cluster, and a total usage duration of the processor cluster corresponding to the application, the second power consumption parameter includes a power consumption per unit network traffic and a network traffic, the third power consumption parameter includes a power consumption per unit data traffic and a data traffic, the fourth power consumption parameter includes a power consumption per unit positioning time and a positioning module positioning duration, and the parsing unit includes:
a first determining module, configured to determine the processor cluster step frequency number by obtaining an attribute of the processor cluster step frequency corresponding to the power consumption information class object, and determine the processor power consumption of the unit running time by obtaining an attribute of the unit processor power consumption corresponding to the power consumption information class object;
a second determining module, configured to determine, according to a unit power consumption obtaining attribute corresponding to the power consumption information class object, a power consumption of the unit network traffic, a power consumption of the unit data traffic, and a power consumption of the unit positioning time;
the analysis module is used for analyzing the system file corresponding to the operating system to obtain the total service time of the processor cluster, the network flow, the data flow and the positioning time of the positioning module;
the second determining unit is specifically configured to determine a sum of the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption as the power consumption of the application.
B11, the apparatus as described in B10, the first determining unit comprising:
a third determining module, configured to determine, according to the step count of the processor cluster, the power consumption of the unit runtime, and a total usage duration of the processor cluster, the power consumption of the processor used by the application;
the fourth determining module is used for determining the network flow power consumption of the application program according to the network flow and the power consumption of the unit network flow;
a fifth determining module, configured to determine a data traffic power consumption of the application according to the data traffic and the power consumption of the unit data traffic;
and the sixth determining module is used for determining the power consumption of the positioning module according to the positioning time length and the power consumption of the unit positioning time.
B12, the apparatus of B11, the third determining module comprising:
the first determining submodule is used for determining the quotient of the total using time length of the processor cluster and the total step frequency of the processor cluster as the processor running time of unit step frequency;
a second determining submodule, configured to determine a processor power consumption amount of each stride frequency under each processor cluster according to a product of the processor running time of the unit stride frequency determined by the first determining submodule and the processor power consumption amount of the unit running time;
and a third determining submodule, configured to determine, as the power consumption amount of the processor used by the application program, a sum of the power consumption amounts of the processors of the respective step frequencies in the respective processor clusters determined by the second determining submodule.
B13, device according to B11,
the fourth determining module is specifically configured to determine a product of the network traffic and the power consumption of the unit network traffic as the network traffic power consumption of the application;
the fifth determining module is specifically configured to determine a product of the data traffic and the power consumption of the unit data traffic as the data traffic power consumption of the application;
the sixth determining module is specifically configured to determine a product of the positioning duration and the power consumption of the unit positioning time as the power consumption of the positioning module.
B14, the apparatus as in B10, the parsing module comprising:
the first analysis submodule is used for analyzing the system file corresponding to the operating system to obtain first running time of the process of the application program in the processor cluster user state, second running time of the processor cluster kernel state, third running time of all dead threads in the processor cluster user state and fourth running time of all dead threads in the processor cluster kernel state;
a fourth determining submodule, configured to determine a sum of the first running time, the second running time, the third running time, and the fourth running time as a total usage duration of the processor cluster.
B15, the apparatus as in B10, the parsing module comprising:
the second analysis submodule is used for analyzing the system file corresponding to the operating system to obtain first calling time for calling a preset positioning updating request function and second calling time for calling a preset positioning updating release function when the positioning module corresponding to the application program runs;
and the fifth determining submodule is used for determining the difference between the second calling time and the first calling time as the positioning time length of the positioning module.
A device according to any one of B16, B9-B15, further comprising:
and the transmission unit is used for transmitting the electric quantity consumption of the application program to a preset database so that the preset database can generate a power consumption performance analysis report corresponding to the application program according to the operating system version corresponding to the application program, the corresponding terminal equipment type and the electric quantity consumption.
C17, a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
D18, an apparatus for determining power consumption of an application, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps when executing the program:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
and determining the power consumption of the application program according to the power consumption of the processor, the network flow power consumption, the data flow power consumption and the power consumption of the positioning module.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the power consumption determining device of an application program according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (10)

1. A method for determining power consumption of an application, comprising:
performing reflection processing on internal power consumption information of an operating system where an application program is located to obtain a power consumption information object;
analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic and a fourth power consumption parameter corresponding to a positioning module through the power consumption information class object and a system file corresponding to the operating system;
determining the power consumption of a processor, the power consumption of a network flow, the power consumption of a data flow and the power consumption of a positioning module corresponding to the application program according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter and the fourth power consumption parameter;
determining power consumption of the application according to the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption, including:
determining the sum of the processor power consumption, the network traffic power consumption, the data traffic power consumption and the positioning module power consumption as the power consumption of the application; the first power consumption parameter comprises a processor cluster step frequency corresponding to each processor cluster used by the application program, the processor power consumption of unit running time of each step frequency under each processor cluster and the total using duration of the processor cluster corresponding to the application program, the second power consumption parameter comprises the power consumption of unit network traffic and network traffic, the third power consumption parameter comprises the power consumption of unit data traffic and data traffic, and the fourth power consumption parameter comprises the power consumption of unit positioning time and positioning duration of a positioning module; the analyzing, by the power consumption information class object and the system file corresponding to the operating system, a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network traffic, a third power consumption parameter corresponding to data traffic, and a fourth power consumption parameter corresponding to the positioning module includes:
obtaining an attribute through the processor cluster step frequency corresponding to the power consumption information class object, determining the processor cluster step frequency, and obtaining the attribute through the unit processor power consumption corresponding to the power consumption information class object, and determining the processor power consumption of the unit operation time;
obtaining attributes through unit power consumption corresponding to the power consumption information class object, and determining the power consumption of the unit network flow, the power consumption of the unit data flow and the power consumption of the unit positioning time;
analyzing a system file corresponding to the operating system to obtain the total service time of the processor cluster, the network flow, the data flow and the positioning time of the positioning module; wherein the determining, according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter, the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption corresponding to the application program respectively includes:
determining the power consumption of the processor used by the application program according to the step frequency of the processor cluster, the power consumption of the processor in the unit running time and the total use time of the processor cluster;
determining the network flow power consumption of the application program according to the network flow and the power consumption of the unit network flow;
determining the data flow power consumption of the application program according to the data flow and the power consumption of the unit data flow;
determining the power consumption of the positioning module according to the positioning duration and the power consumption of the unit positioning time; wherein the determining the power consumption of the processor used by the application program according to the step frequency number of the processor cluster, the power consumption of the processor in the unit running time and the total using time of the processor cluster comprises:
determining the quotient of the total use time of the processor cluster and the step frequency of the processor cluster as the processor running time of unit step frequency;
determining the processor power consumption of each stride frequency under each processor cluster by taking the product of the processor running time of the unit stride frequency and the processor power consumption of the unit running time;
determining the sum of the power consumption of the processors of each step frequency under each processor cluster as the power consumption of the processors used by the application program; wherein the determining the network traffic power consumption of the application according to the network traffic and the power consumption of the unit network traffic comprises:
determining the product of the network flow and the power consumption of the unit network flow as the network flow power consumption of the application program;
determining the data traffic power consumption of the application based on the data traffic and the power consumption per data traffic comprises:
determining a product of the data traffic and the power consumption per data traffic as the data traffic power consumption of the application;
the determining the power consumption of the positioning module according to the positioning duration and the power consumption of the unit positioning time comprises:
and determining the product of the positioning time length and the power consumption of the unit positioning time as the power consumption of the positioning module.
2. The method of claim 1, wherein the analyzing the system file corresponding to the operating system to obtain the total usage duration of the processor cluster comprises:
analyzing the system file corresponding to the operating system to obtain a first running time of the process of the application program in a processor cluster user mode, a second running time of the processor cluster kernel mode, a third running time of all dead threads in the processor cluster user mode and a fourth running time of all dead threads in the processor cluster kernel mode;
determining the sum of the first running time, the second running time, the third running time and the fourth running time as the total using time of the processor cluster.
3. The method of claim 1, wherein the analyzing the system file corresponding to the operating system to obtain the positioning duration of the positioning module comprises:
analyzing the system file corresponding to the operating system to obtain first calling time for calling a preset positioning updating request function and second calling time for calling a preset positioning updating release function when a positioning module corresponding to the application program runs;
and determining the difference between the second calling time and the first calling time as the positioning time length of the positioning module.
4. The method of any of claims 1-3, wherein after determining the power consumption of the application, the method further comprises:
and transmitting the power consumption of the application program to a preset database so that the preset database can generate a power consumption performance analysis report corresponding to the application program according to the operating system version corresponding to the application program, the corresponding terminal equipment type and the power consumption.
5. An apparatus for determining power consumption of an application, comprising:
the reflection unit is used for performing reflection processing on the internal power consumption information class of the operating system where the application program is located to obtain a power consumption information class object;
the analysis unit is used for analyzing a first power consumption parameter corresponding to a processor used by the application program, a second power consumption parameter corresponding to network flow, a third power consumption parameter corresponding to data flow and a fourth power consumption parameter corresponding to the positioning module through the power consumption information class object reflected by the reflection unit and a system file corresponding to the operating system;
a first determining unit, configured to determine, according to the first power consumption parameter, the second power consumption parameter, the third power consumption parameter, and the fourth power consumption parameter analyzed by the analyzing unit, a processor power consumption, a network traffic power consumption, a data traffic power consumption, and a positioning module power consumption corresponding to the application program, respectively;
a second determining unit, configured to determine power consumption of the application according to the power consumption of the processor, the power consumption of the network traffic, the power consumption of the data traffic, and the power consumption of the positioning module determined by the first determining unit;
the second determining unit is specifically configured to determine a sum of the processor power consumption, the network traffic power consumption, the data traffic power consumption, and the positioning module power consumption as the power consumption of the application; the first power consumption parameter includes a processor cluster step frequency corresponding to each processor cluster used by the application program, a processor power consumption of unit running time of each step frequency under each processor cluster, and a total usage duration of the processor cluster corresponding to the application program, the second power consumption parameter includes a power consumption of unit network traffic and network traffic, the third power consumption parameter includes a power consumption of unit data traffic and data traffic, the fourth power consumption parameter includes a power consumption of unit positioning time and positioning duration of a positioning module, and the analysis unit includes:
a first determining module, configured to determine the processor cluster step frequency number by obtaining an attribute of the processor cluster step frequency corresponding to the power consumption information class object, and determine the processor power consumption of the unit running time by obtaining an attribute of the unit processor power consumption corresponding to the power consumption information class object;
a second determining module, configured to determine, according to a unit power consumption obtaining attribute corresponding to the power consumption information class object, a power consumption of the unit network traffic, a power consumption of the unit data traffic, and a power consumption of the unit positioning time;
the analysis module is used for analyzing the system file corresponding to the operating system to obtain the total service time of the processor cluster, the network flow, the data flow and the positioning time of the positioning module;
wherein the first determination unit includes:
a third determining module, configured to determine, according to the step count of the processor cluster, the power consumption of the unit runtime, and a total usage duration of the processor cluster, the power consumption of the processor used by the application;
the fourth determining module is used for determining the network flow power consumption of the application program according to the network flow and the power consumption of the unit network flow;
a fifth determining module, configured to determine a data traffic power consumption of the application according to the data traffic and the power consumption of the unit data traffic;
a sixth determining module, configured to determine the power consumption of the positioning module according to the positioning duration and the power consumption of the unit positioning time; wherein the third determining module comprises:
the first determining submodule is used for determining the quotient of the total using time length of the processor cluster and the step frequency number of the processor cluster as the processor running time of unit step frequency;
a second determining submodule, configured to determine a processor power consumption amount of each stride frequency under each processor cluster according to a product of the processor running time of the unit stride frequency determined by the first determining submodule and the processor power consumption amount of the unit running time;
a third determining submodule, configured to determine a sum of the processor power consumptions of the respective step frequencies in the respective processor clusters determined by the second determining submodule as the processor power consumption used by the application program;
the fourth determining module is specifically configured to determine a product of the network traffic and the power consumption of the unit network traffic as the network traffic power consumption of the application;
the fifth determining module is specifically configured to determine a product of the data traffic and the power consumption of the unit data traffic as the data traffic power consumption of the application;
the sixth determining module is specifically configured to determine a product of the positioning duration and the power consumption of the unit positioning time as the power consumption of the positioning module.
6. The apparatus of claim 5, wherein the parsing module comprises:
the first analysis submodule is used for analyzing the system file corresponding to the operating system to obtain first running time of the process of the application program in a processor cluster user state, second running time of the processor cluster kernel state, third running time of all dead threads in the processor cluster user state and fourth running time of all dead threads in the processor cluster kernel state;
a fourth determining submodule, configured to determine a sum of the first running time, the second running time, the third running time, and the fourth running time as a total usage duration of the processor cluster.
7. The apparatus of claim 5, wherein the parsing module comprises:
the second analysis submodule is used for analyzing the system file corresponding to the operating system to obtain first calling time for calling a preset positioning updating request function and second calling time for calling a preset positioning updating release function when the positioning module corresponding to the application program runs;
and the fifth determining submodule is used for determining the difference between the second calling time and the first calling time as the positioning time length of the positioning module.
8. The apparatus of any of claims 5-7, further comprising:
and the transmission unit is used for transmitting the electric quantity consumption of the application program to a preset database so that the preset database can generate a power consumption performance analysis report corresponding to the application program according to the operating system version corresponding to the application program, the corresponding terminal equipment type and the electric quantity consumption.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of claim 1.
10. A power consumption determining apparatus for an application program comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of claim 1 when executing the program.
CN201710392496.5A 2017-05-27 2017-05-27 Method and device for determining electric quantity consumption of application program Expired - Fee Related CN107220160B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710392496.5A CN107220160B (en) 2017-05-27 2017-05-27 Method and device for determining electric quantity consumption of application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710392496.5A CN107220160B (en) 2017-05-27 2017-05-27 Method and device for determining electric quantity consumption of application program

Publications (2)

Publication Number Publication Date
CN107220160A CN107220160A (en) 2017-09-29
CN107220160B true CN107220160B (en) 2021-01-15

Family

ID=59946937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710392496.5A Expired - Fee Related CN107220160B (en) 2017-05-27 2017-05-27 Method and device for determining electric quantity consumption of application program

Country Status (1)

Country Link
CN (1) CN107220160B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108989548A (en) * 2018-06-21 2018-12-11 上海二三四五网络科技有限公司 A kind of control method and control device detecting mobile terminal application power consumption
CN109460337A (en) * 2018-09-20 2019-03-12 艾普有限公司 Power consumption quantity monitoring method, device, equipment and its storage medium
CN111628902B (en) * 2019-02-28 2022-10-04 腾讯科技(深圳)有限公司 Rate testing method and apparatus, electronic device, and computer-readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104516806A (en) * 2014-12-26 2015-04-15 北京奇虎科技有限公司 Power consumption information detection result display method and system for mobile terminal
CN104603753A (en) * 2014-03-19 2015-05-06 华为技术有限公司 Method, system and server for recommending application
CN106028428A (en) * 2016-04-27 2016-10-12 努比亚技术有限公司 Information processing method and mobile terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104603753A (en) * 2014-03-19 2015-05-06 华为技术有限公司 Method, system and server for recommending application
CN104516806A (en) * 2014-12-26 2015-04-15 北京奇虎科技有限公司 Power consumption information detection result display method and system for mobile terminal
CN106028428A (en) * 2016-04-27 2016-10-12 努比亚技术有限公司 Information processing method and mobile terminal

Also Published As

Publication number Publication date
CN107220160A (en) 2017-09-29

Similar Documents

Publication Publication Date Title
Carette et al. Investigating the energy impact of android smells
US20060130056A1 (en) Determining software deployment parameters
CN106202324B (en) Data processing method and device for real-time computing platform
US20140156683A1 (en) Integrating event processing with map-reduce
CN107220160B (en) Method and device for determining electric quantity consumption of application program
Popescu et al. Predict: towards predicting the runtime of large scale iterative analytics
CN107436840A (en) Application program analysis of running performance method, apparatus and system
CN110750433A (en) Interface test method and device
CN110609689A (en) Application installation and operation method and device
US8789033B2 (en) Reducing application startup time by optimizing spatial locality of instructions in executables
CN107391528B (en) Front-end component dependent information searching method and equipment
CN110955438A (en) Method, device and equipment for monitoring performance of small program and storage medium
CN111782490A (en) Data acquisition method and device
US9367307B2 (en) Staged points-to analysis for large code bases
EP1704475B1 (en) System and method for dynamically optimized message processing
CN108959294B (en) Method and device for accessing search engine
CN112559525A (en) Data checking system, method, device and server
CN113126994A (en) Hotspot code processing method and device, electronic equipment and storage medium
Huang et al. Change-patterns mapping: A boosting way for change impact analysis
CN106844415B (en) Data processing method and device in spark SQL system
US20140244642A1 (en) Data partioning based on end user behavior
CN108780452A (en) A kind of storing process processing method and processing device
CN112015714A (en) Database-based data model generation method and device
CN109597941A (en) Sorting method and device, electronic equipment and storage medium
CN106156210A (en) A kind of method and apparatus determining application identities list of matches

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210115