WO2019237751A1 - 一种移动应用的功耗检测方法及*** - Google Patents

一种移动应用的功耗检测方法及*** Download PDF

Info

Publication number
WO2019237751A1
WO2019237751A1 PCT/CN2019/073516 CN2019073516W WO2019237751A1 WO 2019237751 A1 WO2019237751 A1 WO 2019237751A1 CN 2019073516 W CN2019073516 W CN 2019073516W WO 2019237751 A1 WO2019237751 A1 WO 2019237751A1
Authority
WO
WIPO (PCT)
Prior art keywords
power consumption
mobile application
phase
screen
running
Prior art date
Application number
PCT/CN2019/073516
Other languages
English (en)
French (fr)
Inventor
伍楷舜
李雪亮
Original Assignee
深圳大学
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 深圳大学 filed Critical 深圳大学
Publication of WO2019237751A1 publication Critical patent/WO2019237751A1/zh

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
    • G06F11/3612Software analysis for verifying properties of programs by runtime analysis

Definitions

  • the present invention relates to a power consumption detection method, in particular to a power consumption detection method for a mobile application, and to a power consumption detection system adopting the mobile application power consumption detection method.
  • the technical problem to be solved by the present invention is to provide a mobile application that can more effectively detect whether a mobile application is Whether there is a power consumption detection method for the power consumption problem; and further provides a power consumption detection system using the power consumption detection method of the mobile application.
  • the present invention provides a method for detecting power consumption of a mobile application, including the following steps:
  • Step S1 generating test inputs and operating environment parameters
  • Step S2 run a mobile application under the test input and operating environment parameters, and collect power consumption information of the mobile application under the test input and operating environment parameters;
  • Step S3 analyzing the power consumption information to identify whether there is a power consumption problem
  • the test input and operating environment parameters are parameters in a state where the wireless signal is shielded; the state where the wireless signal is shielded includes a network fault state and a flight mode state.
  • a further improvement of the present invention is that, in the step S1, a test input and a running environment parameter are generated in a random or problem trigger mode.
  • test input and the running environment parameters are generated by automatically generating a random user input sequence, and the user input sequence includes an input sequence corresponding to a touch screen and a swipe screen.
  • a further improvement of the present invention is that the problem trigger mode includes at least one of a travel positioning background operation trigger mode, a browser background operation trigger mode, and a multimedia playback failure trigger mode.
  • step S3 includes the following sub-steps:
  • Step S301 analyze the power consumption information of the mobile application under the test input and operating environment parameters, and determine whether there is a power consumption problem, otherwise return to step S1, and if so, skip to step S302;
  • Step S302 recording the power consumption problem, and analyzing and judging whether the power consumption problem belongs to a new problem trigger mode, if otherwise, return to step S1, and if yes, go to step S303;
  • Step S303 Record the power consumption problem in the problem trigger mode.
  • a further improvement of the present invention is that in the step S301, analyzing the power consumption information of the mobile application under the test input and operating environment parameters includes analyzing a lock screen state phase, a screen opening phase, an application running phase, The power consumption information is placed in the background phase and the screen-standby phase, and then the power consumption information of the five phases satisfies a preset power consumption range, thereby determining whether there is a power consumption problem.
  • a further improvement of the present invention is that the preset power consumption range is set to a normal distribution of power consumption of the test case of the mobile application, and by determining whether the power consumption information of the five stages is equal to the power consumption Normal distribution It is consistent, if otherwise, it is determined that there is a power consumption problem in the foreground operation.
  • a further improvement of the present invention is to determine whether there is a power consumption problem running in the background by analyzing the relationship between the average power consumption in the screen-on stage and the average power consumption in the background stage. If the average power consumption in the background stage is more than 40% higher than the average power consumption in the screen-on stage, it is determined that there is a power consumption problem running in the background.
  • a further improvement of the present invention is to determine whether there is a power consumption problem of running in the background by analyzing the relationship between the average power consumption in the screen-standby state phase and the average power consumption in the lock-screen state phase. If the average power consumption in the standby state of the screen is more than 50% higher than the average power consumption in the state of the lock screen, it is determined that the mobile application has a problem of power consumption without sleep.
  • the present invention also provides a power consumption detection system for a mobile application, which adopts the power consumption detection method for a mobile application as described above.
  • the present invention has the beneficial effects of: simulating a special operating environment such as a network component failure by generating the test input and operating environment parameters, and then operating under this special operating environment And testing mobile applications, we can find more hidden deep power consumption problems; after testing, it is found that 84% of the power consumption problems detected by the present invention are not detected by the prior art, and these power consumption problems are repaired , Can extend the battery life of smart terminals such as mobile phones to about twice the existing technology.
  • FIG. 1 is a schematic diagram of a work flow according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of analyzing power consumption information of a mobile application in five stages according to an embodiment of the present invention.
  • this example provides a method for detecting power consumption of a mobile application, including the following steps: [0028] Step S1, generating test inputs and operating environment parameters;
  • Step S2 running a mobile application under the test input and operating environment parameters, and collecting power consumption information of the mobile application under the test input and operating environment parameters;
  • Step S3 analyzing the power consumption information to identify whether there is a power consumption problem
  • the test input and operating environment parameters are parameters in a state where the wireless signal is shielded; the state where the wireless signal is shielded includes a network fault state and a flight mode state.
  • test input and operating environment parameters are generated by using a random or problem trigger mode.
  • a pressure test is applied to the mobile application, that is, a large number of test cases are used to test the target mobile application.
  • test input and operating environment are different. These test inputs and running environments may be randomly generated, or generated according to the problem trigger mode, as described below.
  • This example uses Monkey to automatically generate a random user input sequence.
  • the Monkey is an Android application testing tool developed by Google.
  • the user input sequence includes the corresponding sequences for touch screen and swipe screen respectively.
  • this example also designed two special operating environments, namely Network Fail and Flight Mode. In the Network Fail operating environment, the wireless network signals are extremely weak, and the transmission delay of the data packet is 451
  • the smart mobile terminal such as a mobile phone is placed in a wireless signal shielding room to implement the test, and then it can be run and tested in the operating environment of Network Fail and Flight Mode.
  • the software layer is closed.
  • a test input and a running environment parameter can be generated by automatically generating a random user input sequence, and the user input sequence includes an input sequence corresponding to a touch screen and a swipe screen.
  • the problem trigger mode described in this example includes at least one of a travel positioning background operation trigger mode, a browser background operation trigger mode, and a multimedia playback fault trigger mode.
  • the travel positioning runs in the background
  • the implementation of the trigger mode includes the following steps: Turn on the GPS component in the mobile application, place the mobile application in the background, and then make the screen go out automatically.
  • the implementation of the browser background trigger mode includes the following steps:
  • the plug-in webpage will run the browser in the background; that is, the webpage requires a flash plug-in program.
  • the implementation of the multimedia playback fault trigger mode includes the following conditions: When playing a streaming media, a network fault occurs.
  • the problem trigger mode described in this example refers to common test inputs and operating environment parameters that can trigger power consumption problems. For example, for streaming media applications, the network suddenly fails during streaming media playback. This situation (problem trigger mode) can easily trigger power consumption problems.
  • the operating environment parameters described in this example refer to the special operating environment when the application is running, including situations where the signals of WiFi and cellular networks are extremely weak, situations where GPS signals are extremely weak, and mobile devices.
  • the failure of the WiFi and cellular network components and the failure of the GPS components, etc., are parameters in a state where the wireless signal is shielded.
  • step S3 in this example includes the following sub-steps:
  • Step S301 analyze the power consumption information of the mobile application under the test input and operating environment parameters, and determine whether there is a power consumption problem, if not, return to step S1, and if yes, skip to step S302;
  • Step S302 recording the power consumption problem, and analyzing and judging whether the power consumption problem belongs to a new problem trigger mode, if not, return to step S1, and if yes, go to step S303;
  • Step S303 Record the power consumption problem in the problem trigger mode.
  • the problem trigger mode described in this example refers to a process that may trigger a power consumption problem, and includes at least one of a travel positioning background operation trigger mode, a browser background operation trigger mode, and a multimedia playback fault trigger mode.
  • this example designs a specific input sequence to apply the corresponding operating environment to achieve the corresponding problem trigger mode.
  • the criterion for determining the problem trigger mode is: The problem trigger mode has triggered one or more power consumption problems in the test. This guarantees that the problem trigger mode is more likely to trigger power consumption problems than normal, because it has already triggered one or more power consumption problems. And the problem trigger mode can be implemented in the test case, because the test case is based on user input and operating environment. For those power consumption issues that need to be modified by source code, the test case in this example cannot be covered. . [0045] After the test input and the running environment are determined, this example will run the application software with the input sequence under the running environment. During the test, the power consumption information of the device is recorded in real time using the power consumption detector.
  • Step S3 in this example is a step in the data analysis phase.
  • this example will determine whether the use case has a power consumption problem by analyzing the power consumption information. If there is a power consumption problem, record the power consumption problem and analyze whether the problem is triggered by the new problem trigger mode; if the power consumption problem is triggered by the new problem trigger mode, record the power consumption problem Problem trigger mode.
  • the recorded content includes the user input information and operating environment information required to trigger the power consumption problem. If no power consumption problem is identified or the problem is not triggered by the new "problem trigger mode", the entire test is restarted. Process.
  • step S3 If no power consumption problem or a problem not triggered by the new problem trigger mode is identified in step S3, it is preferred to automatically restart the entire detection process, that is, return to step S1 to facilitate real-time monitoring of the running status of the mobile application .
  • analyzing the power consumption information of the mobile application under the test input and operating environment parameters includes analyzing a lock screen state (PRE-OFF) and turning on the screen.
  • Phase I DLE
  • application operation phase EXECUTION
  • BACKGROUND background phase
  • SCREEN-OFF screen standby state phase
  • the lock screen state phase in this example is also referred to as PRE-OFF, which refers to the stage where the mobile phone is in the lock screen state.
  • PRE-OFF refers to the stage where the mobile phone is in the lock screen state.
  • the phone enters the IDLE phase, that is, the screen phase is turned on.
  • the EXECUTION phase that is, the application running phase.
  • the test case entered the BACKGROUND phase, which is the background phase.
  • the screen goes through a standby state, the screen is automatically screened. After the screen is closed, the use case enters the final phase, the SCREEN-OFF phase, which is the screen standby mode.
  • This example divides the test cases into five stages to help us identify three types of power consumption problems: foreground operation problems, background operation problems, and no sleep problems.
  • this example In order to identify the foreground operation problem, this example considers the power consumption of all test cases of each application as a normal distribution, and marks test cases that are two standard deviations larger than the average power consumption as possible power consumption problems. Use example. Finally, this example analyzes these test cases to determine if they really have power issues.
  • the preset power consumption range is set to a normal distribution of power consumption of the test case of the mobile application, and by determining whether the power consumption information of the five stages is consistent with the normal distribution of power consumption It is consistent, if otherwise, it is determined that there is a power consumption problem in the foreground operation.
  • This example determines whether there is a power consumption problem running in the background by analyzing the relationship between the average power consumption in the screen-on stage and the average power consumption in the background stage. If the average power consumption is more than 40% higher than the average power consumption in the screen-on phase, it is determined that there is a power consumption problem running in the background. In practical applications, the value of 40% can be adaptively adjusted according to customer needs, such as the first power consumption threshold set by the user. When the average power consumption in the background stage is greater than the screen opening stage, If the average power consumption is as high as the first power consumption threshold, it is determined that there is a power consumption problem running in the background.
  • This example determines whether there is a power consumption problem running in the background by analyzing the relationship between the average power consumption in the screen-standby state phase and the average power consumption in the lock-screen state phase.
  • the average power consumption in the state phase is more than 50% higher than the average power consumption in the lock screen state phase, it is determined that the mobile application has a power consumption problem without sleep.
  • this value of 50% can be adaptively adjusted according to customer needs, such as a second power consumption threshold set by the user.
  • the average power consumption during the standby state of the screen is greater than the lock screen, If the average power consumption in the state phase is as high as the second power consumption threshold, it is determined that there is a power consumption problem without sleep.
  • This example also provides a power consumption detection system for a mobile application, which uses the power consumption detection method for a mobile application as described above.
  • this example simulates a special operating environment such as a network component failure by generating the test inputs and operating environment parameters, and then running and testing mobile applications in this special operating environment can find more Hidden deeper power consumption problems; after testing, it is found that 84% of the power consumption problems detected by the present invention are not detected by the prior art, and repairing these power consumption problems can replace the battery of smart terminals such as mobile phones The battery life is extended to about twice that of the prior art.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)

