CN114168432B - Application program power consumption detection method and device, electronic equipment and storage medium - Google Patents

Application program power consumption detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114168432B
CN114168432B CN202210127015.9A CN202210127015A CN114168432B CN 114168432 B CN114168432 B CN 114168432B CN 202210127015 A CN202210127015 A CN 202210127015A CN 114168432 B CN114168432 B CN 114168432B
Authority
CN
China
Prior art keywords
test
application program
power consumption
wireless terminal
consumption detection
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.)
Active
Application number
CN202210127015.9A
Other languages
Chinese (zh)
Other versions
CN114168432A (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.)
Weizhun Beijing Electronic Technology Co ltd
Original Assignee
Weizhun Beijing Electronic 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 Weizhun Beijing Electronic Technology Co ltd filed Critical Weizhun Beijing Electronic Technology Co ltd
Priority to CN202210127015.9A priority Critical patent/CN114168432B/en
Publication of CN114168432A publication Critical patent/CN114168432A/en
Application granted granted Critical
Publication of CN114168432B publication Critical patent/CN114168432B/en
Active 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/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

Abstract

The disclosure provides a power consumption detection method and device for an application program, an electronic device and a storage medium. The method comprises the following steps: receiving a power consumption detection request, generating a test instruction according to the power consumption detection request, and sending the test instruction to the wireless terminal, wherein the test instruction comprises an identifier of an application program to be detected; responding to the test instruction, calling a test script according to the identification of the application program, wherein the test script comprises test operation preset for the application program; generating test content based on test operation in the test script, generating test packets according to the test content, and testing the wireless terminal according to the test packets and the test content in the test packets so as to control the test equipment to collect voltage data of the wireless terminal according to the test content; and according to the voltage data acquired in the preset time period, carrying out power consumption detection on the application program installed in the wireless terminal. The power consumption detection method and the power consumption detection device increase the flexibility of power consumption detection and improve the application range of the power consumption detection in different scenes.

Description

