CN105373482A - Method and device for detecting abnormal power consumption of application program and electronic equipment - Google Patents

Method and device for detecting abnormal power consumption of application program and electronic equipment Download PDF

Info

Publication number
CN105373482A
CN105373482A CN201510980517.6A CN201510980517A CN105373482A CN 105373482 A CN105373482 A CN 105373482A CN 201510980517 A CN201510980517 A CN 201510980517A CN 105373482 A CN105373482 A CN 105373482A
Authority
CN
China
Prior art keywords
power consumption
log information
abnormal
application program
mobile client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510980517.6A
Other languages
Chinese (zh)
Inventor
关亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software 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 Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201510980517.6A priority Critical patent/CN105373482A/en
Publication of CN105373482A publication Critical patent/CN105373482A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a method and a device for detecting abnormal power consumption of an application program and electronic equipment. The method comprises the following steps: acquiring system power consumption log information; sequentially reading power consumption log information of the process from the system power consumption log information, filtering the process with the power consumption smaller than a preset power consumption threshold value, and obtaining a power consumption abnormal process; and determining the reason of the abnormal power consumption of the application program corresponding to the abnormal power consumption process according to a preset abnormal analysis strategy. By applying the invention, the power consumption rate of the electronic equipment can be reduced, and the working time of the electronic equipment can be prolonged.

Description