Abstract

本发明提供一种移动应用的功耗检测方法及***,所述移动应用的功耗检测方法包括以下步骤:步骤S1,生成测试输入和运行环境参数;步骤S2,在所述测试输入和运行环境参数下运行移动应用,同时收集所述移动应用在所述测试输入和运行环境参数下的功耗信息;步骤S3,分析功耗信息以识别是否存在功耗问题。本发明通过生成所述测试输入和运行环境参数进而模拟出网络部件出现故障等特殊的运行环境,进而在这种特殊的运行环境下运行和测试移动应用,能够发现更多的隐藏较深的功耗问题;经测试发现,本发明所检测出来的84%的功耗问题是现有技术所没有检测出来的,而修复这些功耗问题,可以将移动终端的电池续航时间延长至约为现在的两倍左右。

Description

一种移动应用的功耗检测方法及*** 技术领域
[0001] 本发明涉及一种功耗检测方法, 尤其涉及一种移动应用的功耗检测方法, 并涉 及采用了该移动应用的功耗检测方法的功耗检测***。
背景技术
[0002] 近十几年, 移动设备的用户数量的增长是***式的。 在 2014年初, 智能移动设 备以 17亿台的市场占有量超过了台式和便携式电脑; 到 2017年, 智能移动设备 的市场占有量超过了 19亿台。 伴随着移动设备的市场占有量越来越高, 人们对 电子设备的使用习惯也发生了变化, 即使移动设备并没有完全取代其他电子设 备, 但是用户花在移动设备上的时间越来越多, 到 2015年, 移动设备的使用时 间已经超过了其他设备的总和。
[0003] 但是, 移动设备的电池电量非常有限, 低功耗已经是移动应用的最重要设计指 标之一, 在大部分情况下, 正常使用的智能手机, 续航时间却很难超过 24小时 。 我们随机抽取了 89个高质量移动应用, 发现超过三分之一的应用存在严重的 功耗问题; 这些功耗问题可以在几小时内将电池消耗殆尽, 很多用户甚至因此 决定永久不再使用这些应用了。
[0004] 目前大部分关于移动设备的功耗优化的研究都是专注于单个部件, 其实, 虽然 各个硬件部件也在耗电, 但移动应用通过软件控制硬件, 因此, 如果能够做到 软件优化就可以节约 50%到 80%的整体电能, 这是单个硬件优化难以达到的效果 , 所以, 如果能很好地发现移动应用的功耗问题, 其实是未来修复功耗问题的 根本先决条件。
发明概述
技术问题
问题的解决方案
技术解决方案
[0005] 本发明所要解决的技术问题是需要提供一种能够更加有效地检测出移动应用是 否存在功耗问题的功耗检测方法; 并进一步提供采用了该移动应用的功耗检测 方法的功耗检测***。
[0006] 对此, 本发明提供一种移动应用的功耗检测方法, 包括以下步骤:
[0007] 步骤 S1, 生成测试输入和运行环境参数;
[0008] 步骤 S2, 在所述测试输入和运行环境参数下运行移动应用, 同时收集所述移动 应用在所述测试输入和运行环境参数下的功耗信息;
[0009] 步骤 S3 , 分析功耗信息以识别是否存在功耗问题;
[0010] 其中, 所述步骤 S1中, 所述测试输入和运行环境参数为无线信号被屏蔽状态下 的参数; 所述无线信号被屏蔽的状态包括网络故障状态和飞行模式状态。
[0011] 本发明的进一步改进在于, 所述步骤 S 1中, 通过随机或是问题触发模式生成测 试输入和运行环境参数。
[0012] 本发明的进一步改进在于, 通过自动生成随机的用户输入序列来生成测试输入 和运行环境参数, 所述用户输入序列包括触屏和划屏所对应的输入序列。
[0013] 本发明的进一步改进在于, 所述问题触发模式包括旅行定位后台运行触发模式 、 浏览器后台运行触发模式和多媒体播放故障触发模式中的至少一种。
[0014] 本发明的进一步改进在于, 所述步骤 S3包括以下子步骤:
[0015] 步骤 S301, 分析所述移动应用在所述测试输入和运行环境参数下的功耗信息, 并判断是否存在功耗问题, 若否则返回步骤 S1, 若是则跳转至步骤 S302;
[0016] 步骤 S302, 记录所述功耗问题, 并分析和判断所述功耗问题是否属于新的问题 触发模式, 若否则返回步骤 S1, 若是则跳转至步骤 S303 ;
[0017] 步骤 S303 , 将所述功耗问题记录至所述问题触发模式中。
[0018] 本发明的进一步改进在于, 所述步骤 S301中, 分析所述移动应用在所述测试输 入和运行环境参数下的功耗信息包括分析锁屏状态阶段、 开启屏幕阶段、 应用 运行阶段、 置于后台阶段以及息屏待机状态阶段共五个阶段的功耗信息, 然后 通过判断所述五个阶段的功耗信息是否分别满足预设功耗范围, 进而判断是否 存在功耗问题。
[0019] 本发明的进一步改进在于, 所述预设功耗范围设置为所述移动应用的测试用例 的耗电正态分布, 通过判断所述五个阶段的功耗信息是否与所述耗电正态分布 相符合, 若否则判断为存在前台运行的功耗问题。
[0020] 本发明的进一步改进在于, 通过分析所述开启屏幕阶段的平均功耗和所述置于 后台阶段的平均功耗之间的关系来判断是否存在后台运行的功耗问题, 若所述 置于后台阶段的平均功耗比所述开启屏幕阶段的平均功耗高 40%以上, 则判定为 存在后台运行的功耗问题。
[0021] 本发明的进一步改进在于, 通过分析所述息屏待机状态阶段的平均功耗和所述 锁屏状态阶段的平均功耗之间的关系来判断是否存在后台运行的功耗问题, 若 所述息屏待机状态阶段的平均功耗比所述锁屏状态阶段的平均功耗高 50%以上, 则判定为所述移动应用存在无睡眠的功耗问题。
[0022] 本发明还提供一种移动应用的功耗检测***, 采用了如上所述的移动应用的功 耗检测方法。
发明的有益效果
有益效果
[0023] 与现有技术相比, 本发明的有益效果在于: 通过生成所述测试输入和运行环境 参数进而模拟出网络部件出现故障等特殊的运行环境, 进而在这种特殊的运行 环境下运行和测试移动应用, 能够发现更多的隐藏较深的功耗问题; 经测试发 现, 本发明所检测出来的 84%的功耗问题是现有技术所没有检测出来的, 而修复 这些功耗问题, 可以将手机等智能终端的电池续航时间延长至大约为现有技术 的两倍左右。
对附图的简要说明
附图说明
[0024] 图 1是本发明一种实施例的工作流程示意图;
[0025] 图 2是本发明一种实施例分析移动应用共五个阶段的功耗信息的示意图。
发明实施例
本发明的实施方式
[0026] 下面结合附图, 对本发明的较优的实施例作进一步的详细说明。
[0027] 如图 1所示, 本例提供一种移动应用的功耗检测方法, 包括以下步骤: [0028] 步骤 Sl, 生成测试输入和运行环境参数;
[0029] 步骤 S2, 在所述测试输入和运行环境参数下运行移动应用, 同时收集所述移动 应用在所述测试输入和运行环境参数下的功耗信息;
[0030] 步骤 S3 , 分析功耗信息以识别是否存在功耗问题;
[0031] 其中, 所述步骤 S1中, 所述测试输入和运行环境参数为无线信号被屏蔽状态下 的参数; 所述无线信号被屏蔽的状态包括网络故障状态和飞行模式状态。
[0032] 申请人通过在手机的应用市场随机选择了 89个移动应用, 并阅读了它们的开发 文档, 发现 94.8%的功耗问题都是在特殊运行环境下引发的, 比如网络部件出现 故障的情况。 即, 在特殊环境下, 能够更有效地检测出移动应用的功耗问题。 本例所述步骤 S1中, 通过随机或是问题触发模式生成测试输入和运行环境参数
[0033] 本例在所述步骤 S1和步骤 S2的数据采集阶段, 对移动应用施加压力测试, 即通 过大量的测试用例去测试目标的移动应用。 对于每一个测试用例, 其测试输入 以及运行环境都是不同的。 这些测试输入和运行环境, 可以是随机产生的, 或 者是根据所述问题触发模式而生成的, 具体如下所述。
[0034] 本例使用了 Monkey来自动生成随机的用户输入序列, 所述 Monkey是一个 Googl e公司自己开发的 Android应用测试工具。 用户输入序列包括触屏和划屏所分别 对应的序列。 同时, 本例还设计了两种的特殊运行环境, 分别为网络故障状态 (Network Fail) 和飞行模式状态 (Flight Mode) 。 在网络故障状态 (Network Fail) 运行环境中, 无线网络信号都极弱, 数据包的传输延迟 451
ms , 下载速度 21KB/S; 而在正常运行环境中, 数据包的传输延迟为 36 ms, 下载 速度为 3.2MB/S。 因此, 本例通过将手机等智能移动终端放置在无线信号屏蔽室 中实现测试, 进而能够在网络故障状态 (Network Fail) 和飞行模式状态 (Flight Mode) 的运行环境中运行和测试, 网络部件在软件层被关闭。
[0035] 也就是说, 本例可以通过自动生成随机的用户输入序列来生成测试输入和运行 环境参数, 所述用户输入序列包括触屏和划屏所对应的输入序列。
[0036] 本例所述问题触发模式包括旅行定位后台运行触发模式、 浏览器后台运行触发 模式和多媒体播放故障触发模式中的至少一种。 其中, 所述旅行定位后台运行 触发模式的实现包括以下步骤: 在移动应用中开启 GPS部件, 将移动应用置于后 台运行, 然后使得屏幕自动熄灭。 所述浏览器后台运行触发模式的实现包括以 下步骤: 打开有 flash
plug-in的网页, 将浏览器置于后台运行; 即网页要求是有 flash插件程序的。 所述 多媒体播放故障触发模式的实现包括以下条件: 在播放流媒体的时候, 出现网 络故障。
[0037] 本例所述问题触发模式是指可以触发功耗问题的常见测试输入和运行环境参数 。 比如对于流媒体应用, 在流媒体播放时, 网络突然出现故障, 这种情况 (问 题触发模式) 就很容易触发功耗问题。
[0038] 需要特别指出的是, 本例所述运行环境参数, 是指应用运行时的特殊运行环 境, 包括了 WiFi和蜂窝网络的信号极弱的情况、 GPS信号极弱的情况、 移动设备 里 WiFi和蜂窝网络部件出现故障以及 GPS部件出现故障等情况等等, 即为无线信 号被屏蔽状态下的参数。
[0039] 如图 1所示, 本例所述步骤 S3包括以下子步骤:
[0040] 步骤 S301, 分析所述移动应用在所述测试输入和运行环境参数下的功耗信息, 并判断是否存在功耗问题, 若否则返回步骤 S1, 若是则跳转至步骤 S302;
[0041] 步骤 S302, 记录所述功耗问题, 并分析和判断所述功耗问题是否属于新的问题 触发模式, 若否则返回步骤 S1, 若是则跳转至步骤 S303 ;
[0042] 步骤 S303 , 将所述功耗问题记录至所述问题触发模式中。
[0043] 本例所述问题触发模式是指, 有可能触发功耗问题的过程, 包括旅行定位后台 运行触发模式、 浏览器后台运行触发模式和多媒体播放故障触发模式中的至少 一种。 对于具体的移动应用, 本例设计出具体的输入序列以施加相应的运行环 境来实现相应的问题触发模式。
[0044] 判断为问题触发模式的标准是: 该问题触发模式在测试中已经触发过一个或者 多个功耗问题。 这一点保证了该问题触发模式比一般情况更容易触发功耗问题 , 因为它已经触发过一个或者多个功耗问题。 而且该问题触发模式是可以在测 试用例中实现的, 因为测试用例是基于用户输入以及运行环境的, 对于那些需 要修改源代码才可以触发的功耗问题, 本例的测试用例是覆盖不到的。 [0045] 当确定了测试输入和运行环境之后, 本例将在该运行环境下以该输入序列去运 行应用软件。 在测试过程中, 全程使用功耗检测仪实时记录设备的功耗信息。
[0046] 本例所述步骤 S3为数据分析阶段的步骤, 在该阶段, 本例将通过分析功耗信息 , 确定该用例是不是存在功耗问题。 如果存在功耗问题, 就将该功耗问题记录 下来, 并分析该问题是不是由新的问题触发模式触发的; 如果是由新的问题触 发模式所触发的该功耗问题, 就记录下该问题触发模式, 记录的内容包括了触 发该功耗问题所需的用户输入信息以及运行环境信息; 如果没有识别出功耗问 题或者不是由新的“问题触发模式”触发的问题, 就重启整个检测流程。
[0047] 如果在所述步骤 S3中没有识别出功耗问题或者不是由新的问题触发模式所触发 的问题, 优选为自动重启整个检测流程, 即返回步骤 S1, 便于实时监测移动应 用的运行状态。
[0048] 如图 2所示, 本例所述步骤 S301中, 分析所述移动应用在所述测试输入和运行 环境参数下的功耗信息包括分析锁屏状态阶段 (PRE-OFF) 、 开启屏幕阶段 (I DLE) 、 应用运行阶段 (EXECUTION) 、 置于后台阶段 (BACKGROUND) 以 及息屏待机状态阶段 (SCREEN-OFF) 共五个阶段的功耗信息, 然后通过判断 所述五个阶段的功耗信息是否分别满足预设功耗范围, 进而判断是否存在功耗 问题。
[0049] 本例所述锁屏状态阶段也称 PRE-OFF, 是指手机处于锁屏状态的阶段。 当用户 开启屏幕时, 手机进入 IDLE阶段, 即开启屏幕阶段。 当用户打开目标应用并在 相应的运行环境下以相应的用户输入运行该应用时, 便进入 EXECUTION阶段, 即应用运行阶段。 在 EXECUTION阶段后, 我们通过输入“HOME”键将应用置于 后台, 此时, 测试用例进入了 BACKGROUND阶段, 即置于后台阶段。 当屏幕 经过一段待机状态, 自动息屏, 息屏后用例进入最后一个阶段, SCREEN-OFF 阶段, 即息屏待机状态阶段。
[0050] 本例把测试用例分为五个阶段是为了帮助我们识别出三类功耗问题: 前台运行 问题、 后台运行问题和无睡眠问题。
[0051] 为了识别出前台运行问题, 本例把每个应用的所有测试用例的耗电量看作正态 分布, 将大于平均耗电量两个标准差的测试用例标注为可能存在功耗问题的用 例。 最后, 本例通过分析这些测试用例, 确定他们是否真的有功耗问题。
[0052] 也就是说, 所述预设功耗范围设置为所述移动应用的测试用例的耗电正态分布 , 通过判断所述五个阶段的功耗信息是否与所述耗电正态分布相符合, 若否则 判断为存在前台运行的功耗问题。
[0053] 本例通过分析所述开启屏幕阶段的平均功耗和所述置于后台阶段的平均功耗之 间的关系来判断是否存在后台运行的功耗问题, 若所述置于后台阶段的平均功 耗比所述开启屏幕阶段的平均功耗高 40%以上, 则判定为存在后台运行的功耗问 题。 在实际应用中, 40%这个数值可以根据客户的需求进行适应性调整, 比如调 整为用户自定义设置的第一功耗阈值, 当所述置于后台阶段的平均功耗比所述 开启屏幕阶段的平均功耗高达第一功耗阈值, 则判定为存在后台运行的功耗问 题。
[0054] 本例通过分析所述息屏待机状态阶段的平均功耗和所述锁屏状态阶段的平均功 耗之间的关系来判断是否存在后台运行的功耗问题, 若所述息屏待机状态阶段 的平均功耗比所述锁屏状态阶段的平均功耗高 50%以上, 则判定为所述移动应用 存在无睡眠的功耗问题。 在实际应用中, 50%这个数值可以根据客户的需求进行 适应性调整, 比如调整为用户自定义设置的第二功耗阈值, 当所述息屏待机状 态阶段的平均功耗比所述锁屏状态阶段的平均功耗高达第二功耗阈值, 则判定 为存在无睡眠的功耗问题。
[0055] 本例还提供一种移动应用的功耗检测***, 采用了如上所述的移动应用的功耗 检测方法。
[0056] 综上, 本例通过生成所述测试输入和运行环境参数进而模拟出网络部件出现故 障等特殊的运行环境, 进而在这种特殊的运行环境下运行和测试移动应用, 能 够发现更多的隐藏较深的功耗问题; 经测试发现, 本发明所检测出来的 84%的功 耗问题是现有技术所没有检测出来的, 而修复这些功耗问题, 可以将手机等智 能终端的电池续航时间延长至大约为现有技术的两倍左右。
[0057] 以上内容是结合具体的优选实施方式对本发明所作的进一步详细说明, 不能认 定本发明的具体实施只局限于这些说明。 对于本发明所属技术领域的普通技术 人员来说, 在不脱离本发明构思的前提下, 还可以做出若干简单推演或替换, 都应当视为属于本发明的保护范围。