Application program power consumption detection method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of power consumption detection technologies, and in particular, to a power consumption detection method and apparatus for an application program, an electronic device, and a storage medium.
Background
With the development of wireless communication technology and wireless terminals, the functions of wireless terminal equipment are increasingly powerful, richer business services can be provided for users, and personalized services are also recognized by users. A large number of applications are usually installed in a wireless terminal, and the applications generate power consumption in both a standby state and a use state, and the power consumption of the wireless terminal is one of important indexes for measuring the performance of the wireless terminal. Therefore, how to accurately and efficiently test the power consumption of the application program installed in the wireless terminal is of great significance to the research and development of the wireless terminal and the performance improvement of the application program.
In the prior art, when detecting power consumption of an application program in a wireless terminal (such as a mobile terminal), an integrated tester is usually used to simulate an external network environment, so as to detect a current generated by the wireless terminal when the application program is in a standby state. However, the conventional detection method can only detect a single scene and state, for example, only detect a wireless terminal in a standby state. However, the operation mode and test state of the wireless terminal and the application program are complicated, and the power consumption of the application program changes in real time under the mutual influence of different modes and states. Therefore, the existing power consumption detection mode in a single state is difficult to accurately evaluate the actual power consumption of the application program under different conditions, so that the existing power consumption detection result is single, the dynamic change process of the power consumption cannot be embodied, the diversified detection requirements of a user on the application program cannot be met, and the application range is narrow.
Disclosure of Invention
In view of this, embodiments of the present disclosure provide a power consumption detection method and apparatus for an application program, an electronic device, and a storage medium, so as to solve the problems that in the prior art, a power consumption detection result is single, a dynamic change process of power consumption cannot be embodied, a diversified detection requirement of a user on the application program cannot be met, and an application range is narrow.
In a first aspect of the embodiments of the present disclosure, a method for detecting power consumption of an application program is provided, including: receiving a power consumption detection request, generating a test instruction according to the power consumption detection request, and sending the test instruction to the wireless terminal, wherein the test instruction comprises an identifier corresponding to an application program to be detected; responding to the test instruction, calling a test script according to the identification of the application program, wherein the test script comprises test operation preset for the application program; generating test contents based on the test operation in the test script, generating test groups according to the test contents, and testing the wireless terminal according to the test groups and the test contents in the test groups so as to control the test equipment to collect the voltage data of the wireless terminal according to the test contents; and according to the voltage data acquired in the preset time period, carrying out power consumption detection on the application program installed in the wireless terminal.
In a second aspect of the embodiments of the present disclosure, there is provided a power consumption detection apparatus for an application program, including: the receiving module is configured to receive the power consumption detection request, generate a test instruction according to the power consumption detection request, and send the test instruction to the wireless terminal, wherein the test instruction comprises an identifier corresponding to the application program to be detected; the calling module is configured to respond to the test instruction and call a test script according to the identification of the application program, and the test script comprises test operation preset for the application program; the acquisition module is configured to generate test contents based on the test operation in the test script, generate test packets according to the test contents, and test the wireless terminal according to the test packets and the test contents in the test packets so as to control the test equipment to acquire the voltage data of the wireless terminal according to the test contents; the detection module is configured to perform power consumption detection on the application program installed in the wireless terminal according to the voltage data collected within the preset time period.
In a third aspect of the embodiments of the present disclosure, an electronic device is provided, which includes a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method when executing the program.
In a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, which when executed by a processor, implements the steps of the above-mentioned method.
The embodiment of the present disclosure adopts at least one technical scheme that can achieve the following beneficial effects:
generating a test instruction according to the power consumption detection request by receiving the power consumption detection request, and sending the test instruction to the wireless terminal, wherein the test instruction comprises an identifier corresponding to an application program to be detected; responding to the test instruction, calling a test script according to the identification of the application program, wherein the test script comprises test operation preset for the application program; generating test contents based on test operations in the test script, generating test packets according to the test contents, and testing the wireless terminal according to the test packets and the test contents in the test packets so as to control the test equipment to collect voltage data of the wireless terminal according to the test contents; and according to the voltage data acquired in the preset time period, carrying out power consumption detection on the application program installed in the wireless terminal. According to the method and the device, different test contents can be generated for different application programs, the test contents have different test modes, and therefore the power consumption detection requirements of users on the application programs in the different test modes are met based on a packetization mode, the flexibility of power consumption detection is increased, and the application range of the power consumption detection in different scenes can be expanded.
Drawings
To more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without inventive efforts.
FIG. 1 is a schematic diagram of the overall architecture of a system involved in an actual application scenario in accordance with an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating a power consumption detection method for an application according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a power consumption detection apparatus for an application program according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the disclosed embodiments. However, it will be apparent to one skilled in the art that the present disclosure may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present disclosure with unnecessary detail.
As described above, with the development of wireless communication technology and wireless terminals, the functions of wireless terminal devices are increasingly powerful, and more abundant service services can be provided for users, and personalized services are also recognized by users. A large number of applications are usually installed in a wireless terminal, and the applications generate power consumption in both a standby state and a use state, and the power consumption of the wireless terminal is one of important indexes for measuring the performance of the wireless terminal. Therefore, how to accurately and efficiently test the power consumption of the application program installed in the wireless terminal is of great significance to the research and development of the wireless terminal and the performance improvement of the application program. The following describes in detail a power consumption detection method and existing problems for an application program by taking a mobile terminal in a wireless terminal device as an example, and specifically includes the following steps:
with the expansion of mobile terminal services, hardware and software functions of a mobile terminal become more and more rich, for example, with the development of 5G communication technology, the performance of a wireless communication module of the mobile terminal becomes more powerful, and in addition, with the innovation of application services, application programs on the mobile terminal are developed in a large amount, and more application programs are installed on the mobile terminal by users. Therefore, how to consider how to detect the power consumption of the application program of the mobile terminal under different hardware and software conditions, and perform all-around detection on the power consumption of the application program based on different test contents and test modes is a challenge for the prior art.
The existing power consumption detection aiming at an application program in a mobile terminal can only be detected in a single scene or state, and the test content and the test mode cannot be adjusted individually and flexibly. For example, in a prior art, when detecting power consumption of an application installed in a mobile terminal, the corresponding application needs to be installed in the mobile terminal, and a comprehensive tester is used to detect a current of the mobile terminal in a standby state for a period of time, so as to determine the power consumption of the application; in another prior art, a current test under random events is performed on an application program by a tool running in a simulator or a terminal device, and sending a pseudo-random user event stream to a system by using the tool. However, the detection mode needs manual design of user events, different events generate different current test results, and the test is performed by depending on manual experience, so that automatic detection cannot be realized, and the efficiency and accuracy of power consumption detection are reduced.
As can be seen from the above prior art, the conventional power consumption detection method for an application program is to test the current of a mobile terminal in a single mode or state (e.g., a standby state), so as to use the obtained current test result as the power consumption of the application program. However, this simple method cannot implement power consumption detection under complex conditions, for example, when the mobile terminal and the application program are affected by different test modes, test contents, test states, and the like, the real power consumption cannot be accurately detected, and the power consumption cannot be accurately evaluated. Therefore, the existing current testing method based on a single mode cannot detect the power consumption condition of the application program in an all-around manner, and the detection result is relatively single, so that the actual power consumption condition of the application program cannot be accurately measured, the accuracy of the detection result is relatively poor, and the application range of the detection method is relatively narrow.
In view of the problems in the prior art, the present disclosure provides a method and system for generating different test contents based on different applications, where the test contents have different test modes, so as to satisfy the power consumption detection requirements of users on the applications in different test modes based on a packetized manner, and automatically generate the power consumption condition corresponding to each moment in the detection process, thereby not only increasing the flexibility of power consumption detection, but also facilitating the users to observe the power consumption change in the whole detection process, and improving the accuracy and practicability of the power consumption detection result.
The overall architecture of the system according to the embodiment of the present disclosure is described below with reference to the accompanying drawings, and fig. 1 is a schematic diagram of the overall architecture of the system according to the embodiment of the present disclosure in an actual application scenario. As shown in fig. 1, the overall architecture of the system involved in the power consumption detection of the wireless terminal may specifically include:
the overall system architecture according to the embodiment of the present disclosure mainly includes a wireless terminal 101, an integrated tester 102, a test resistor 103, and a voltage data collector 104, where the wireless terminal 101 may include a mobile terminal, and the mobile terminal includes but is not limited to: the mobile terminal or the computer terminal supports touch screen operation, such as a smart phone, a tablet computer and a notebook computer. The integrated tester 102 has the simulation function of the 5G base station, and the wireless terminal 101 can be connected with the integrated tester 102 through a radio frequency cable. The test resistor 103 is disposed on a test circuit of the wireless terminal 101, and the voltage data collector 104 can collect a voltage value of the test resistor 103. In practical application, the above system overall architecture may further include an upper computer controller 105, where the upper computer controller 105 is connected to the comprehensive tester 102 through a network cable, and the comprehensive tester 102 is controlled by the network cable, or may be connected to the comprehensive tester 102 through a GPIB control line, so as to control the comprehensive tester 102.
It should be noted that, in the following embodiments of the present disclosure, a mobile terminal (for example, a mobile phone) is taken as an example, and a power consumption detection process of an application installed in the mobile terminal in different test modes and test states is described in detail, however, a device to be detected in the embodiments of the present disclosure is not limited to the mobile terminal, nor to the application in the mobile terminal. The embodiment of the present disclosure can also detect power consumption conditions of application programs in various different modes and states, and the following application scenarios of the embodiment of the present disclosure do not constitute limitations on the technical solution of the present disclosure.
Fig. 2 is a flowchart illustrating a power consumption detection method of a wireless terminal according to an embodiment of the present disclosure. The power consumption detection method of the wireless terminal of fig. 2 may be performed by the integrated tester, the upper computer controller, or a separate computer device. As shown in fig. 2, the method for detecting power consumption of a wireless terminal may specifically include:
s201, receiving a power consumption detection request, generating a test instruction according to the power consumption detection request, and sending the test instruction to the wireless terminal, wherein the test instruction comprises an identifier corresponding to an application program to be detected;
s202, responding to a test instruction, calling a test script according to the identification of the application program, wherein the test script comprises test operation preset for the application program;
s203, generating test contents based on the test operation in the test script, generating test groups according to the test contents, and testing the wireless terminal according to the test groups and the test contents in the test groups so as to control the test equipment to collect voltage data of the wireless terminal according to the test contents;
and S204, performing power consumption detection on the application program installed in the wireless terminal according to the voltage data acquired in the preset time period.
Specifically, the power consumption detection request in the embodiment of the present disclosure may be a request sent by a user through a user terminal, and the power consumption detection request may include identification information of an application program to be detected and related test parameters for building a test environment. The test script can be regarded as a test data set configured for the application to be detected in advance, the test script comprises some calling functions, and the calling functions can be used for calling the application program file, so that the test operation of the application program is simulated.
Furthermore, each application installed in the mobile terminal may correspond to one test item, and each test item may include multiple test contents, that is, power consumption detection of different test contents may be performed for the same application. Because the test types corresponding to different test contents are different, in practical application, in order to perform a certain type of detection task, the test contents can be divided according to the test types, so that the power consumption detection is determined in which test mode. Based on grouping different test contents and carrying out power consumption detection of different models according to the grouping, the omnibearing and diversified application program detection can be realized, and the accuracy and the practicability of a detection result are ensured.
Further, the embodiment of the disclosure performs grouping according to different test contents, and performs voltage detection on the test resistor connected in series to the test circuit in the test mode corresponding to the test grouping, so as to calculate the power consumption of the application program in the mobile terminal based on the voltage data in the preset time period. It can be understood that, in addition to collecting the voltage data, the current data in the multimeter can be directly collected, and the power consumption of the application program of the mobile terminal in the test mode can be determined based on the current data and the detection time. Therefore, whether the actually acquired data is voltage data or current data does not limit the technical scheme of the disclosure.
According to the technical scheme provided by the embodiment of the disclosure, a power consumption detection request is received, a test instruction is generated according to the power consumption detection request, and the test instruction is sent to the wireless terminal, wherein the test instruction comprises an identifier corresponding to an application program to be detected; responding to the test instruction, calling a test script according to the identification of the application program, wherein the test script comprises test operation preset for the application program; generating test contents based on the test operation in the test script, generating test groups according to the test contents, and testing the wireless terminal according to the test groups and the test contents in the test groups so as to control the test equipment to collect the voltage data of the wireless terminal according to the test contents; and according to the voltage data acquired in the preset time period, carrying out power consumption detection on the application program installed in the wireless terminal. According to the method and the device, different test contents can be generated for different application programs, the test contents have different test modes, and therefore the power consumption detection requirements of users on the application programs in the different test modes are met based on a packetization mode, the flexibility of power consumption detection is increased, and the application range of the power consumption detection in different scenes can be expanded.
In some embodiments, receiving a power consumption detection request, and generating a test instruction according to the power consumption detection request includes: receiving a power consumption detection request, executing analysis operation on the power consumption detection request to obtain an identifier and a test parameter of an application program, and generating a test instruction according to the identifier and the test parameter of the application program; the testing parameters comprise parameters corresponding to testing equipment in the testing system, and the testing equipment comprises a comprehensive tester, a testing resistor, a voltage data collector, an upper computer controller and a VGA displayer.
Specifically, the identifier of the application refers to information for uniquely identifying the application installed in the mobile terminal, and the identifier of the application may include a name of the application, installation location information, and the like. The test parameters can be considered as related parameters for configuring the mobile terminal, the comprehensive tester and other devices in the test system, and the parameters of the mobile terminal and the comprehensive tester can be reset into parameters meeting corresponding test contents and test conditions by using the test parameters.
Furthermore, besides the integrated tester, the test resistor, the voltage data collector, the upper computer controller, and the test device such as the VGA display, the test system may further include the following devices: program-controlled power supply, attenuator, GPIB bus, etc. The integrated tester may be used to simulate the test network, for example, the related parameters of the test network simulated by the integrated tester may be set according to the test parameters, such as setting the test frequency band, the signal power, the test time, and the like.
In some embodiments, invoking a test script according to the identification of the application in response to the test instruction comprises: acquiring an identifier of an application program carried in a test instruction, and calling a test script which is configured in advance and corresponds to the identifier of the application program according to the identifier of the application program so as to enable the test script to perform power consumption detection on the application program according to a preset test operation, wherein the test script comprises one or more test operations.
Specifically, the test script refers to a test data set configured for the application to be detected in advance, and the test script includes some call functions, and the call functions can be used to call the application program file, so as to simulate the test operation on the application program. Each application program corresponds to one test script, one test script can contain various test operations, and a calling function in the test script can be regarded as a function corresponding to an API (application programming interface) of the application program.
Furthermore, the process of the test task can be monitored through the test script to judge whether the power consumption test task of the application program is finished or not, so that the program control power supply is controlled to be closed.
Furthermore, the test instruction may include a test priority corresponding to each application program in addition to the identifier corresponding to the application program, and the test script of the application program is sequentially called according to the test priority. In practical applications, the test scripts may be pre-stored in the test system, each test script corresponds to an identifier of at least one application program, and of course, one application program may correspond to a plurality of test scripts. When the test instruction comprises the identifications of the plurality of application programs, the corresponding test script can be called from the test system according to the test priority of the application programs.
In some embodiments, generating test content based on test operations in a test script and generating test packets according to the test content comprises: and according to the test type corresponding to the test operation, obtaining the test content corresponding to the test type from a pre-configured test content database, and dividing the test content according to the test type to obtain the test group corresponding to the test content.
Specifically, each test operation corresponds to a test content, and the test content refers to what tests are performed on the application program, such as a standby current test in a standby state, a standby current test in a bright screen state, and the like. The mapping relation between the test type and the test content is stored in a pre-configured test content database, and the corresponding test content can be searched according to the type of the test operation.
Further, in order to implement testing of the test contents in different test modes, the test contents may be grouped according to the types of the test contents, and different test groups may be generated according to the test contents. Here, one test packet may contain the same type of test content, for example, test content in all standby states is divided into the same group, and test content in all bright screen states is divided into the same group.
In some embodiments, testing a wireless terminal according to a test packet and test content in the test packet includes: according to the test grouping, matching a corresponding test mode for the test grouping, and acquiring voltage data of the wireless terminal according to the test content under the test condition corresponding to the test mode; the test modes comprise a running test mode, a standby test mode, a bright screen test mode and a simulation operation mode.
Specifically, after obtaining a plurality of test packets, a corresponding test pattern is set for each test packet, so as to detect the power consumption of the application program according to different test patterns. In practical applications, the test modes may be some pre-configured modes, and each test mode corresponds to a different test condition.
Further, since the test conditions corresponding to different test modes are different, the test environments are necessarily different. For example, taking the operation test mode as an example, the operation test mode of the embodiment of the present disclosure refers to detecting power consumption of an application installed in the mobile terminal during operation, and therefore, the test condition to be generated should include the application as the object to be tested, the operation time (i.e., the detection time), and relevant parameters of the test network (such as whether to turn on the test network, network signal power, frequency band, and the like). The runtime indicates the running time of the application under the above test conditions. Based on the test conditions, the mobile terminal and/or the comprehensive tester are initialized, so that the mobile terminal and/or the comprehensive tester meet the requirements of the test conditions.
In some embodiments, collecting voltage data of the wireless terminal according to the test content under the test condition corresponding to the test mode includes: acquiring voltage data of the wireless terminal based on an application program, running time and relevant parameters of a test network in a running test mode; in a standby test mode, acquiring voltage data of the wireless terminal based on a standby state, standby time and relevant parameters of a test network; under a bright screen test mode, acquiring voltage data of the wireless terminal based on screen brightness, bright screen time and relevant parameters of a test network; acquiring voltage data of the wireless terminal based on an operation object, an operation event, operation time and related parameters of a test network corresponding to the simulation operation in a simulation operation mode; the relevant parameters of the test network comprise parameters when the simulation test network is started, parameters when the simulation test network is closed and parameters when no network test is carried out.
Specifically, the test conditions corresponding to different test modes are different, so that different test processes and test results are generated. Although the power consumption of the application program in the mobile terminal is detected in the embodiments of the present disclosure, since the power consumption of the application program is affected by the hardware of the mobile terminal and other functions (such as a network function), different test conditions need to be integrated to detect the power consumption of the application program.
Further, taking the detection of the power consumption of the application program in the standby test mode as an example, the application program is started first, the screen of the mobile terminal is closed, the voltage value generated by the mobile terminal is obtained within a preset time period (for example, 15 minutes), and the power consumption is calculated according to the voltage value. In addition, in the standby test mode, the network of the mobile terminal may also be set to different test states, such as an actual network test state, a simulated network test state, a no-network test state, and the like.
In some embodiments, the detecting power consumption of an application installed in a wireless terminal according to voltage data collected within a preset time period includes: collecting a voltage value corresponding to each moment of the wireless terminal in a preset time period, and storing the voltage values of continuous moments; and calculating the average current of the wireless terminal in the continuous time according to all the stored voltage values corresponding to the continuous time, calculating the power consumption of the wireless terminal in a preset time period according to the average current and the time, and determining the power consumption as the detection result of the power consumption corresponding to the application program.
Specifically, the time specified by the test condition is a detection time period (also referred to as a detection time), during which the voltage data collector detects a voltage value generated by the mobile terminal at each time (for example, every second), and stores the voltage value at each time during the detection time for subsequent power consumption calculation.
Further, after obtaining all the voltage value data, calculating a current value corresponding to each time according to a calculation formula I = U/R between the voltage and the current, and calculating an average current of the mobile terminal in the detection time by using an average value algorithm according to the current values corresponding to all the times. Based on the average current and the detection time, the power consumption of the wireless terminal in the detection time can be further calculated, and the power consumption is determined as the power consumption of the application program in the current test mode.
Further, in practical application, the average power corresponding to each test mode can be obtained based on the average current in different test modes, so that the standby time of the application program corresponding to the mobile terminal in different modes can be estimated according to the battery capacity, and when the warning time is reached, the warning information is sent.
Further, the obtained average current may be compared with a current threshold, whether the mobile terminal normally operates in the test mode is determined according to the comparison result, and if the mobile terminal is in an abnormal operation state, an alarm message may be sent to the mobile terminal.
Further, after the power consumption detection result of the application program is obtained, the mobile terminal can be controlled to remove the application program file installed in the memory, so that occupied resources are released until the mobile terminal is restored to an idle state. The mobile terminal is restored to the idle state after detection is completed, so that power consumption detection of other application programs is facilitated next time.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
Fig. 3 is a schematic structural diagram of a power consumption detection apparatus for an application program according to an embodiment of the present disclosure. As shown in fig. 3, the power consumption detection device of the application program includes:
the receiving module 301 is configured to receive a power consumption detection request, generate a test instruction according to the power consumption detection request, and send the test instruction to the wireless terminal, where the test instruction includes an identifier corresponding to an application program to be detected;
the calling module 302 is configured to respond to the test instruction and call a test script according to the identifier of the application program, wherein the test script comprises a test operation preset for the application program;
the acquisition module 303 is configured to generate test content based on the test operation in the test script, generate a test packet according to the test content, and test the wireless terminal according to the test packet and the test content in the test packet, so as to control the test equipment to acquire voltage data of the wireless terminal according to the test content;
the detection module 304 is configured to perform power consumption detection on an application installed in the wireless terminal according to the voltage data collected within a preset time period.
In some embodiments, the receiving module 301 in fig. 3 receives the power consumption detection request, performs an analysis operation on the power consumption detection request, obtains an identifier and a test parameter of the application program, and generates a test instruction according to the identifier and the test parameter of the application program; the testing parameters comprise parameters corresponding to testing equipment in the testing system, and the testing equipment comprises a comprehensive tester, a testing resistor, a voltage data collector, an upper computer controller and a VGA displayer.
In some embodiments, the invoking module 302 in fig. 3 obtains an identifier of an application program carried in the test instruction, and invokes a test script corresponding to the identifier of the application program, which is configured in advance, according to the identifier of the application program, so that the test script performs power consumption detection on the application program according to a preset test operation, where the test script includes one or more test operations.
In some embodiments, the acquisition module 303 in fig. 3 obtains test content corresponding to the test type from a pre-configured test content database according to the test type corresponding to the test operation, and divides the test content according to the test type to obtain a test group corresponding to the test content.
In some embodiments, the acquisition module 303 in fig. 3 matches a corresponding test pattern for the test packet according to the test packet, and acquires voltage data of the wireless terminal according to the test content under the test condition corresponding to the test pattern; the test modes comprise a running test mode, a standby test mode, a bright screen test mode and a simulation operation mode.
In some embodiments, the collecting module 303 of fig. 3 collects voltage data of the wireless terminal based on the application program, the running time, and the relevant parameters of the test network in the running test mode; in a standby test mode, acquiring voltage data of the wireless terminal based on a standby state, standby time and relevant parameters of a test network; in the bright screen test mode, acquiring voltage data of the wireless terminal based on screen brightness, bright screen time and related parameters of a test network; in a simulation operation mode, acquiring voltage data of the wireless terminal based on an operation object, an operation event, operation time and related parameters of a test network corresponding to simulation operation; the relevant parameters of the test network comprise parameters when the simulation test network is started, parameters when the simulation test network is closed and parameters when no network test is carried out.
In some embodiments, the detection module 304 of fig. 3 collects a voltage value corresponding to each time of the wireless terminal in a preset time period, and stores voltage values at consecutive times; and calculating the average current of the wireless terminal in the continuous time according to all the stored voltage values corresponding to the continuous time, calculating the power consumption of the wireless terminal in a preset time period according to the average current and the time, and determining the power consumption as the detection result of the power consumption corresponding to the application program.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
Fig. 4 is a schematic structural diagram of the electronic device 4 provided in the embodiment of the present disclosure. As shown in fig. 4, the electronic apparatus 4 of this embodiment includes: a processor 401, a memory 402 and a computer program 403 stored in the memory 402 and executable on the processor 401. The steps in the various method embodiments described above are implemented when the processor 401 executes the computer program 403. Alternatively, the processor 401 implements the functions of the respective modules/units in the above-described respective apparatus embodiments when executing the computer program 403.
Illustratively, the computer program 403 may be partitioned into one or more modules/units, which are stored in the memory 402 and executed by the processor 401 to accomplish the present disclosure. One or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 403 in the electronic device 4.
The electronic device 4 may be a desktop computer, a notebook, a palm computer, a cloud server, or other electronic devices. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that fig. 4 is merely an example of the electronic device 4, and does not constitute a limitation of the electronic device 4, and may include more or less components than those shown, or combine certain components, or different components, e.g., the electronic device may also include input-output devices, network access devices, buses, etc.
The Processor 401 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or a memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic device 4. Further, the memory 402 may also include both internal storage units of the electronic device 4 and external storage devices. The memory 402 is used for storing computer programs and other programs and data required by the electronic device. The memory 402 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
In the embodiments provided in the present disclosure, it should be understood that the disclosed apparatus/computer device and method may be implemented in other ways. For example, the above-described apparatus/computer device embodiments are merely illustrative, and for example, a division of modules or units, a division of logical functions only, an additional division may be made in actual implementation, multiple units or components may be combined or integrated with another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the present disclosure may implement all or part of the flow of the method in the above embodiments, and may also be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of the above methods and embodiments. The computer program may comprise computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain suitable additions or additions that may be required in accordance with legislative and patent practices within the jurisdiction, for example, in some jurisdictions, computer readable media may not include electrical carrier signals or telecommunications signals in accordance with legislative and patent practices.
The above examples are only intended to illustrate the technical solutions of the present disclosure, not to limit them; although the present disclosure has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present disclosure, and are intended to be included within the scope of the present disclosure.