A kind of method, device and electronic equipment detecting application program power consumption exception
Technical field
The present invention relates to computing machine abnormality detection technology, particularly relate to a kind of method, device and the electronic equipment that detect application program power consumption exception.
Background technology
Along with compunication and Internet technology, the application of electronic equipment is more and more general, such as, intelligent mobile phone, personal digital assistant, palm PC and desktop computer obtain to be applied more and more widely, types of applications program (APP is in the electronic device installed, Application) also get more and more, in order to meet user to the multifarious demand of business.But, along with increasing of the application program of installing in electronic equipment, the operation of application program or standbyly all can consume a large amount of electric energy of electronic equipment, especially lack of standardization due to some application developments, the application program of installing in electronic equipment is made to there is frequent starting, extremely take CPU, hold the abnormal problems such as lock to system, make the electricity of electronic equipment by abnormal consumption, the electricity of electronic equipment is caused not reach normal service time, reduce the normal working hours of electronic equipment, affect the business experience of user.
At present, for the abnormal power consumption problem of application program, also lack the method effectively detecting application program power consumption exception, thus, the application program that abnormal power consumption occurs cannot be located, thus measure targetedly can not be taked, cause the consumption rate of electronic equipment higher, reduce the normal working hours of electronic equipment.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method, device and the electronic equipment that detect application program power consumption exception, reduces the consumption rate of electronic equipment, promotes the working time of electronic equipment.
For achieving the above object, embodiments of the invention adopt following technical scheme:
First aspect, the embodiment of the present invention provides a kind of method detecting application program power consumption exception, comprising:
Acquisition system power consumption log information;
From described system power consumption log information, read the power consumption log information of process successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process;
According to the anomaly analysis strategy pre-set, determine the application program power consumption abnormal cause that power consumption abnormal process is corresponding.
Optionally, before described acquisition system power consumption log information, described method comprises further:
Mobile client to be tested is connected to fixed clients, the system power consumption log information utilizing described fixed clients to empty to store in described mobile client to be tested;
After emptying the system power consumption log information of described storage, disconnect the connection of described mobile client to be tested and described fixed clients;
Start described mobile client to be tested and run each application program pre-set.
Optionally, described mobile client to be tested is connected to fixed clients before, described method comprises further:
For in each mobile client of test application power consumption, build the operating system environment setting operation systematic parameter that pre-set;
For the data environment of described each mobile client configuration consistency;
In the network communications environment pre-set, start described each electronic equipment carry out examination test, obtain the performance test log information of described each electronic equipment within the standing phase pre-set;
Analyze described network communications environment according to the described system power consumption log information obtained, if described network communications environment meets the stable condition pre-set, perform described step mobile client to be tested being connected to fixed clients.
Optionally, described method comprises further:
If described network communications environment does not meet the stable condition pre-set, after mobile network communications environment residing for described each mobile client, in the network communications environment pre-set, described in performing, start the step that described each electronic equipment carries out trying test.
Optionally, the anomaly analysis strategy that described foundation pre-sets, determine that the application program power consumption abnormal cause that power consumption abnormal process is corresponding comprises:
If described power consumption abnormal process has traffic consumes, judge whether described traffic consumes exceeds the flow threshold pre-set, if so, determine that application program power consumption corresponding to described power consumption abnormal process is abnormal and cause for exception of network traffic;
If described power consumption abnormal process is without traffic consumes, or described traffic consumes does not exceed the flow threshold pre-set, judge whether that existence wakes lock up, and wake up lock number of times exceed pre-set wake lock frequency threshold value up, if so, determine that the application program power consumption that described power consumption abnormal process is corresponding causes extremely for waking lock up extremely;
If there is no lock is waken up, or wake up lock number of times do not exceed pre-set wake lock frequency threshold value up, judge whether to there is CPU abnormal, if, determine that the application program power consumption that described power consumption abnormal process is corresponding causes for CPU is abnormal extremely, if not, determine that application program power consumption corresponding to described power consumption abnormal process is abnormal to cause for other reasons.
Optionally, determining that application program power consumption corresponding to described process is abnormal for after exception of network traffic, described method comprises further:
Analyze exception of network traffic reason by system power consumption log information, eliminate described exception of network traffic reason.
Optionally, from system file, the system power consumption log information of described storage is emptied by adbshelldumpsysbatterystats--reset order line; For the mobile client of operating system being provided with Android less than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats order line; For the mobile client of operating system being provided with Android more than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats--charged order line.
Second aspect, the embodiment of the present invention provides a kind of device detecting application program power consumption exception, comprising: log acquisition module, daily record filtering module and anomaly analysis module, wherein,
Log acquisition module, for obtaining system power consumption log information;
Daily record filtering module, for reading the power consumption log information of process from described system power consumption log information successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process;
Anomaly analysis module, for according to the anomaly analysis strategy pre-set, determines the application program power consumption abnormal cause that power consumption abnormal process is corresponding.
Optionally, described device comprises further:
Daily record empties module, for mobile client to be tested is connected to fixed clients, and the system power consumption log information utilizing described fixed clients to empty to store in described mobile client to be tested; After emptying the system power consumption log information of described storage, disconnect the connection of described mobile client to be tested and described fixed clients; Start described mobile client to be tested and run each application program pre-set.
Optionally, described device comprises further: running environment builds module and running environment test module, wherein,
Running environment builds module, for in each mobile client of test application power consumption, builds the operating system environment setting operation systematic parameter that pre-set; For the data environment of described each mobile client configuration consistency;
Running environment test module, carrying out examination test for starting described each electronic equipment in the network communications environment pre-set, obtaining the performance test log information of described each electronic equipment within the standing phase pre-set; Analyze described network communications environment according to the described system power consumption log information obtained, if described network communications environment meets the stable condition pre-set, perform described step mobile client to be tested being connected to fixed clients.
Optionally, if described running environment test module does not also meet the stable condition pre-set for described network communications environment, after mobile network communications environment residing for described each mobile client, in the network communications environment pre-set, described in performing, start the step that described each electronic equipment carries out trying test.
Optionally, described anomaly analysis module comprises: traffic consumes judging unit, traffic consumes abnormal deciding means, exception of network traffic determining unit, wake lock judging unit up, wake the abnormal determining unit of lock up, CPU judging unit, the abnormal determining unit of CPU and other abnormal determining units, wherein
Traffic consumes judging unit, for judging whether described power consumption abnormal process has traffic consumes, if had, notice traffic consumes abnormal deciding means, if do not had, notice wakes lock judging unit up;
Traffic consumes abnormal deciding means, for judging whether described traffic consumes exceeds the flow threshold pre-set, if so, informing network Traffic Anomaly determining unit; If not, notice wakes lock judging unit up;
Exception of network traffic determining unit, causes for exception of network traffic for determining that application program power consumption corresponding to described power consumption abnormal process is abnormal;
Waking lock judging unit up, waking lock up for judging whether described power consumption abnormal process exists, and wake up lock number of times exceed pre-set wake lock frequency threshold value up, if so, notice wake up lock abnormal determining unit; If not, CPU judging unit is notified;
Wake the abnormal determining unit of lock up, for determining that the application program power consumption that described power consumption abnormal process is corresponding causes extremely for waking lock up extremely;
CPU judging unit, abnormal for judging whether described power consumption abnormal process exists CPU, if so, the abnormal determining unit of notice CPU; If not, other abnormal determining units are notified;
The abnormal determining unit of CPU, for determining that the application program power consumption that described power consumption abnormal process is corresponding causes for CPU is abnormal extremely;
Other abnormal determining units, cause for other reasons for determining that application program power consumption corresponding to described power consumption abnormal process is abnormal.
Optionally, described anomaly analysis module also comprises:
Abnormality remove unit, for analyzing exception of network traffic reason by system power consumption log information, eliminates described exception of network traffic reason.
Optionally, from system file, the system power consumption log information of described storage is emptied by adbshelldumpsysbatterystats--reset order line; For the mobile client of operating system being provided with Android less than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats order line; For the mobile client of operating system being provided with Android more than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats--charged order line.
The third aspect, the embodiment of the present invention provides a kind of electronic equipment, and described electronic equipment comprises: housing, processor, storer, circuit board and power circuit, wherein, circuit board is placed in the interior volume that housing surrounds, and processor and storer are arranged on circuit boards; Power circuit, for powering for each circuit of above-mentioned electronic equipment or device; Storer is used for stores executable programs code; Processor runs the program corresponding with executable program code by reading the executable program code stored in storer, for performing the method for aforementioned arbitrary described detection application program power consumption exception.
The method of the detection application program power consumption exception that the embodiment of the present invention provides, device and electronic equipment, by obtaining system power consumption log information; From described system power consumption log information, read the power consumption log information of process successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process; According to the anomaly analysis strategy pre-set, determine the application program power consumption abnormal cause that power consumption abnormal process is corresponding.Like this, provide the general system power consumption log information that utilizes to carry out the analytical approach of application program power consumption exception with crossing, the abnormal power consumption reason of the accurate position-location application of energy, thus reduce the consumption rate of electronic equipment, promote the working time of electronic equipment.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the method flow schematic diagram that the embodiment of the present invention detects application program power consumption exception;
Fig. 2 is the anomaly analysis strategy that embodiment of the present invention foundation pre-sets, and determines the schematic flow sheet of the application program power consumption abnormal cause that power consumption abnormal process is corresponding;
Fig. 3 is the apparatus structure schematic diagram that the embodiment of the present invention detects application program power consumption exception;
Fig. 4 is the anomaly analysis modular structure schematic diagram of the embodiment of the present invention;
Fig. 5 is the structural representation of an electronic equipment of the present invention embodiment.
Embodiment
Below in conjunction with accompanying drawing, the embodiment of the present invention is described in detail.
Should be clear and definite, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making other embodiments all obtained under creative work prerequisite, belong to the scope of protection of the invention.
Fig. 1 is the method flow schematic diagram that the embodiment of the present invention detects application program power consumption exception.See Fig. 1, the method comprises:
Step 11, obtains system power consumption log information;
In this step, can be the system power consumption log information obtaining mobile client, also can be the system power consumption log information obtaining fixed clients.Be described for mobile client below, for mobile client, the operating system of mobile client, such as Android operation system can record the various parameters produced in this mobile client each application program operational process automatically, and parameter is preserved with the form of the system file pre-set.Wherein, system power consumption log information is included in the parameter of record.Thus, as an embodiment, by the mode of seeking system file, the system power consumption log information of mobile client can be obtained.
As an embodiment, for the mobile client of operating system being provided with Android less than 5.0, by adbshelldumpsysbatterystats order line guiding system power consumption log information from system file; And for being provided with the mobile client of operating system of Android more than 5.0, by adbshelldumpsysbatterystats--charged order line guiding system power consumption log information from system file.
In the embodiment of the present invention, can be obtain system power consumption log information by the mode (such as, the time cycle according to pre-setting) of timing, also can be obtain system power consumption log information by the mode of not timing.Such as, if after the electricity that user discovers mobile client has abnormal consumption, receiving after power consumption log information that user sends obtains instruction, obtain the system power consumption log information in mobile client.
As an embodiment, if mobile client, before described acquisition system power consumption log information, the method comprises further:
Mobile client to be tested is connected to fixed clients, the system power consumption log information utilizing described fixed clients to empty to store in described mobile client to be tested;
After emptying the system power consumption log information of described storage, disconnect the connection of described mobile client to be tested and described fixed clients;
Start described mobile client to be tested and run each application program pre-set.
In this step, as an embodiment, before running the application program pre-set, by USB device by mobile client to be tested and fixed clients, such as, desktop computer connects, by the Android debugging bridge (ADB in desktop computer, AndroidDebugBridge) the system power consumption log information will stored in mobile client is ordered, such as, battery level information empties, and subsequent applications program is run to the impact produced to get rid of residual system power consumption log information.
In the embodiment of the present invention, ADB order is as follows:
adbshelldumpsysbatterystats--reset
As an embodiment, for mobile client, under mobile client has battery powered situation by oneself, run each application program pre-set, use operation with the routine of carrying out application program.
As another embodiment, in order to ensure the consistance of running environment in each mobile client in test process, described mobile client to be tested is connected to fixed clients before, or, after the connection of the described mobile client to be tested of described disconnection and described fixed clients; Start before described mobile client to be tested runs each application program pre-set, the method may further include:
Step 111, in each mobile client of test application power consumption, builds the operating system environment setting operation systematic parameter that pre-set;
In this step, operating system environment is stable operating system, such as, and the Android operation system that official issues, Windows operating system and Apple Macintosh operating system etc.
As an embodiment, operating system parameter comprises: the adjustment of screen intensity, auto brightness, system language, automatically upgrade, account is synchronous, bluetooth, screen rotation, the screen locking time, fundamental tone amount, button volume, the one of multimedia volume and input method etc. or its combination in any.
Step 112 is the data environment of described each mobile client configuration consistency;
In this step, as an embodiment, data environment comprises: audio file storage environment, video file storage environment and picture file storage environment, wherein,
Audio file storage environment, for deposit predetermined first amount threshold and/or, the audio file of the first capacity threshold;
Video file storage environment, for deposit predetermined second amount threshold and/or, the video file of the second capacity threshold;
Picture file storage environment, for deposit predetermined 3rd amount threshold and/or, the picture file of the 3rd capacity threshold.
In the embodiment of the present invention, the quantity of the audio file configured under data environment, video file and picture file and size are determined by the quantity and size of adding up the corresponding document stored in the client of each user in practical application.
Step 113, starts described each electronic equipment and carries out examination test, obtain the performance test log information of described each electronic equipment within the standing phase pre-set in the network communications environment pre-set;
In this step, as an embodiment, network communications environment comprises: GPS (GPS, GlobalPositioningSystem) environment, mobile communications network environment and Wireless Fidelity (WiFi, WirelessFidelity) network environment, wherein, mobile communications network includes but not limited to: global system for mobile communications (GSM, GlobalSystemforMobileCommunication), general packet radio service (GPRS, GeneralPacketRadioService), CDMA (CDMA, CodeDivisionMultipleAccess), 3-G (Generation Three mobile communication system), forth generation mobile communication system etc.
In the embodiment of the present invention, the standing phase can be arranged according to actual needs, such as, can be set to 1 hour, 2 hours or other.
Step 114, described network communications environment is analyzed according to the described system power consumption log information obtained, if described network communications environment meets the stable condition pre-set, perform described step mobile client to be tested being connected to fixed clients, or, perform the step that the described mobile client to be tested of described startup runs each application program pre-set.
In the embodiment of the present invention, as another embodiment, the method can further include:
If described network communications environment does not meet the stable condition pre-set, after mobile network communications environment residing for described each mobile client, in the network communications environment pre-set, described in performing, start the step that described each electronic equipment carries out trying test.
In this step, by before application program power consumption test, dispose a set of specification and unified test environment, test environment reusability is high and environment configurations is identical, be conducive to debugging repeatedly and the use of application program power consumption test, promote accuracy and the power consumption testing efficiency of power consumption test result, reduce the impact of external factor application programs power consumption exception.
Step 12, from described system power consumption log information, read the power consumption log information of process successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process;
In this step, due to application program operationally, operating system can be each run the corresponding process of application assigned, thus, record system power consumption log information in, include the power consumption log information that one or more process is corresponding.
In the embodiment of the present invention, power consumption threshold value can be arranged according to the time length of different application programs and log recording.Such as, for network class application program and game class application program, higher power consumption threshold value can be set, and, for the application program (process) that working time is longer, higher power consumption threshold value can be set.Wherein, by the course allocation time of record and the time discharging process resource, the time that process (application program) is run can be determined.
In the embodiment of the present invention, process comprises process name and parsing scheme (URLScheme), according to process name and parsing scheme URLScheme, can determine an application program.
As an embodiment, the method can further include:
Power consumption information corresponding for power consumption abnormal process is shown.
In this step, as an embodiment, power consumption information can be the power consumption grade, application program power consumption ratio etc. of unit interval power consumption, application program.Further, the information such as application program corresponding for power consumption abnormal process and working time can also be shown.
Step 13, according to the anomaly analysis strategy pre-set, determines the application program power consumption abnormal cause that power consumption abnormal process is corresponding.
Fig. 2 is the anomaly analysis strategy that embodiment of the present invention foundation pre-sets, and determines the schematic flow sheet of the application program power consumption abnormal cause that power consumption abnormal process is corresponding.See Fig. 2, this flow process comprises:
Step 21, if described power consumption abnormal process has traffic consumes, judges whether described traffic consumes exceeds the flow threshold pre-set, and if so, determines that application program power consumption corresponding to described power consumption abnormal process is abnormal and causes for exception of network traffic;
In this step, as previously mentioned, flow threshold also can be arranged according to the time length of different application programs and log recording.In the embodiment of the present invention, pass through statistical study, the application program of Traffic Anomaly, the electricity consumed is also larger, thus, for the process of power consumption exception, if this process has abnormal traffic consumes, then can determine that power consumption is because the exception of network traffic of application program corresponding to this process causes extremely.
In the embodiment of the present invention, as an embodiment, determining that application program power consumption corresponding to described process is abnormal for after exception of network traffic, the method can further include:
Analyze exception of network traffic reason by system power consumption log information, eliminate described exception of network traffic reason.
In this step, be known technology about analyzing and eliminating described exception of network traffic reason, omit detailed description at this.
Step 22, if described power consumption abnormal process is without traffic consumes, or described traffic consumes does not exceed the flow threshold pre-set, judge whether that existence wakes lock up, and wake up lock number of times exceed pre-set wake lock frequency threshold value up, if so, determine that the application program power consumption that described power consumption abnormal process is corresponding causes extremely for waking lock up extremely;
In this step, after determining that process does not exceed without traffic consumes or traffic consumes the flow threshold pre-set, if exist in system power consumption log information and wake lock information up, and, wake up lock number of times exceed pre-set wake lock frequency threshold value up, then determine that application program power consumption corresponding to described process is abnormal abnormal for waking lock up.In subsequent applications, can by analyzing the function of application program waken up and lock and wake up, what determine whether to need to forbid this application program wakes lock function up to avoid application program power consumption abnormal.
In the embodiment of the present invention, waking lock frequency threshold value up can determine according to the application program number installed in mobile client.As an embodiment, lock frequency threshold value can be waken up for each process arranges one.
In the embodiment of the present invention, occupied duration can also be locked by obtaining in running order waking up, if described in wake up the occupied duration of lock exceed pre-set take duration threshold value, determine that abnormal lock is abnormal to be caused in order to wake up in application program power consumption corresponding to described process.
In this step, further, determining that application program power consumption corresponding to described process is abnormal for after waking that lock is abnormal up and causing, lock can also be waken up or notifies that user processes by compulsive unlocking.
As an embodiment, a part of content text comprised in system power consumption log information can be as follows:
Fullwifilock:1h24m21s861ms(49.5%)
Wakelockbtwakelock:1h7m56s308mspartial(11times)realtime
Totalwake:1h7m56s308mspartialrealtime
Sensor1:1m6s393msrealtime(2times)
Therefore, in the system power consumption log information of this mobile client, below wherein existing, extremely hold lock:
FullWifiLock (WiFi holds lock): 1h24m21s861ms;
WakelockBtWakeLock (waking lock up): 1h7m56s308mspartial (11times) realtime (wherein extremely waking 11 times up);
Sensor1 (sensor): 1m6s393msrealtime (2times)
In above-mentioned example, wake up lock number of times be 11 times, if pre-set wake up lock frequency threshold value be 8 times, then this process wake up lock number of times exceed pre-set wake lock frequency threshold value up.
In the embodiment of the present invention, can pass through analysis application (process) for WiFi lock, wake lock up, the exception application of sensor, finds out the reason of holding lock, and can pass through Code Review, thus solve abnormal problem.
Step 23, if there is no lock is waken up, or wake up lock number of times do not exceed pre-set wake lock frequency threshold value up, judge whether to there is CPU abnormal, if, determine that application program power consumption corresponding to described power consumption abnormal process is abnormal to cause for CPU is abnormal, if not, determine that application program power consumption that described power consumption abnormal process is corresponding is abnormal and cause for other reasons.
In this step, if include CPU abnormal information in system power consumption log information, determine that application program power consumption is abnormal and cause for described CPU is abnormal.Such as, by obtaining the CPU usage of process, if described CPU usage is greater than the CPU usage threshold value pre-set, then judge the application program operation exception that described process is corresponding, application program power consumption corresponding to described process is abnormal to be caused for CPU is abnormal.
From above-mentioned, the embodiment of the present invention detects the method for application program power consumption exception, by obtaining system power consumption log information; From described system power consumption log information, read the power consumption log information of process successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process; According to the anomaly analysis strategy pre-set, determine the application program power consumption abnormal cause that power consumption abnormal process is corresponding.Like this, provide the general system power consumption log information that utilizes to carry out the analytical approach of application program power consumption exception with crossing, the abnormal power consumption reason of the accurate position-location application of energy, thus reduce the consumption rate of electronic equipment, promote the working time of electronic equipment.Further, by the analysis to abnormal power consumption reason, effectively can solve the technical matters of application exception consumes power, effectively avoid the electricity of electronic equipment by abnormal consumption, promote the business experience of user.
Fig. 3 is the apparatus structure schematic diagram that the embodiment of the present invention detects application program power consumption exception.See Fig. 3, this device comprises: log acquisition module 31, daily record filtering module 32 and anomaly analysis module 33, wherein,
Log acquisition module 31, for obtaining system power consumption log information;
In the embodiment of the present invention, as an embodiment, by searching the mode of the system file pre-set, obtain the system power consumption log information of mobile client.Such as, from system file, the system power consumption log information of described storage is emptied by adbshelldumpsysbatterystats--reset order line; For the mobile client of operating system being provided with Android less than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats order line; For the mobile client of operating system being provided with Android more than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats--charged order line.
Daily record filtering module 32, for reading the power consumption log information of process from described system power consumption log information successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process;
In the embodiment of the present invention, process comprises process name and parsing scheme, according to process name and the scheme of parsing, can determine an application program.
Anomaly analysis module 33, for according to the anomaly analysis strategy pre-set, determines the application program power consumption abnormal cause that power consumption abnormal process is corresponding.
In the embodiment of the present invention, as an embodiment, this device can further include:
Daily record empties module 34, for mobile client to be tested is connected to fixed clients, and the system power consumption log information utilizing described fixed clients to empty to store in described mobile client to be tested; After emptying the system power consumption log information of described storage, disconnect the connection of described mobile client to be tested and described fixed clients; Start described mobile client to be tested and run each application program pre-set.
In the embodiment of the present invention, by the Android debugging bridge order in fixed clients, emptied by the system power consumption log information stored in mobile client, ADB order is as follows:
adbshelldumpsysbatterystats--reset
In the embodiment of the present invention, as another embodiment, this device can further include: running environment builds module 35 and running environment test module 36, wherein,
Running environment builds module 35, for in each mobile client of test application power consumption, builds the operating system environment setting operation systematic parameter that pre-set; For the data environment of described each mobile client configuration consistency;
Running environment test module 36, carrying out examination test for starting described each electronic equipment in the network communications environment pre-set, obtaining the performance test log information of described each electronic equipment within the standing phase pre-set; Analyze described network communications environment according to the described system power consumption log information obtained, if described network communications environment meets the stable condition pre-set, perform described step mobile client to be tested being connected to fixed clients.
In the embodiment of the present invention, as an embodiment, if running environment test module 36 can also be further used for described network communications environment do not meet the stable condition pre-set, after mobile network communications environment residing for described each mobile client, in the network communications environment pre-set, described in performing, start the step that described each electronic equipment carries out trying test.
In the embodiment of the present invention, by before application program power consumption test, dispose a set of specification and unified test environment, test environment reusability is high and environment configurations is identical, be conducive to debugging repeatedly and the use of application program power consumption test, promote accuracy and the power consumption testing efficiency of power consumption test result, reduce the impact of external factor application programs power consumption exception.
In the embodiment of the present invention, as an embodiment, Fig. 4 is the anomaly analysis modular structure schematic diagram of the embodiment of the present invention.See Fig. 4, this anomaly analysis module comprises: traffic consumes judging unit 41, traffic consumes abnormal deciding means 42, exception of network traffic determining unit 44, wake lock judging unit 43 up, wake the abnormal determining unit 46 of lock up, CPU judging unit 45, the abnormal determining unit 47 of CPU and other abnormal determining units 48, wherein
Traffic consumes judging unit 41, for judging whether described power consumption abnormal process has traffic consumes, if had, notice traffic consumes abnormal deciding means 42, if do not had, notice wakes lock judging unit 43 up;
Traffic consumes abnormal deciding means 42, for judging whether described traffic consumes exceeds the flow threshold pre-set, if so, informing network Traffic Anomaly determining unit 44; If not, notice wakes lock judging unit 43 up;
Exception of network traffic determining unit 44, causes for exception of network traffic for determining that application program power consumption corresponding to described power consumption abnormal process is abnormal;
Wake up lock judging unit 43, wake lock up for judging whether described power consumption abnormal process exists, and wake up lock number of times exceed pre-set wake lock frequency threshold value up, if so, notice wake up lock abnormal determining unit 46; If not, CPU judging unit 45 is notified;
Wake the abnormal determining unit 46 of lock up, for determining that the application program power consumption that described power consumption abnormal process is corresponding causes extremely for waking lock up extremely;
CPU judging unit 45, abnormal for judging whether described power consumption abnormal process exists CPU, if so, the abnormal determining unit 47 of notice CPU; If not, other abnormal determining units 48 are notified;
The abnormal determining unit 47 of CPU, for determining that the application program power consumption that described power consumption abnormal process is corresponding causes for CPU is abnormal extremely;
Other abnormal determining units 48, cause for other reasons for determining that application program power consumption corresponding to described power consumption abnormal process is abnormal.
In the embodiment of the present invention, as an embodiment, anomaly analysis module can further include:
Abnormality remove unit 49, for analyzing exception of network traffic reason by system power consumption log information, eliminates described exception of network traffic reason.
The embodiment of the present invention also provides a kind of electronic equipment, and described electronic equipment comprises the device described in aforementioned any embodiment.
Fig. 5 is the structural representation of an electronic equipment of the present invention embodiment, the flow process of Fig. 1-4 illustrated embodiment of the present invention can be realized, as shown in Figure 5, above-mentioned electronic equipment can comprise: housing 51, processor 52, storer 53, circuit board 54 and power circuit 55, wherein, circuit board 54 is placed in the interior volume that housing 51 surrounds, and processor 52 and storer 53 are arranged on circuit board 54; Power circuit 55, for powering for each circuit of above-mentioned electronic equipment or device; Storer 53 is for stores executable programs code; Processor 52 runs the program corresponding with executable program code, for performing the method for the detection application program power consumption exception described in aforementioned any embodiment by reading the executable program code stored in storer 53.
The step that the concrete implementation of processor 52 pairs of above-mentioned steps and processor 52 perform further by running executable program code, see the description of Fig. 1-4 illustrated embodiment of the present invention, can not repeat them here.
This electronic equipment exists in a variety of forms, includes but not limited to:
(1) mobile communication equipment: the feature of this kind equipment possesses mobile communication function, and to provide speech, data communication for main target.This Terminal Type comprises: smart mobile phone (such as iPhone), multimedia handset, functional mobile phone, and low-end mobile phone etc.
(2) super mobile personal computer equipment: this kind equipment belongs to the category of personal computer, has calculating and processing capacity, generally also possesses mobile Internet access characteristic.This Terminal Type comprises: PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device: this kind equipment can show and play multimedia content.This kind equipment comprises: audio frequency, video player (such as iPod), handheld device, e-book, and intelligent toy and portable car-mounted navigator.
(4) server: the equipment that calculation services is provided, the formation of server comprises processor, hard disk, internal memory, system bus etc., server and general computer architecture similar, but owing to needing to provide highly reliable service, therefore require higher in processing power, stability, reliability, security, extensibility, manageability etc.
(5) other have the electronic equipment of data interaction function.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory, ROM) or random store-memory body (RandomAccessMemory, RAM) etc.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; the change that can expect easily or replacement, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.