Claims

权利要求书
[权利要求 1] 一种移动应用的功耗检测方法, 其特征在于, 包括以下步骤:
步骤 S1, 生成测试输入和运行环境参数;
步骤 S2, 在所述测试输入和运行环境参数下运行移动应用, 同时收集 所述移动应用在所述测试输入和运行环境参数下的功耗信息; 步骤 S3 , 分析功耗信息以识别是否存在功耗问题; 其中, 所述步骤 S1中, 所述测试输入和运行环境参数为无线信号被屏 蔽状态下的参数; 所述无线信号被屏蔽的状态包括网络故障状态和飞 行模式状态。
[权利要求 2] 根据权利要求 1所述的移动应用的功耗检测方法, 其特征在于, 所述 步骤 S1中, 通过随机或是问题触发模式生成测试输入和运行环境参数
[权利要求 3] 根据权利要求 2所述的移动应用的功耗检测方法, 其特征在于, 通过 自动生成随机的用户输入序列来生成测试输入和运行环境参数, 所述 用户输入序列包括触屏和划屏所对应的输入序列。
[权利要求 4] 根据权利要求 2所述的移动应用的功耗检测方法, 其特征在于, 所述 问题触发模式包括旅行定位后台运行触发模式、 浏览器后台运行触发 模式和多媒体播放故障触发模式中的至少一种。
[权利要求 5] 根据权利要求 1至 4任意一项所述的移动应用的功耗检测方法, 其特征 在于, 所述步骤 S3包括以下子步骤:
步骤 S301, 分析所述移动应用在所述测试输入和运行环境参数下的功 耗信息, 并判断是否存在功耗问题, 若否则返回步骤 S1, 若是则跳转 至步骤 S302;
步骤 S302, 记录所述功耗问题, 并分析和判断所述功耗问题是否属于 新的问题触发模式, 若否则返回步骤 S1, 若是则跳转至步骤 S303 ; 步骤 S303 , 将所述功耗问题记录至所述问题触发模式中。
[权利要求 6] 根据权利要求 5所述的移动应用的功耗检测方法, 其特征在于, 所述 步骤 S301中, 分析所述移动应用在所述测试输入和运行环境参数下的 功耗信息包括分析锁屏状态阶段、 开启屏幕阶段、 应用运行阶段、 置 于后台阶段以及息屏待机状态阶段共五个阶段的功耗信息, 然后通过 判断所述五个阶段的功耗信息是否分别满足预设功耗范围, 进而判断 是否存在功耗问题。
[权利要求 7] 根据权利要求 6所述的移动应用的功耗检测方法, 其特征在于, 所述 预设功耗范围设置为所述移动应用的测试用例的耗电正态分布, 通过 判断所述五个阶段的功耗信息是否与所述耗电正态分布相符合, 若否 则判断为存在前台运行的功耗问题。
[权利要求 8] 根据权利要求 6所述的移动应用的功耗检测方法, 其特征在于, 通过 分析所述开启屏幕阶段的平均功耗和所述置于后台阶段的平均功耗之 间的关系来判断是否存在后台运行的功耗问题, 若所述置于后台阶段 的平均功耗比所述开启屏幕阶段的平均功耗高 40%以上, 则判定为存 在后台运行的功耗问题。
[权利要求 9] 根据权利要求 6所述的移动应用的功耗检测方法, 其特征在于, 通过 分析所述息屏待机状态阶段的平均功耗和所述锁屏状态阶段的平均功 耗之间的关系来判断是否存在后台运行的功耗问题, 若所述息屏待机 状态阶段的平均功耗比所述锁屏状态阶段的平均功耗高 50%以上, 则 判定为所述移动应用存在无睡眠的功耗问题。
[权利要求 10] 一种移动应用的功耗检测***, 其特征在于, 采用了如权利要求 1至 9 任意一项所述的移动应用的功耗检测方法。
PCT/CN2019/073516 2018-06-13 2019-01-28 一种移动应用的功耗检测方法及*** WO2019237751A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810606865.0A CN108829598B (zh) 2018-06-13 2018-06-13 一种移动应用的功耗检测方法及***
CN201810606865.0 2018-06-13