Claims (5)

1. A method for detecting power consumption of an application program, comprising:
receiving a power consumption detection request, generating a test instruction according to the power consumption detection request, and sending the test instruction to a wireless terminal, wherein the test instruction comprises an identifier corresponding to an application program to be detected and a test priority corresponding to each application program;
responding to the test instruction, sequentially calling test scripts corresponding to the application program according to the identification of the application program and the test priority corresponding to the application program, wherein the test scripts corresponding to the application program comprise test operations preset for the application program;
for each of the applications programs, it is preferred that,
generating test contents based on the test operation in the test script, generating test packets according to the test contents, and testing the wireless terminal according to the test packets and the test contents in the test packets so as to control test equipment to collect voltage data of the wireless terminal according to the test contents;
according to the voltage data collected in a preset time period, carrying out power consumption detection on the application program installed in the wireless terminal;
the method further comprises the following steps: pre-configuring a test script corresponding to the identifier of the application program and the test priority of the application program;
the method further comprises the following steps: monitoring the progress of a corresponding application program test task through the test script to judge whether the power consumption detection task of the application program is finished or not so as to control the closing of the program-controlled power supply;
the method further comprises the following steps: for each application program, after the power consumption detection result of the application program is obtained, controlling the wireless terminal to remove an application program file installed in a memory;
the receiving a power consumption detection request and generating a test instruction according to the power consumption detection request include:
receiving the power consumption detection request, executing analysis operation on the power consumption detection request to obtain an identifier of the application program and a test parameter, and generating the test instruction according to the identifier of the application program and the test parameter; the test parameters comprise parameters corresponding to each test device in the test system, and the test devices comprise a comprehensive tester, a test resistor, a voltage data collector, an upper computer controller and a VGA display;
the responding to the test instruction, sequentially calling the test scripts corresponding to the application program according to the identification of the application program and the test priority corresponding to the application program, and the method comprises the following steps:
acquiring an identifier of the application program carried in the test instruction, and calling a pre-configured test script corresponding to the identifier of the application program according to the test priority corresponding to the application program in sequence so as to enable the test script to perform power consumption detection on the application program according to a preset test operation, wherein the test script comprises one or more test operations;
generating test content based on the test operation in the test script, and generating a test packet according to the test content, including:
according to the test type corresponding to the test operation, obtaining test content corresponding to the test type from a pre-configured test content database, and dividing the test content according to the test type to obtain a test group corresponding to the test content;
the testing the wireless terminal according to the test packet and the test content in the test packet includes:
matching a corresponding test mode for the test packet according to the test packet, and acquiring voltage data of the wireless terminal according to the test content under the test condition corresponding to the test mode; the test modes comprise a running test mode, a standby test mode, a bright screen test mode and a simulation operation mode;
under the test condition corresponding to the test mode, acquiring the voltage data of the wireless terminal according to the test content, wherein the acquisition comprises the following steps:
acquiring voltage data of the wireless terminal based on an application program, running time and relevant parameters of a test network in the running test mode;
under the standby test mode, acquiring voltage data of the wireless terminal based on a standby state, standby time and relevant parameters of a test network;
under the bright screen test mode, acquiring voltage data of the wireless terminal based on screen brightness, bright screen time and relevant parameters of a test network;
acquiring voltage data of the wireless terminal based on an operation object, an operation event, operation time and related parameters of a test network corresponding to simulation operation in the simulation operation mode;
the relevant parameters of the test network comprise parameters when the simulation test network is started, parameters when the simulation test network is closed and parameters when no network test is carried out.
2. The method according to claim 1, wherein the detecting power consumption of the application installed in the wireless terminal according to the voltage data collected within a preset time period comprises:
collecting a voltage value corresponding to each moment of the wireless terminal in the preset time period, and storing the voltage values at continuous moments;
and calculating the average current of the wireless terminal in the continuous time according to all the stored voltage values corresponding to the continuous time, calculating the power consumption of the wireless terminal in the preset time period according to the average current and the time, and determining the power consumption as the detection result of the power consumption corresponding to the application program.
3. An apparatus for detecting power consumption of an application program, comprising:
the wireless terminal comprises a receiving module, a power consumption detection module and a test module, wherein the receiving module is configured to receive a power consumption detection request, generate a test instruction according to the power consumption detection request, and send the test instruction to the wireless terminal, and the test instruction comprises an identifier corresponding to an application program to be detected and a test priority corresponding to each application program;
the calling module is configured to respond to the test instruction, sequentially call a test script corresponding to the application program according to the identification of the application program and the test priority corresponding to the application program, wherein the test script comprises a test operation preset for the application program;
the acquisition module is configured to generate test content based on the test operation in the test script for each application program, generate a test packet according to the test content, and test the wireless terminal according to the test packet and the test content in the test packet so as to control test equipment to acquire the voltage data of the wireless terminal according to the test content;
the detection module is configured to perform power consumption detection on the application program installed in the wireless terminal according to the voltage data acquired within a preset time period;
the calling module is further configured to: pre-configuring a test script corresponding to the identifier of the application program and the test priority of the application program;
the detection module is further configured to: monitoring the progress of a corresponding application program test task through the test script to judge whether the power consumption detection task of the application program is finished or not so as to control the closing of the program-controlled power supply;
the detection module is further configured to: for each application program, after the power consumption detection result of the application program is obtained, controlling the wireless terminal to remove an application program file installed in a memory;
the receiving module is specifically configured to: receiving the power consumption detection request, executing analysis operation on the power consumption detection request to obtain an identifier of the application program and a test parameter, and generating the test instruction according to the identifier of the application program and the test parameter; the test parameters comprise parameters corresponding to each test device in the test system, and the test devices comprise a comprehensive tester, a test resistor, a voltage data collector, an upper computer controller and a VGA display;
the calling module is specifically configured to: acquiring an identifier of the application program carried in the test instruction, and calling a pre-configured test script corresponding to the identifier of the application program according to the test priority corresponding to the application program in sequence so as to enable the test script to perform power consumption detection on the application program according to a preset test operation, wherein the test script comprises one or more test operations;
the acquisition module is specifically configured to:
according to the test type corresponding to the test operation, obtaining test content corresponding to the test type from a pre-configured test content database, and dividing the test content according to the test type to obtain a test group corresponding to the test content;
according to the test grouping, matching a corresponding test mode for the test grouping, and under the test condition corresponding to the test mode, acquiring the voltage data of the wireless terminal according to the test content; the test modes comprise a running test mode, a standby test mode, a bright screen test mode and a simulation operation mode; under the test condition corresponding to the test mode, acquiring the voltage data of the wireless terminal according to the test content, wherein the acquisition comprises the following steps: acquiring voltage data of the wireless terminal based on an application program, running time and relevant parameters of a test network in the running test mode; under the standby test mode, acquiring voltage data of the wireless terminal based on a standby state, standby time and relevant parameters of a test network; under the bright screen test mode, acquiring voltage data of the wireless terminal based on screen brightness, bright screen time and relevant parameters of a test network; acquiring voltage data of the wireless terminal based on an operation object, an operation event, operation time and related parameters of a test network corresponding to simulation operation in the simulation operation mode; the relevant parameters of the test network comprise parameters when the simulation test network is started, parameters when the simulation test network is closed and parameters when no network test is carried out.
4. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 2 when executing the program.
5. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 2.
CN202210127015.9A 2022-02-11 2022-02-11 Application program power consumption detection method and device, electronic equipment and storage medium Active CN114168432B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210127015.9A CN114168432B (en) 2022-02-11 2022-02-11 Application program power consumption detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210127015.9A CN114168432B (en) 2022-02-11 2022-02-11 Application program power consumption detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114168432A CN114168432A (en) 2022-03-11
CN114168432B true CN114168432B (en) 2022-05-10