Claims (10)

1. detect a method for application program power consumption exception, it is characterized in that, the method comprises:
Acquisition system power consumption log information;
From described system power consumption log information, read the power consumption log information of process successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process;
According to the anomaly analysis strategy pre-set, determine the application program power consumption abnormal cause that power consumption abnormal process is corresponding.
2. method according to claim 1, is characterized in that, before described acquisition system power consumption log information, described method comprises further:
Mobile client to be tested is connected to fixed clients, the system power consumption log information utilizing described fixed clients to empty to store in described mobile client to be tested;
After emptying the system power consumption log information of described storage, disconnect the connection of described mobile client to be tested and described fixed clients;
Start described mobile client to be tested and run each application program pre-set.
3. method according to claim 2, is characterized in that, described mobile client to be tested is connected to fixed clients before, described method comprises further:
For in each mobile client of test application power consumption, build the operating system environment setting operation systematic parameter that pre-set;
For the data environment of described each mobile client configuration consistency;
In the network communications environment pre-set, start each electronic equipment carry out examination test, obtain the performance test log information of described each electronic equipment within the standing phase pre-set;
Analyze described network communications environment according to the described system power consumption log information obtained, if described network communications environment meets the stable condition pre-set, perform described step mobile client to be tested being connected to fixed clients.
4. method according to claim 3, is characterized in that, described method comprises further:
If described network communications environment does not meet the stable condition pre-set, after mobile network communications environment residing for described each mobile client, in the network communications environment pre-set, described in performing, start the step that described each electronic equipment carries out trying test.
5. the method according to any one of Claims 1-4, is characterized in that, the anomaly analysis strategy that described foundation pre-sets, and determines that the application program power consumption abnormal cause that power consumption abnormal process is corresponding comprises:
If described power consumption abnormal process has traffic consumes, judge whether described traffic consumes exceeds the flow threshold pre-set, if so, determine that application program power consumption corresponding to described power consumption abnormal process is abnormal and cause for exception of network traffic;
If described power consumption abnormal process is without traffic consumes, or described traffic consumes does not exceed the flow threshold pre-set, judge whether that existence wakes lock up, and wake up lock number of times exceed pre-set wake lock frequency threshold value up, if so, determine that the application program power consumption that described power consumption abnormal process is corresponding causes extremely for waking lock up extremely;
If there is no lock is waken up, or wake up lock number of times do not exceed pre-set wake lock frequency threshold value up, judge whether to there is CPU abnormal, if, determine that the application program power consumption that described power consumption abnormal process is corresponding causes for CPU is abnormal extremely, if not, determine that application program power consumption corresponding to described power consumption abnormal process is abnormal to cause for other reasons.
6. method according to claim 5, is characterized in that, determining that application program power consumption corresponding to described process is abnormal for after exception of network traffic, described method comprises further:
Analyze exception of network traffic reason by system power consumption log information, eliminate described exception of network traffic reason.
7. method according to claim 5, is characterized in that, is emptied the system power consumption log information of described storage by adbshelldumpsysbatterystats--reset order line from system file; For the mobile client of operating system being provided with Android less than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats order line; For the mobile client of operating system being provided with Android more than 5.0, from system file, derive described system power consumption log information by adbshelldumpsysbatterystats--charged order line.
8. detect a device for application program power consumption exception, it is characterized in that, this device comprises: log acquisition module, daily record filtering module and anomaly analysis module, wherein,
Log acquisition module, for obtaining system power consumption log information;
Daily record filtering module, for reading the power consumption log information of process from described system power consumption log information successively, filtering power consumption is less than the process of the power consumption threshold value pre-set, and obtains power consumption abnormal process;
Anomaly analysis module, for according to the anomaly analysis strategy pre-set, determines the application program power consumption abnormal cause that power consumption abnormal process is corresponding.
9. device according to claim 8, is characterized in that, described device comprises further:
Daily record empties module, for mobile client to be tested is connected to fixed clients, and the system power consumption log information utilizing described fixed clients to empty to store in described mobile client to be tested; After emptying the system power consumption log information of described storage, disconnect the connection of described mobile client to be tested and described fixed clients; Start described mobile client to be tested and run each application program pre-set.
10. device according to claim 9, is characterized in that, described device comprises further: running environment builds module and running environment test module, wherein,
Running environment builds module, for in each mobile client of test application power consumption, builds the operating system environment setting operation systematic parameter that pre-set; For the data environment of described each mobile client configuration consistency;
Running environment test module, carrying out examination test for starting each electronic equipment in the network communications environment pre-set, obtaining the performance test log information of described each electronic equipment within the standing phase pre-set; Analyze described network communications environment according to the described system power consumption log information obtained, if described network communications environment meets the stable condition pre-set, perform described step mobile client to be tested being connected to fixed clients.
CN201510980517.6A 2015-12-23 2015-12-23 Method and device for detecting abnormal power consumption of application program and electronic equipment Pending CN105373482A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510980517.6A CN105373482A (en) 2015-12-23 2015-12-23 Method and device for detecting abnormal power consumption of application program and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510980517.6A CN105373482A (en) 2015-12-23 2015-12-23 Method and device for detecting abnormal power consumption of application program and electronic equipment