Publications (1)

Publication Number Publication Date
WO2019237751A1 true WO2019237751A1 (zh) 2019-12-19

Family

ID=64145049

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/073516 WO2019237751A1 (zh) 2018-06-13 2019-01-28 一种移动应用的功耗检测方法及***

Country Status (2)

Country Link
CN (1) CN108829598B (zh)
WO (1) WO2019237751A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829598B (zh) * 2018-06-13 2019-11-29 深圳大学 一种移动应用的功耗检测方法及***

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103179241A (zh) * 2013-03-08 2013-06-26 百度在线网络技术(北京)有限公司 一种移动终端功耗的自动化测试方法和***
CN105373482A (zh) * 2015-12-23 2016-03-02 北京金山安全软件有限公司 一种检测应用程序耗电异常的方法、装置及电子设备
CN105512041A (zh) * 2015-12-23 2016-04-20 北京金山安全软件有限公司 一种测试应用程序性能的方法、装置及电子设备
CN106569942A (zh) * 2015-10-08 2017-04-19 阿里巴巴集团控股有限公司 一种测试方法和装置
CN106681916A (zh) * 2016-12-20 2017-05-17 广东小天才科技有限公司 一种应用功耗的测试方法、装置和***
CN108829598A (zh) * 2018-06-13 2018-11-16 深圳大学 一种移动应用的功耗检测方法及***

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9569876B2 (en) * 2006-12-21 2017-02-14 Brian Mark Shuster Animation control method for multiple participants
CN102999419B (zh) * 2011-09-13 2016-03-16 百度在线网络技术(北京)有限公司 一种Android测试事件记录回放方法及装置
CN103516559A (zh) * 2012-12-13 2014-01-15 Tcl集团股份有限公司 一种智能终端应用兼容性测试方法及***
CN103475790B (zh) * 2013-09-06 2016-03-30 中国科学院计算技术研究所 一种智能移动终端功耗管理方法
CN105159816B (zh) * 2015-08-04 2018-11-16 广东欧珀移动通信有限公司 一种降低设备功耗的方法、移动终端及***
CN107305516A (zh) * 2016-04-18 2017-10-31 展讯通信(上海)有限公司 终端耗电测试方法及装置
CN205942334U (zh) * 2016-08-09 2017-02-08 深圳大学 一种功耗检测装置与***
CN106771562B (zh) * 2017-02-23 2019-10-18 上海与德信息技术有限公司 一种终端的功耗测试方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103179241A (zh) * 2013-03-08 2013-06-26 百度在线网络技术(北京)有限公司 一种移动终端功耗的自动化测试方法和***
CN106569942A (zh) * 2015-10-08 2017-04-19 阿里巴巴集团控股有限公司 一种测试方法和装置
CN105373482A (zh) * 2015-12-23 2016-03-02 北京金山安全软件有限公司 一种检测应用程序耗电异常的方法、装置及电子设备
CN105512041A (zh) * 2015-12-23 2016-04-20 北京金山安全软件有限公司 一种测试应用程序性能的方法、装置及电子设备
CN106681916A (zh) * 2016-12-20 2017-05-17 广东小天才科技有限公司 一种应用功耗的测试方法、装置和***
CN108829598A (zh) * 2018-06-13 2018-11-16 深圳大学 一种移动应用的功耗检测方法及***