Family

ID=80489711

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210127015.9A Active CN114168432B (en) 2022-02-11 2022-02-11 Application program power consumption detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114168432B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130246827A1 (en) * 2007-06-25 2013-09-19 Nederlandse Organisatie Voor Toegepast- Natuurwetenschappelijk Onderzoek Tno Method and system for predicting the power consumption of a mobile terminal
CN104092835A (en) * 2014-07-31 2014-10-08 广东欧珀移动通信有限公司 Power consumption anomaly detection method and device for mobile terminal
CN105446854A (en) * 2015-11-09 2016-03-30 小米科技有限责任公司 Power consumption detection method, system, and terminal
CN112148559A (en) * 2020-09-16 2020-12-29 上海中通吉网络技术有限公司 Mobile APP power consumption test method, device and system, acquisition end and test end
CN113933581A (en) * 2021-12-17 2022-01-14 荣耀终端有限公司 Power consumption testing method of mobile equipment and mobile equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459794B (en) * 2020-02-25 2024-03-15 西安广和通无线软件有限公司 Communication network testing method, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130246827A1 (en) * 2007-06-25 2013-09-19 Nederlandse Organisatie Voor Toegepast- Natuurwetenschappelijk Onderzoek Tno Method and system for predicting the power consumption of a mobile terminal
CN104092835A (en) * 2014-07-31 2014-10-08 广东欧珀移动通信有限公司 Power consumption anomaly detection method and device for mobile terminal
CN105446854A (en) * 2015-11-09 2016-03-30 小米科技有限责任公司 Power consumption detection method, system, and terminal
CN112148559A (en) * 2020-09-16 2020-12-29 上海中通吉网络技术有限公司 Mobile APP power consumption test method, device and system, acquisition end and test end
CN113933581A (en) * 2021-12-17 2022-01-14 荣耀终端有限公司 Power consumption testing method of mobile equipment and mobile equipment