Publications (1)

Publication Number Publication Date
CN105373482A true CN105373482A (en) 2016-03-02

Family

ID=55375700

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510980517.6A Pending CN105373482A (en) 2015-12-23 2015-12-23 Method and device for detecting abnormal power consumption of application program and electronic equipment

Country Status (1)

Country Link
CN (1) CN105373482A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106055077A (en) * 2016-05-31 2016-10-26 广东欧珀移动通信有限公司 Wake-up lock-based processing method and device
CN106326069A (en) * 2016-08-19 2017-01-11 北京小米移动软件有限公司 Method, device and system for detecting power consumption as well as equipment
CN106357774A (en) * 2016-09-22 2017-01-25 深圳市金立通信设备有限公司 Information pushing method and network device
CN107172304A (en) * 2017-07-17 2017-09-15 维沃移动通信有限公司 A kind of mobile terminal power consumption detection method and mobile terminal
CN107515811A (en) * 2017-08-31 2017-12-26 北京麒麟合盛网络技术有限公司 A kind of method and apparatus for obtaining application program power consumption
CN108415551A (en) * 2018-03-25 2018-08-17 东莞市华睿电子科技有限公司 A kind of detection process method of application program power consumption exception
CN108513281A (en) * 2017-02-27 2018-09-07 卡西欧计算机株式会社 Information notice method, information notification apparatus and recording medium
CN108874572A (en) * 2018-05-14 2018-11-23 北京小米移动软件有限公司 Detection method, device, server and the storage medium of abnormal power consumption
WO2019237751A1 (en) * 2018-06-13 2019-12-19 深圳大学 Method and system for detecting power consumption of mobile application
CN110945896A (en) * 2018-05-17 2020-03-31 华为技术有限公司 Power consumption abnormity prompting method, server and terminal
CN111190476A (en) * 2019-12-30 2020-05-22 秒针信息技术有限公司 Method and device for determining operating state, storage medium and electronic device
CN111209160A (en) * 2019-12-31 2020-05-29 深圳云天励飞技术有限公司 Power consumption abnormity analysis method and device, terminal equipment and readable storage medium
CN111722993A (en) * 2020-06-16 2020-09-29 广东小天才科技有限公司 Method and system for monitoring abnormal power consumption of communication terminal, terminal device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508761A (en) * 2011-11-17 2012-06-20 宇龙计算机通信科技(深圳)有限公司 Management method for terminal electric quantity and terminal
CN103324519A (en) * 2013-06-17 2013-09-25 华为技术有限公司 Method and device for clearing malicious power consumption applications, and user terminal
CN104516806A (en) * 2014-12-26 2015-04-15 北京奇虎科技有限公司 Power consumption information detection result display method and system for mobile terminal
CN104636240A (en) * 2014-12-31 2015-05-20 广东欧珀移动通信有限公司 Method for acquiring information report and terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508761A (en) * 2011-11-17 2012-06-20 宇龙计算机通信科技(深圳)有限公司 Management method for terminal electric quantity and terminal
CN103324519A (en) * 2013-06-17 2013-09-25 华为技术有限公司 Method and device for clearing malicious power consumption applications, and user terminal
CN104516806A (en) * 2014-12-26 2015-04-15 北京奇虎科技有限公司 Power consumption information detection result display method and system for mobile terminal
CN104636240A (en) * 2014-12-31 2015-05-20 广东欧珀移动通信有限公司 Method for acquiring information report and terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
随心: "待机延长10倍 手机毒霸3.0全面评测", 《HTTP://NEWS.MYDRIVERS.COM/1/275/275627_ALL.HTM》 *

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106055077A (en) * 2016-05-31 2016-10-26 广东欧珀移动通信有限公司 Wake-up lock-based processing method and device
CN106326069A (en) * 2016-08-19 2017-01-11 北京小米移动软件有限公司 Method, device and system for detecting power consumption as well as equipment
CN106357774A (en) * 2016-09-22 2017-01-25 深圳市金立通信设备有限公司 Information pushing method and network device
CN108513281B (en) * 2017-02-27 2021-04-02 卡西欧计算机株式会社 Information notifying method, information notifying device, and recording medium
CN108513281A (en) * 2017-02-27 2018-09-07 卡西欧计算机株式会社 Information notice method, information notification apparatus and recording medium
CN107172304B (en) * 2017-07-17 2019-12-03 维沃移动通信有限公司 A kind of mobile terminal power consumption detection method and mobile terminal
CN107172304A (en) * 2017-07-17 2017-09-15 维沃移动通信有限公司 A kind of mobile terminal power consumption detection method and mobile terminal
CN107515811A (en) * 2017-08-31 2017-12-26 北京麒麟合盛网络技术有限公司 A kind of method and apparatus for obtaining application program power consumption
CN108415551A (en) * 2018-03-25 2018-08-17 东莞市华睿电子科技有限公司 A kind of detection process method of application program power consumption exception
CN108874572A (en) * 2018-05-14 2018-11-23 北京小米移动软件有限公司 Detection method, device, server and the storage medium of abnormal power consumption
CN110945896A (en) * 2018-05-17 2020-03-31 华为技术有限公司 Power consumption abnormity prompting method, server and terminal
CN110945896B (en) * 2018-05-17 2021-10-01 华为技术有限公司 Power consumption abnormity prompting method, server and terminal
US11422605B2 (en) 2018-05-17 2022-08-23 Huawei Technologies Co., Ltd. Power consumption exception prompt method, server, and terminal
WO2019237751A1 (en) * 2018-06-13 2019-12-19 深圳大学 Method and system for detecting power consumption of mobile application
CN111190476A (en) * 2019-12-30 2020-05-22 秒针信息技术有限公司 Method and device for determining operating state, storage medium and electronic device
CN111209160A (en) * 2019-12-31 2020-05-29 深圳云天励飞技术有限公司 Power consumption abnormity analysis method and device, terminal equipment and readable storage medium
CN111209160B (en) * 2019-12-31 2024-03-22 深圳云天励飞技术有限公司 Power consumption abnormality analysis method and device, terminal equipment and readable storage medium
CN111722993A (en) * 2020-06-16 2020-09-29 广东小天才科技有限公司 Method and system for monitoring abnormal power consumption of communication terminal, terminal device and storage medium