Also Published As

Publication number Publication date
CN108829598B (zh) 2019-11-29
CN108829598A (zh) 2018-11-16

Similar Documents

Publication Publication Date Title
US9292685B2 (en) Techniques for autonomic reverting to behavioral checkpoints
Kim et al. Detecting energy-greedy anomalies and mobile malware variants
US9244682B2 (en) Idle detection
US9749209B2 (en) Methods and apparatus to credit background applications
US9916442B2 (en) Real-time recording and monitoring of mobile applications
CA2547708A1 (en) System and method for privilege management and revocation
CN105491054A (zh) 恶意访问的判断方法、拦截方法与装置
CN103186439A (zh) 服务器测试***及服务器稳定性测试方法
JP2019516178A (ja) クライアントコンピューティングデバイスおよび企業ネットワーク上でマルウェアおよび攻撃をインテリジェントに検出するための方法およびシステム
CN106095039A (zh) 功耗控制方法及其装置
CN104376266A (zh) 应用软件安全级别的确定方法及装置
CN109726821B (zh) 数据均衡方法、装置、计算机可读存储介质及电子设备
US11436188B2 (en) Resource optimization and update method, server, and device
CN106708616A (zh) 进程控制方法和进程控制装置
CN113903389A (zh) 一种慢盘检测方法、装置及计算机可读写存储介质
CN105160251A (zh) 一种apk应用软件行为的分析方法及装置
WO2019237751A1 (zh) 一种移动应用的功耗检测方法及***
TW201626235A (zh) 用於偵測在第一階指令快取中之惡意碼之積體電路及方法
CN102595484B (zh) 最小化路测处理方法和用户设备
TW201626228A (zh) 待機異常耗電偵測系統及方法
WO2021142720A1 (zh) 一种在Android***中提供沙盒环境保护用户隐私的方法
US20170300104A1 (en) Power-saving method and an electronic device for performing power consumption management
US10853462B2 (en) Authorizing file access with user I/O and hardware usage patterns
CN106251371A (zh) 黑帧检测方法和装置
JPWO2019229883A1 (ja) 検査装置、検査方法及び検査プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19820093

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19820093

Country of ref document: EP

Kind code of ref document: A1