Also Published As

Publication number Publication date
CN114168432A (en) 2022-03-11

Similar Documents

Publication Publication Date Title
CN109361562B (en) Automatic testing method based on associated network equipment access
CN111181801B (en) Node cluster testing method and device, electronic equipment and storage medium
CN108833459B (en) Data reporting method and terminal equipment
CN109633351B (en) Intelligent IT operation and maintenance fault positioning method, device, equipment and readable storage medium
CN114167132B (en) Power consumption detection method and device of wireless terminal, electronic equipment and storage medium
CN105120483B (en) Automatic testing method and system for compatibility of smart card and mobile terminal
CN105183630A (en) Method and device for testing application program
CN105025141A (en) Method and device for testing electricity consumption of terminal
CN113672441B (en) Method and device for testing intelligent equipment
US20090036115A1 (en) System and method for testing gsm modules
WO2017011794A1 (en) User device power consumption monitoring and analysis
CN104978262A (en) Terminal test method and terminal test device
CN106407059A (en) Server node testing system and method
CN106776346B (en) Test method and device of CCMTS (China center testing System) equipment
CN109408309A (en) The test method and device of multiple terminals
CN103344854A (en) Automatic test system and method for logical function device
CN104144084A (en) Terminal state monitoring method and device
CN106294097B (en) Application program testing method and device
CN114168432B (en) Application program power consumption detection method and device, electronic equipment and storage medium
CN106598793B (en) Test system and test method based on BIOS serial port log data
CN109426240B (en) Test method and device
CN105764086B (en) A kind of terminal duration performance detection method and system
CN113452533B (en) Charging self-inspection and self-healing method and device, computer equipment and storage medium
CN114218011A (en) Test simulation method and device, terminal equipment and storage medium
CN109862511A (en) Fence area monitoring method, device and computer readable storage medium

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