Similar Documents

Publication Publication Date Title
CN105373482A (en) Method and device for detecting abnormal power consumption of application program and electronic equipment
US9785428B2 (en) Internal software updating method and system
CN102708050B (en) Method and system for testing mobile application
CN105549718A (en) Method and device for optimizing power consumption of application program and electronic equipment
JP6487044B2 (en) Power management method and power management apparatus for user equipment
US20140301218A1 (en) Statistical analysis and prompting method and system for mobile terminal internet traffic
CN108616653B (en) Information processing method, device, mobile terminal and computer readable storage medium
CN106445783A (en) Method and device for detecting jamming of electronic equipment and electronic equipment
CN105487639A (en) Method and device for optimizing power consumption of application program and electronic equipment
CN103367823A (en) Charging method of battery and mobile terminal
CN105677141A (en) Application program management method and terminal
CN104636240A (en) Method for acquiring information report and terminal
CN109375956B (en) Method for restarting operating system, logic device and control device
CN105512041A (en) Method and device for testing application program performance and electronic equipment
CN114167132B (en) Power consumption detection method and device of wireless terminal, electronic equipment and storage medium
CN102316507A (en) Method for detecting mobile terminal network signal, system and mobile terminal thereof
CN107608923B (en) Test processing method and related product
CN106776248A (en) A kind of method and apparatus of data processing
CN112150033A (en) Express cabinet system management method and device and electronic equipment
CN104239111A (en) Application program upgrading method and device and terminal
CN104346201A (en) Method, device and terminal for acquiring system resource consumed by application program
CN107451037A (en) A kind of remaining runtime reminding method and device for mobile terminal
US20160147630A1 (en) Method and system of detecting abnormal power consumption
CN107547742B (en) Wake-up lock release method and device for mobile terminal
CN105095743A (en) Method and device for setting locking strategy and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160302