CN106502860A - A kind of method and device for obtaining power consumption information - Google Patents

A kind of method and device for obtaining power consumption information Download PDF

Info

Publication number
CN106502860A
CN106502860A CN201610900069.9A CN201610900069A CN106502860A CN 106502860 A CN106502860 A CN 106502860A CN 201610900069 A CN201610900069 A CN 201610900069A CN 106502860 A CN106502860 A CN 106502860A
Authority
CN
China
Prior art keywords
information
power consumption
terminal
kernel
script
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.)
Granted
Application number
CN201610900069.9A
Other languages
Chinese (zh)
Other versions
CN106502860B (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.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications 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 Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Priority to CN201610900069.9A priority Critical patent/CN106502860B/en
Publication of CN106502860A publication Critical patent/CN106502860A/en
Application granted granted Critical
Publication of CN106502860B publication Critical patent/CN106502860B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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 invention discloses a kind of method and device for obtaining power consumption information, in order to solve, during tester's acquisition power consumption of terminal information in prior art, to need to be connected terminal with other equipment, detection time is long, the problem had high demands by tester.The method includes:Terminal is called for detecting and obtaining the script of power consumption information, wherein, and the power consumption information is used for describing the factor for affecting power consumption of terminal;Script described in the terminal operating obtains power consumption information and preserves the power consumption information.

Description

A kind of method and device for obtaining power consumption information
Technical field
A kind of the present invention relates to communication technical field, more particularly to method and device for obtaining power consumption information.
Background technology
At present, the method for acquisition smart mobile phone power consumption information is:Tester there will be the smart mobile phone of power problemses with Personal computer is connected by USB (universal serial bus) (Universal Serial Bus, USB), debugs bridge using Android (Android Debug Bridge, ADB) order obtains daily record (LOG) information of the smart mobile phone, parses from the LOG information Go out the information related to the smart mobile phone power consumption.
But, said method cannot obtain the power consumption information of smart mobile phone in some cases, and for example, smart mobile phone crashes Or abnormal shutdown causes the LOG information of smart mobile phone to be lost.Also, the tester that only consumption detection is had wide experience is The information related to smart mobile phone power consumption can be parsed from the LOG information, tester is had high demands.Meanwhile, by ADB The LOG information contents that order is obtained cause greatly the time that tester is obtained needed for smart mobile phone power consumption information long.
Content of the invention
The embodiment of the present invention provides a kind of method and device for obtaining power consumption information, in order to solve tester in prior art When member obtains power consumption of terminal information, need to be connected terminal with other equipment, detection time is long, and have high demands tester asks Topic.
Concrete technical scheme provided in an embodiment of the present invention is as follows:
In a first aspect, a kind of method for obtaining power consumption information is embodiments provided, including:
Terminal is called for detecting and obtaining the script of power consumption information, wherein, and the power consumption information is used for describing to be affected eventually The factor of end power consumption;
Script described in the terminal operating obtains power consumption information and preserves the power consumption information.
Second aspect, embodiments provides a kind of device for obtaining power consumption information, including:
Calling module, for calling for detecting and obtaining the script of power consumption information, wherein, the power consumption information is used for retouching Stating affects the factor of power consumption of terminal;
Acquisition module, obtains power consumption information and preserves the power consumption information for running the script.
Above-mentioned technical proposal is based on, in the embodiment of the present invention, terminal is called for detecting and obtaining the script of power consumption information, Run the script and obtain and preserve power consumption information, wherein, the power consumption information is used for describing the factor for affecting power consumption of terminal so that survey When examination personnel obtain the power consumption information of terminal, it is not necessary to be connected the terminal with other equipment, shorten the consumption detection time, drop The low requirement to tester.Also, after the terminal operating script obtains power consumption information, the power consumption information is stored in terminal In, terminal is solved because the factor such as deadlock or abnormal shutdown causes the log information of terminal to be lost so that cannot obtain terminal The problem of power consumption information.
Description of the drawings
Fig. 1 is the method flow schematic diagram for obtaining power consumption information in first embodiment of the invention;
Fig. 2 is the method flow diagram that mobile phone obtains power consumption information by consumption detection application in the specific embodiment of the invention;
Fig. 3 runs for mobile phone in the specific embodiment of the invention and obtains power consumption letter for detecting and obtaining the script of power consumption information The method flow schematic diagram of breath;
Fig. 4 is the structural representation of the device for obtaining power consumption information in second embodiment of the invention.
Specific embodiment
In order that the object, technical solutions and advantages of the present invention are clearer, below in conjunction with accompanying drawing the present invention is made into One step ground is described in detail, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole enforcement Example.Embodiment in based on the present invention, those of ordinary skill in the art are obtained under the premise of creative work is not made All other embodiment, belongs to the scope of protection of the invention.
In order to solve, during tester's acquisition power consumption of terminal information in prior art, to need to connect terminal with other equipment Connect, detection time is long, the problem had high demands by tester, the embodiment of the present invention provides a kind of side for obtaining power consumption of terminal information Method and device.
Below in conjunction with the accompanying drawings the preferred embodiment of the present invention is described in detail.
In the embodiment of the present invention, the upper layer application of terminal includes the application in the terminal operating system and user in the terminal The application of middle installation.
In first embodiment of the invention, as shown in figure 1, the method detailed flow process for obtaining power consumption of terminal information is as follows:
Step 101:Terminal is called for detecting and obtaining the script of power consumption information, wherein, and the power consumption information is used for describing Affect the factor of power consumption of terminal.
Specifically, the power consumption information of terminal includes:The upper layer application enciphered information of terminal, the wake-up times of terminal are more than pre- If the mark of the upper layer application of value and/or the kernel enciphered information of terminal, wherein, the upper layer application enciphered information at least includes locating In the mark of the upper layer application of locking state, the kernel enciphered information include the title of kernel locking function, kernel lock when Long, the kernel enciphered information is that all kernel enciphered informations of the terminal lock duration order arrangement from big to small according to kernel When, come all kernel enciphered informations within default ranking.
In enforcement, the script for detecting and obtain power consumption information uses Shell scripting languages.
Step 102:Terminal operating script acquisition power consumption information simultaneously preserves the power consumption information.
In enforcement, the first instruction that terminal operating is used in the script for detect and obtain power consumption information obtains log information, And second run in the script instructs, the keyword is obtained from the log information according to the keyword that the second instruction is indicated Corresponding power consumption information.
Preferably, the first instruction that terminal operating is used for detecting and obtain in the script of power consumption information obtain log information it Afterwards, run the in the script the 3rd instruction and the log information is saved as temporary file, the second instruction that reruns in the script From the temporary file, the corresponding power consumption information of the keyword is obtained.
Specifically, terminal operating is used in the script for detect and obtain power consumption information being used for calling turning for Android system First instruction of the order (dumpsys power orders) of the system information of storage power consumption, obtains the upper layer application comprising terminal and adds The log information of lock information, runs the second instruction in the script, is in locking state according in second instruction for mark Upper layer application information keyword, such as " DOZE_WAKE_LOCK " keyword or " PARTIAL_WAKE_LOCK " keyword, Obtain the mark of the upper layer application in terminal in locking state;
With or, terminal operating is used for detecting and obtain in the script of power consumption information for calling the dump of Android system First instruction of the order (dumpsys alarm orders) of the system information of intervalometer, obtaining should comprising the upper strata for waking up terminal With the log information of information, the second instruction in the script is run, wake-up terminal is needed according in second instruction for mark Upper layer application information keyword, such as " wakeups:" keyword, obtain institute in need wake-up terminal upper layer application letter Breath, and by for obtaining the instruction of the data for meeting pre-conditioned in pending data, obtaining the upper strata for needing to wake up terminal Mark of the wake-up times more than the upper layer application of preset value in the information of application;
With or, terminal operating is used for detecting and obtain in the script of power consumption information for calling the dump of Android system First instruction of the order (dumpsys batterystats orders) of the status information of battery, obtains the kernel comprising terminal and adds The log information of lock information, runs the second instruction in the script, locks for identifying terminal kernel according in second instruction The keyword of information, such as " Kernel Wake lock " keyword, obtain all kernel enciphered informations in terminal, and by being used for Obtain the instruction that pre-conditioned data are met in pending data, the kernel obtained in every kernel enciphered information of terminal adds The title of lock function and the information of duration is locked, reruned for obtaining the default line number started from the first row in pending data Data instruction, obtain the information according to lock duration from small to large order arrange after, the title of top n kernel locking function With locking duration, wherein, N is the integer not less than 1.
Preferably, after terminal obtains the log information of the upper layer application enciphered information comprising terminal, bag can also be passed through The instruction of the keyword containing the number for mark in the upper layer application of locking state, such as " Wake Locks:", obtain terminal In in locking state upper layer application number.
Preferably, terminal obtain institute in need wake up terminal upper layer application information after, can also pass through comprising use In the instruction that mark is run but reality does not wake up the keyword of the information of the upper layer application of terminal, such as " 0wakeups:", will The information (i.e. wake-up times are the information of 0 upper layer application) of operation but the unactual upper layer application for waking up terminal in the information Delete.
In enforcement, terminal operating be used for detect and obtain power consumption information script obtain and preserve power consumption information after, delete Except the temporary file for preserving the terminal log information.
In enforcement, terminal operating be used for detect and obtain power consumption information script obtain and preserve power consumption information after, show The power consumption information.
Below by way of specific embodiment, by taking mobile phone as an example, to acquisition power consumption of terminal information provided in an embodiment of the present invention Method is described in detail.
Mobile phone obtains the method flow of the power consumption information of the mobile phone as shown in Fig. 2 specific as follows by consumption detection application Shown:
Step 201:Consumption detection application installed by mobile phone, and starts the consumption detection application.Wherein, the consumption detection application For calling for detecting and obtaining the script (powertest.sh) of power consumption information, the power consumption letter that the script obtains mobile phone is run Breath, and show the power consumption information, the consumption detection application is under catalogue/system/etc.
Specifically, the power consumption information of mobile phone includes upper layer application enciphered information, wake-up times more than 100 upper layer application Mark and kernel enciphered information, wherein, the upper layer application enciphered information include the upper layer application in locking state mark and Or the number of the upper layer application in locking state, the kernel enciphered information includes the title of the kernel locking function, this is interior The duration that core is locked, the kernel enciphered information are that all kernel enciphered informations of mobile phone lock duration from big to small according to kernel After order is arranged, the kernel enciphered information of TOP V is come.Upper layer application lockable guidewire and kernel lock the system of cause mobile phone endlessly Sleep, increase the power consumption of mobile phone;When upper layer application wakes up mobile phone, the average current increase of mobile phone, if upper layer application repeatedly wakes up handss Machine, the power consumption of mobile phone substantially increase.
Step 202:Mobile phone judges to whether there is under catalogue/system/etc by consumption detection application Powertest.sh, if it does, execution step 203, otherwise, execution step 206.
Step 203:Mobile phone runs powertest.sh scripts by consumption detection application, obtains and preserve the power consumption of mobile phone Information.
Specifically, the application enciphered information in power consumption information, wake-up times are more than 100 by consumption detection application by mobile phone The mark of upper layer application be stored in three different files respectively with kernel enciphered information, and three files are saved in Under catalogue/sdcard/power.
Step 204:Mobile phone judges whether generate above three guarantor under catalogue/sdcard/power by consumption detection application The file of power consumption information is deposited, if it is, execution step 205, otherwise, continues to detect three preservation power consumptions whether are generated under the catalogue The file of information.
Step 205:Mobile phone shows in consumption detection application interface and obtains the power consumption information.
Mobile phone terminates this consumption detection after consumption detection application interface shows and obtains the power consumption information.
Step 206:Mobile phone reports an error and exits the consumption detection application.
Specifically, mobile phone runs the concrete grammar flow process for obtaining power consumption information for detecting and obtaining the script of power consumption information As shown in figure 3, specific as follows:
Step 301:Mobile phone is run for detecting and obtain in the script of power consumption information for calling Android system The instruction of dumpsys power orders, obtains the information for executing that the order is returned, and the information is saved as the first interim text Part.
Specifically, the information that mobile phone execution dumpsys power orders are returned includes herein below:
(1) whether the current power supply state of mobile phone, such as battery electric quantity are low, and whether display screen is ready to, for example,
Power Manager State:
MBatteryLevelLow=false
MLastWakeTime=0 (78762ms ago)
MLastSleepTime=0 (78762ms ago)
MDisplayReady=true
(2) setting related to electric quantity consumption of mobile phone, the high-high brightness of such as display screen, minimum brightness and acquiescence are bright Degree, goes out screen time etc. automatically, for example,
Settings and Configuration:
MScreenBrightnessSettingMinimum=5
MScreenBrightnessSettingMaximum=255
MScreenBrightnessSettingDefault=69
Sleep timeout:-1ms
Screen off timeout:600000ms
Screen dim duration:7000ms
(3) cause the number of the upper layer application of the system not dormancy of mobile phone in locking state, and be in locking state Concrete upper layer application mark, for example,
Wake Locks:Size=2
PARTIAL_WAKE_LOCK'Checkin Service'(uid=10014, pid=2523, ws= WorkSource{10014com.google.android.gms})
PARTIAL_WAKE_LOCK'*net_scheduler*'(uid=10014, pid=2230, ws= WorkSource{10089com.google.android.youtube})
Suspend Blockers:Size=4
PowerManagerService.WakeLocks:Ref count=1
PowerManagerService.Display:Ref count=1
PowerManagerService.Broadcasts:Ref count=0
PowerManagerService.WirelessChargerDetector:Ref count=0
Wherein, " Wake Locks:Size=2 " represents that mobile phone currently has two upper layer applications to be in locking state;
(4) whether the display screen of mobile phone is opened, and current state of sensor etc. in mobile phone, for example,
Display Power:State=ON
Wireless Charger Detector State:
MGravitySensor={ Sensor name=" Gravity ", vendor=" QTI ", version=2, type =9, maxRange=156.9064, resolution=0..0095825195, power=1.2387085, minDelay= 10000}
Step 302:Mobile phone runs the pass comprising the information for mark in the upper layer application of locking state in the script The instruction of key word, parses to the first temporary file according to the keyword, obtains upper layer application enciphered information, and by the upper strata Application enciphered information saves as text.
Specifically, mobile phone runs crucial comprising " DOZE_WAKE_LOCK " or " PARTIAL_WAKE_LOCK " in the script The instruction of word, according to the information that the keyword obtains the upper layer application for being currently at locking state in the first temporary file, and will The mark output for being currently at the upper layer application of locking state is arrived in the power.txt files of catalogue/data/power.If Power.txt files are sky, then be not on the upper layer application of locking state in mobile phone.
For example, the mark of the upper layer application for being currently at locking state for preserving in power.txt files is as follows:
PARTIAL_WAKE_LOCK'Checkin Service'(uid=10014, pid=2523, ws= WorkSource{10014com.google.android.gms})
PARTIAL_WAKE_LOCK'*net_scheduler*'(uid=10014, pid=2230, ws= WorkSource{10089com.google.android.youtube})
In enforcement, mobile phone can also be run in the script comprising the upper layer application number for being in locking state for mark The instruction of keyword, according to the number that the keyword obtains the upper layer application in the first temporary file in locking state.Specifically Ground, mobile phone according in the script include " Wake Locks:" keyword instruction, obtain mobile phone to dumpsys power orders The number of the upper layer application in feedack in locking state, and the number of the upper layer application in locking state is preserved In power.txt files under catalogue/data/power.For example, preserve in power.txt files in locking state The number of upper layer application is as follows:
Wake Locks:Size=2
Step 303:Mobile phone runs the instruction of the dumpsys alarm orders for being used for calling Android system in the script, The information for executing that the order is returned is obtained, and the information is saved as the second temporary file.
Specifically, the information that mobile phone execution dumpsys alarm orders are returned includes herein below:
(1) status information of current real-time clock (Real-Time Clock, RTC), for example,
Current Alarm Manager state:
Pending alarm batches:12
Wherein, " Pending alarm batches:12 " represent that 12 intervalometers (ALARM) will be triggered.
(2) can the system of mobile phone enter dormancy, for example,
Broadcast ref count:0wakelock
Wherein, when count values are 0, represent that cell phone system can enter resting state;
(3) time of wake-up mobile phone comes the information of the upper layer application of top ten list, for example,
Top Alarms:
+9s89ms running,2wakeups,2alarms:u0a39:com.android.providers.calendar
*walarm*:com.android.providers.calendar.intent.CalendarProvider2
+1s211ms running,0wakeups,1alarms:1000:android
*alarm*:android.content.jobscheduler.JOB_DELAY_EXPIRED
+1s116ms running,2wakeups,2alarms:u0a23:com.android.vending
*walarm*:com.android.vending/ com.google.android.finsky.receivers.Flush LogsReceiver
(4) information of the upper layer application of ALARM, mark, wake-up times including the upper layer application, consumption are set in mobile phone Time etc., for example,
Alarm Stats:
1000:android+1s762ms running,0wakeups:
Wherein, " 0wakeups " represents that (upper layer application is designated 1000 to upper layer application:Android) only run but do not have There is the system of actual wake-up mobile phone.
Step 304:Mobile phone runs the pass of the information comprising the upper layer application for needing to wake up mobile phone for mark in the script The instruction of key word, parses to the second temporary file according to the keyword, obtain institute in need wake-up mobile phone upper layer application Information, and filter out information of the wake-up times more than 100 upper layer application, by upper layer application of the wake-up times more than 100 Mark saves as text.
Specifically, mobile phone runs:" keyword instruction, obtain the second temporary file in In need wake up mobile phone system upper layer application information, in the script that reruns include " 0wakeups:" keyword Instruction, removes only operation but the system of actual wake-up mobile phone from the information of the upper layer application of institute's wake-up system in need The information of upper layer application, running is used for the awk instructions for obtaining the data for meeting pre-conditioned in pending data in the script, will In the information of the upper layer application of the actual system for waking up mobile phone wake-up times more than 100 upper layer application information sifting out In, and the mark by wake-up times more than 100 upper layer application exports the alarm.txt files under catalogue/data/power In.
For example, mobile phone runs:" keyword instruction, from need wake up mobile phone Following result is obtained after the information for removing only operation but the unactual upper layer application for waking up system in the information of upper layer application:
u0a14:com.google.android.gms+52ms running,576wakeups:
u0a23:com.android.vending+1s127ms running,154wakeups:
u0a39:com.android.providers.calendar+9s89ms running,22wakeups:
Wherein, each content in every information is separated with space, and the Section 1 of every information is the mark of upper layer application, Section 4 is the wake-up times of the upper layer application.Mobile phone reruns awk instructions in the script should by the actual upper strata for waking up mobile phone In information wake-up times more than 100 upper layer application information sifting out in, and by wake-up times more than 100 upper strata To in the alarm.txt files under catalogue/data/power, wherein, the content that this document is preserved is for the mark output of application:
u0a14:com.google.android.gms
u0a23:com.android.vending
In enforcement, mobile phone runs:" keyword instruction, obtain institute's wake-up handss in need After the information of the upper layer application of machine, awk instructions in the script can be directly run, by the upper layer application of the actual system for waking up mobile phone Information in wake-up times more than 100 upper layer application information sifting out, and by wake-up times more than 100 upper layer application Mark can export in the alarm.txt files under catalogue/data/power.
Step 305:Mobile phone runs is used for the dumpsys batterystats orders for calling Android system in the script Instruction, obtain the information for executing that the order is returned, and the information saved as the 3rd temporary file.
Specifically, the information that mobile phone execution dumpsys batterystats orders are returned includes herein below:
(1) time serieses with mobile phone electricity related data, for example,
(2%used, 6236used of 256KB, 42strings using are 3854) for Battery History:
0(9)RESET:TIME:1970-01-01-08-22-55
0 (3) 064status=discharging health=good plug=none temp=402volt= 7888+running
(2) duration that each process is executed in mobile phone, for example,
Per-PID Stats:
PID 1206wake time:+8s532ms
PID 2194wake time:+21s282ms
(3) mobile phone charged from last time and starts the statistical data of calculating, for example,
Statistics since last charge:
System starts:4,currently on battery:false
Time on battery:4h 37m 52s 556ms (94.3%) realtime, 35m 55s 323ms (12.2%) uptime
(4) the electric quantity consumption statistics of mobile phone, for example,
Estimated power use(mAh):
Capacity:2000,Computed drain:142,actual drain:0
Screen:75.9
(5) wake-up lock (WAKELOCK) information in all kernels, wherein, the WAKELOCK information is according to the duration for locking Arrange from big to small, for example,
All kernel wake locks:
Kernel Wake lock PowerManagerService.WakeLocks:20s 646ms(28times) realtime
Kernel Wake lock PowerManagerService.Display:17s 768ms(14times) realtime
Kernel Wake lock[timerfd]:3s 664ms(76times)realtime
Kernel Wake lock PowerManagerService.Broadcasts:1s 872ms(12times) realtime
Step 306:Mobile phone is run comprising for identifying the instruction of the keyword of kernel enciphered information in the script, according to this Keyword is parsed to the 3rd temporary file, obtains all kernel enciphered informations, and filter out all kernel enciphered informations by Lock after duration order arrangement from big to small according to kernel, come the kernel enciphered information of first five, the kernel enciphered information is protected Save as text.
Specifically, mobile phone runs the instruction comprising " Kernel Wake lock " keyword in the script, obtains mobile phone the All kernel enciphered informations in three temporary files, wherein, in the 3rd temporary file, the kernel enciphered information is according to locking duration Arrange from big to small, the title of the kernel locking function in every information that the awk that reruns instructions will be obtained, locking duration are extracted Out, the head that finally running is used for obtaining in the script data for starting to preset line number in pending data from the first row refers to Order, will instruct the battery.txt texts in the information for obtaining under first five information output to catalogue/data/power by awk In part.
For example, mobile phone runs the instruction comprising " Kernel Wake lock " keyword in the script, obtains mobile phone the 3rd All kernel enciphered informations in temporary file are as follows:
Kernel Wake lock netmgr_wl:1m 12s 396ms(0times)realtime
Kernel Wake lock nfcwakelock:2s 0ms(1times)realtime
Kernel Wake lock usbin_irq_lock:604ms(1times)realtime
Kernel Wake lock msm_otg:299ms(1times)realtime
Kernel Wake lock PowerManagerService.Display:252ms(1times)realtime
Kernel Wake lock PowerManagerService.WakeLocks:211ms(13times)realtime
Kernel Wake lock PowerManagerService.Broadcasts:66ms(2times)realtime
Wherein, each content in every information is separated with space, and the Section 4 of every information is kernel locking function Title, if the locking duration of kernel lock is not less than 1 minute, Section 5 is the number of minutes of the kernel lock, and Section 6 is the kernel Second number of lock, if the locking duration of kernel lock is less than 1 minute, Section 5 is second number of the kernel lock.
Mobile phone runs awk instructions in the script and extracts the title of the kernel locking function in above- mentioned information, locking duration Out, and head instructions are run in the script, will pass through in the information of awk instruction acquisitions first five information output to catalogue/ In battery.txt files under data/power, the content that battery.txt files are preserved is as follows:
netmgr_wl:1m
nfcwakelock:2s
usbin_irq_lock:604ms
msm_otg:299ms
PowerManagerService.Display:252ms
Kernel only one of which WAKELOCK of general mobile phone, mobile phone run the script from execution dumpsys The five kernel enciphered informations obtained in the information that batterystats orders are returned have been completely covered the information of kernel locking, Achieve effective parsing that the information that dumpsys batterystats orders are returned is executed to mobile phone.
Step 307:Mobile phone runs deletes the instruction of temporary file, delete the first temporary file, second Temporary file and the 3rd temporary file, will preserve the upper layer application of the file, wake-up times of upper layer application enciphered information more than 100 The file of mark and the catalogue specified to consumption detection application of the file copy of kernel enciphered information in.
Same inventive concept is based on, a kind of device for obtaining power consumption information, the dress in second embodiment of the invention, is provided Put and can dispose in the terminal, the description for being embodied as can be found in embodiment of the method part of the device repeats part and no longer goes to live in the household of one's in-laws on getting married State, as shown in figure 4, the device mainly includes:
Calling module 401, for calling for detecting and obtaining the script of power consumption information, wherein, the power consumption information is used In the factor that description affects power consumption of terminal;
Acquisition module 402, obtains power consumption information and preserves the power consumption information for running the script.
In optional embodiment, the acquisition module 402 specifically for:The first instruction run in the script is obtained Log information, and the second instruction in the script is run, according to the indicated keyword of the described second instruction from the day The corresponding power consumption information of keyword described in will acquisition of information.
In optional embodiment, the acquisition module 402 is additionally operable to:The first instruction run in the script obtains day After will information, before running the second instruction in the script, the daily record is believed by the 3rd instruction run in the script Breath saves as temporary file.
In optional embodiment, the power consumption information includes:The upper layer application enciphered information of the terminal, the terminal Wake-up times more than preset value upper layer application mark and/or the kernel enciphered information of the terminal, wherein, the upper strata Application enciphered information at least includes that the mark of the upper layer application in locking state, the kernel enciphered information include the kernel The title of locking function, the kernel lock duration, the kernel enciphered information be the terminal kernel enciphered information by Lock after duration order arrangement from big to small according to kernel, top n kernel enciphered information, N are the integer not less than 1.
In optional embodiment, described device also includes:Display module 403, for showing the power consumption information.
Above-mentioned technical proposal is based on, in the embodiment of the present invention, terminal is called for detecting and obtaining the script of power consumption information, Run the script and obtain and preserve power consumption information, wherein, the power consumption information is used for describing the factor for affecting power consumption of terminal so that survey When examination personnel obtain power consumption of terminal information, it is not necessary to be connected terminal with other equipment, shorten the consumption detection time, reduce Requirement to tester.Also, after the terminal operating script obtains power consumption information, the power consumption information is preserved in the terminal, Terminal is solved because the factor such as deadlock or abnormal shutdown causes the log information of terminal to be lost so that the power consumption of terminal cannot be obtained The problem of information.
In addition, after the first instruction in the terminal operating script obtains log information, running the 3rd in the script The log information is saved as temporary file by instruction, obtains power consumption information further according to the second instruction from the temporary file, when When the temporary file is larger, it is possible to increase terminal obtains the efficiency of power consumption information.After the terminal operating script obtains power consumption information, Show the power consumption information so that user can be visually known the power consumption information of terminal.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can adopt complete hardware embodiment, complete software embodiment or with reference to software and hardware in terms of reality Apply the form of example.And, the present invention can be adopted in one or more computers for wherein including computer usable program code The shape of the upper computer program that implements of usable storage medium (including but not limited to disk memory and optical memory etc.) Formula.
The present invention is the flow process with reference to method according to embodiments of the present invention, equipment (system) and computer program Figure and/or block diagram are describing.It should be understood that can be by computer program instructions flowchart and/or each stream in block diagram Journey and/or the combination of square frame and flow chart and/or the flow process in block diagram and/or square frame.These computer programs can be provided Instruct the processor of general purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine so that produced for reality by the instruction of computer or the computing device of other programmable data processing devices The device of the function of specifying in present one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in and can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory is produced to be included referring to Make the manufacture of device, the command device realize in one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or The function of specifying in multiple square frames.
These computer program instructions can be also loaded in computer or other programmable data processing devices so that in meter Series of operation steps is executed on calculation machine or other programmable devices to produce computer implemented process, so as in computer or The instruction executed on other programmable devices is provided for realization in one flow process of flow chart or multiple flow processs and/or block diagram one The step of function of specifying in individual square frame or multiple square frames.
Obviously, those skilled in the art can carry out the essence of various changes and modification without deviating from the present invention to the present invention God and scope.So, if these modifications of the present invention and modification belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising these changes and modification.

Claims (10)

1. a kind of obtain power consumption information method, it is characterised in that methods described includes:
Terminal is called for detecting and obtaining the script of power consumption information, wherein, and the power consumption information is used for describing affects terminal work( The factor of consumption;
Script described in the terminal operating obtains power consumption information and preserves the power consumption information.
2. the method for claim 1, it is characterised in that script described in the terminal operating obtains power consumption information, specifically Including:
The first instruction in script described in the terminal operating obtains log information, and runs the second finger in the script Order, obtains the corresponding power consumption information of the keyword according to the indicated keyword of the described second instruction from the log information.
3. method as claimed in claim 2, it is characterised in that the first instruction in script described in the terminal operating obtains day After will information, before running the second instruction in the script, methods described also includes:
The log information is saved as temporary file by the 3rd instruction in script described in the terminal operating.
4. the method as described in claim 1-3 any one, it is characterised in that the power consumption information includes:The terminal Upper layer application enciphered information, the wake-up times of the terminal are more than the mark and/or the terminal of the upper layer application of preset value Kernel enciphered information, wherein, the upper layer application enciphered information at least includes the mark of the upper layer application in locking state, institute State the duration that kernel enciphered information includes that the title of the kernel locking function, the kernel are locked, the kernel enciphered information Kernel enciphered information for the terminal is locked after duration order arrangement from big to small according to kernel, and top n kernel locks letter Breath, N is the integer not less than 1.
5. the method as described in claim 1-3 any one, it is characterised in that methods described also includes:
The terminal shows the power consumption information.
6. a kind of obtain power consumption information device, it is characterised in that described device includes:
Calling module, for calling for detecting and obtaining the script of power consumption information, wherein, the power consumption information is used for describing shadow Ring the factor of power consumption of terminal;
Acquisition module, obtains power consumption information and preserves the power consumption information for running the script.
7. device as claimed in claim 6, it is characterised in that the acquisition module specifically for:
Run the first instruction in the script and obtain log information, and run the second instruction in the script, according to institute State the keyword indicated by the second instruction the corresponding power consumption information of the keyword is obtained from the log information.
8. device as claimed in claim 7, it is characterised in that the acquisition module is additionally operable to:
After running the first instruction acquisition log information in the script, before running the second instruction in the script, fortune The log information is saved as temporary file by the 3rd instruction in the row script.
9. the device as described in claim 6-8 any one, it is characterised in that the power consumption information includes:The terminal Upper layer application enciphered information, the wake-up times of the terminal are more than the mark and/or the terminal of the upper layer application of preset value Kernel enciphered information, wherein, the upper layer application enciphered information at least includes the mark of the upper layer application in locking state, institute State the duration that kernel enciphered information includes that the title of the kernel locking function, the kernel are locked, the kernel enciphered information Kernel enciphered information for the terminal is locked after duration order arrangement from big to small according to kernel, and top n kernel locks letter Breath, N is the integer not less than 1.
10. the device as described in claim 6-8 any one, it is characterised in that described device also includes:
Display module, for showing the power consumption information.
CN201610900069.9A 2016-10-14 2016-10-14 A kind of method and device obtaining power consumption information Active CN106502860B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610900069.9A CN106502860B (en) 2016-10-14 2016-10-14 A kind of method and device obtaining power consumption information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610900069.9A CN106502860B (en) 2016-10-14 2016-10-14 A kind of method and device obtaining power consumption information

Publications (2)

Publication Number Publication Date
CN106502860A true CN106502860A (en) 2017-03-15
CN106502860B CN106502860B (en) 2019-05-21

Family

ID=58293731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610900069.9A Active CN106502860B (en) 2016-10-14 2016-10-14 A kind of method and device obtaining power consumption information

Country Status (1)

Country Link
CN (1) CN106502860B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020093284A1 (en) * 2018-11-07 2020-05-14 深圳市欢太科技有限公司 Application information processing method, computer-readable storage medium and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150208352A1 (en) * 2014-01-22 2015-07-23 Seven Networks, Inc. Method for power saving in mobile devices by optimizing wakelocks
CN105786671A (en) * 2016-02-26 2016-07-20 厦门美图移动科技有限公司 Method and device for detecting application generating power consumption and computing device
CN105786698A (en) * 2014-12-25 2016-07-20 展讯通信(上海)有限公司 Script-based power consumption automatic test system for mobile terminal
CN105785113A (en) * 2014-12-25 2016-07-20 展讯通信(上海)有限公司 System and method for automatically testing power consumption

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150208352A1 (en) * 2014-01-22 2015-07-23 Seven Networks, Inc. Method for power saving in mobile devices by optimizing wakelocks
CN105786698A (en) * 2014-12-25 2016-07-20 展讯通信(上海)有限公司 Script-based power consumption automatic test system for mobile terminal
CN105785113A (en) * 2014-12-25 2016-07-20 展讯通信(上海)有限公司 System and method for automatically testing power consumption
CN105786671A (en) * 2016-02-26 2016-07-20 厦门美图移动科技有限公司 Method and device for detecting application generating power consumption and computing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020093284A1 (en) * 2018-11-07 2020-05-14 深圳市欢太科技有限公司 Application information processing method, computer-readable storage medium and electronic device

Also Published As

Publication number Publication date
CN106502860B (en) 2019-05-21

Similar Documents

Publication Publication Date Title
WO2021068624A1 (en) Systems and methods for power outage protection of storage device
CN102141942B (en) A kind of monitoring and protection method of equipment and device
US20220335127A1 (en) Side-channel exploit detection
CN104272786A (en) System, apparatus, and method for adaptive observation of mobile device behavior
CN102946468A (en) Automatic mobile phone operating program abnormality alarming method and system
Qian et al. Jade: An efficient energy-aware computation offloading system with heterogeneous network interface bonding for ad-hoc networked mobile devices
CN104932963B (en) The method and device of management terminal
US20130055267A1 (en) Information processing apparatus, computer-readable recording medium, and method for controlling information
CN109918141A (en) Thread execution method, device, terminal and storage medium
US10324784B2 (en) Mitigating crashes of an application server executing a monitoring agent
Okoshi et al. Attelia: Sensing user's attention status on smart phones
CN102262434A (en) Method and apparatus for modifying a transition to an altered power state of an electronic device based on accelerometer output
US8880792B2 (en) Memory watch
CN106197468A (en) The method and system that pedometer step number updates
CN106249840A (en) Power saving non-volatile microprocessor
CN106897219A (en) mobile terminal system stability test method and device
CN104063316B (en) The method of testing and device of a kind of application
CN106650409B (en) A kind of terminal control method and terminal
CN106055404A (en) Method and device for cleaning up background application programs
CN106502860B (en) A kind of method and device obtaining power consumption information
CN109686135A (en) A kind of bilingual intelligence development software and application method
CN106155704A (en) A kind of method and system stoping application program mutually to wake up up
Wang et al. Wlcleaner: Reducing energy waste caused by wakelock bugs at runtime
CN105893221A (en) Terminal operation time length alarming method and device
TWI656441B (en) Standby abnormal power consumption detecting system and method

Legal Events

Date Code Title Description
C06 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
CP01 Change in the name or title of a patent holder

Address after: 266071 Shandong city of Qingdao province Jiangxi City Road No. 11

Patentee after: Qingdao Hisense Mobile Communication Technology Co.,Ltd.

Address before: 266071 Shandong city of Qingdao province Jiangxi City Road No. 11

Patentee before: HISENSE MOBILE COMMUNICATIONS TECHNOLOGY Co.,Ltd.

CP01 Change in the name or title of a patent holder