WO2019153502A1 - Method for responding to click event, readable storage medium, terminal device, and apparatus - Google Patents

Method for responding to click event, readable storage medium, terminal device, and apparatus Download PDF

Info

Publication number
WO2019153502A1
WO2019153502A1 PCT/CN2018/083284 CN2018083284W WO2019153502A1 WO 2019153502 A1 WO2019153502 A1 WO 2019153502A1 CN 2018083284 W CN2018083284 W CN 2018083284W WO 2019153502 A1 WO2019153502 A1 WO 2019153502A1
Authority
WO
WIPO (PCT)
Prior art keywords
usage rate
cpu
click event
preset
target terminal
Prior art date
Application number
PCT/CN2018/083284
Other languages
French (fr)
Chinese (zh)
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 WO2019153502A1 publication Critical patent/WO2019153502A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/04812Interaction techniques based on cursor appearance or behaviour, e.g. being affected by the presence of displayed objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04847Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

Abstract

The present application relates to the technical field of computers, and particularly to a method for responding to a click event, a computer readable storage medium, a terminal device, and an apparatus. The method comprises: first acquiring a first time point at which a target terminal receives a first click event; acquiring a second time point at which the target terminal receives a second click event; then calculating the time interval between the second time point and the first time point; if the time interval is greater than or equal to a preset interval threshold, responding to the second click event according to a preset system response time; if the time interval is less than the interval threshold, calculating a current hardware resource utilization rate of the target terminal; querying a target response time corresponding to the hardware resource utilization rate in a preset relationship correspondence table; and responding to the second click event according to the target response time. The present application reduces occurrence of stuttering and greatly improves user experience.

Description

一种点击事件响应方法、可读存储介质、终端设备及装置Click event response method, readable storage medium, terminal device and device
本申请要求于2018年2月7日提交中国专利局、申请号为CN 201810121665.6、发明名称为“一种点击事件响应方法、计算机可读存储介质及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. CN 201810121665.6, entitled "A Click Event Response Method, Computer Readable Storage Medium, and Terminal Device", filed on February 7, 2018, The entire contents are incorporated herein by reference.
技术领域Technical field
本申请属于计算机技术领域,尤其涉及一种点击事件响应方法、计算机可读存储介质、终端设备及装置。The present application belongs to the field of computer technologies, and in particular, to a click event response method, a computer readable storage medium, a terminal device, and a device.
背景技术Background technique
用户在操作各种智能终端设备时,系统会在接收到用户的点击事件时给予响应,但是由于硬件设备性能的影响,一些配置比较低端的设备会对用户的输入事件做出过慢的反应。有时候用户为了获得响应,会连续点击某个视图,这就导致系统软件界面还没有来得急更新,但用户已经在同一个视图上做了多次点击动作,造成系统响应的紊乱,此时便会出现我们常见的卡机现象,极大得影响到用户的使用体验。When the user operates various intelligent terminal devices, the system will respond when receiving the user's click event, but due to the influence of the hardware device performance, some devices with lower configuration settings will react slowly to the user's input events. . Sometimes the user clicks on a view in order to get a response, which causes the system software interface to be updated urgently, but the user has made multiple clicks on the same view, causing the system to be responsive. There will be a common phenomenon of card machine, which greatly affects the user experience.
技术问题technical problem
有鉴于此,本申请实施例提供了一种点击事件响应方法、计算机可读存储介质、终端设备及装置,以解决当用户做出连续点击事件时易发生卡机现象的问题。In view of this, the embodiment of the present application provides a click event response method, a computer readable storage medium, a terminal device, and a device, to solve the problem that a card machine phenomenon occurs when a user makes a continuous click event.
技术解决方案Technical solution
本申请实施例的第一方面提供了一种点击事件响应方法,可以包括:A first aspect of the embodiment of the present application provides a click event response method, which may include:
获取目标终端接收到第一点击事件时的第一时刻;Obtaining a first moment when the target terminal receives the first click event;
获取所述目标终端接收到第二点击事件时的第二时刻,所述第二点击事件为在所述第一点击事件之后的第一个点击事件;Obtaining a second moment when the target terminal receives the second click event, where the second click event is the first click event after the first click event;
计算所述第二时刻与所述第一时刻之间的时间间隔;Calculating a time interval between the second moment and the first moment;
若所述时间间隔大于或等于预设的间隔阈值,则根据预设的系统响应时间对所述第二点击事件进行响应;If the time interval is greater than or equal to a preset interval threshold, responding to the second click event according to a preset system response time;
若所述时间间隔小于所述间隔阈值,则计算所述目标终端当前的硬件资源使用率;If the time interval is less than the interval threshold, calculating a current hardware resource usage rate of the target terminal;
在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间,所述目标响应时间与所述硬件资源使用率正相关;Querying, in a preset relationship correspondence table, a target response time corresponding to the hardware resource usage rate, where the target response time is positively correlated with the hardware resource usage rate;
根据所述目标响应时间对所述第二点击事件进行响应。Responding to the second click event based on the target response time.
本申请实施例的第二方面提供了一种计算机可读存储介质,所述计算机可读存储 介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上述点击事件响应方法的步骤。A second aspect of embodiments of the present application provides a computer readable storage medium storing computer readable instructions that, when executed by a processor, implement a click event response method as described above A step of.
本申请实施例的第三方面提供了一种点击事件响应终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如上述点击事件响应方法的步骤。A third aspect of an embodiment of the present application provides a click event response terminal device including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, the processor executing The computer readable instructions implement the steps of the click event response method as described above.
本申请实施例的第四方面提供了一种点击事件响应装置,可以包括用于实现上述点击事件响应方法的步骤的模块。A fourth aspect of the embodiments of the present application provides a click event response apparatus, which may include a module for implementing the steps of the click event response method.
有益效果Beneficial effect
本申请实施例与现有技术相比存在的有益效果是:本申请实施例在用户正常点击时,按照正常的系统响应时间对点击事件进行响应,当用户做出连续点击事件时,按照当前的硬件资源使用率确定响应时间,且两者是正相关的关系,硬件资源使用率越高,响应时间越长,这样留出了足够的时间来对连续点击事件进行响应,避免了系统响应的紊乱,减少了卡机现象的发生,大大提升了用户的使用体验。Compared with the prior art, the embodiment of the present application has the beneficial effects that: when the user clicks normally, the user responds to the click event according to the normal system response time, and when the user makes a continuous click event, according to the current The hardware resource usage rate determines the response time, and the two are positively related. The higher the hardware resource usage rate and the longer the response time, the more time is left to respond to the continuous click event, avoiding the disorder of the system response. Reduce the occurrence of the card machine phenomenon, greatly improving the user experience.
附图说明DRAWINGS
图1为本申请实施例中一种点击事件响应方法的一个实施例流程图;FIG. 1 is a flowchart of an embodiment of a method for responding to a click event according to an embodiment of the present application;
图2为关系对应表的预设过程的示意流程图;2 is a schematic flow chart of a preset process of a relationship correspondence table;
图3为本申请实施例中一种点击事件响应装置的一个实施例结构图;3 is a structural diagram of an embodiment of a click event response apparatus according to an embodiment of the present application;
图4为本申请实施例中一种点击事件响应终端设备的示意框图。FIG. 4 is a schematic block diagram of a click event response terminal device according to an embodiment of the present application.
本发明的实施方式Embodiments of the invention
请参阅图1,本申请实施例中一种点击事件响应方法的一个实施例可以包括:Referring to FIG. 1, an embodiment of a method for responding to a click event in an embodiment of the present application may include:
步骤S101、获取目标终端接收到第一点击事件时的第一时刻。Step S101: Acquire a first moment when the target terminal receives the first click event.
步骤S102、获取所述目标终端接收到第二点击事件时的第二时刻。Step S102: Acquire a second moment when the target terminal receives the second click event.
所述第二点击事件为在所述第一点击事件之后的第一个点击事件,即在本实施例中,所述第一点击事件和所述第二点击事件为依次接连发生的两次点击事件,将目标终端接收到第一点击事件时的时刻记为lastClickTime,也即所述第一时刻,将目标终端接收到第二点击事件时的时刻记为currentTime,也即所述第二时刻。The second click event is the first click event after the first click event, that is, in the embodiment, the first click event and the second click event are two consecutive clicks. The event records the time when the target terminal receives the first click event as lastClickTime, that is, the first time, and records the time when the target terminal receives the second click event as currentTime, that is, the second time.
步骤S103、计算所述第二时刻与所述第一时刻之间的时间间隔。Step S103: Calculate a time interval between the second time and the first time.
步骤S104、判断所述时间间隔是否小于预设的间隔阈值。Step S104: Determine whether the time interval is less than a preset interval threshold.
所述间隔阈值可以记为MIN_CLICK_DELAY_TIME,其具体取值可以根据实际情况进行设置,例如,可以设置MIN_CLICK_DELAY_TIME=500ms。The interval threshold can be recorded as MIN_CLICK_DELAY_TIME, and the specific value can be set according to the actual situation. For example, MIN_CLICK_DELAY_TIME=500ms can be set.
若所述时间间隔大于或等于所述间隔阈值,也即:If the time interval is greater than or equal to the interval threshold, that is,
currentTime-lastClickTime≥MIN_CLICK_DELAY_TIME,则执行步骤S105。When currentTime-lastClickTime ≥ MIN_CLICK_DELAY_TIME, step S105 is performed.
若所述时间间隔小于所述间隔阈值,也即:If the time interval is less than the interval threshold, that is,
currentTime-lastClickTime<MIN_CLICK_DELAY_TIME,则执行步骤S106及其后续步骤。currentTime-lastClickTime<MIN_CLICK_DELAY_TIME, then step S106 and its subsequent steps are performed.
步骤S105、根据预设的系统响应时间对所述第二点击事件进行响应。Step S105: Respond to the second click event according to a preset system response time.
当所述时间间隔大于或等于预设的间隔阈值时,说明两个连续点击事件之间的时间间隔足够大,按照系统默认的响应时间进行响应也不会产生卡机现象。When the time interval is greater than or equal to the preset interval threshold, it indicates that the time interval between two consecutive click events is sufficiently large, and the response is not generated according to the system default response time.
步骤S106、计算所述目标终端当前的硬件资源使用率。Step S106: Calculate a current hardware resource usage rate of the target terminal.
首先,获取所述目标终端当前的CPU使用率。First, the current CPU usage of the target terminal is obtained.
具体地,在预设的第一采样时刻,获取所述目标终端中预设的记录CPU信息的文件,从所述记录CPU信息的文件中提取在所述第一采样时刻的CPU运行状态数据;在预设的第二采样时刻,获取所述记录CPU信息的文件,所述第二采样时刻与所述第一采样时刻间隔预设的时长,从所述记录CPU信息的文件中提取在所述第二采样时刻的CPU运行状态数据;根据在所述第一采样时刻的CPU运行状态数据和在所述第二采样时刻的CPU运行状态数据计算所述CPU使用率。Specifically, at a preset first sampling moment, acquiring a file that records preset CPU information in the target terminal, and extracting CPU operating state data at the first sampling moment from the file that records the CPU information; Obtaining, in a preset second sampling moment, the file that records the CPU information, and the second sampling time is separated from the first sampling time by a preset duration, and is extracted from the file that records the CPU information. CPU operating state data at the second sampling instant; calculating the CPU usage rate based on CPU operating state data at the first sampling instant and CPU operating state data at the second sampling instant.
例如,可以获取目标终端的/proc/cpuinfo文件中记录的CPU信息,提取出以下CPU运行状态数据:For example, the CPU information recorded in the /proc/cpuinfo file of the target terminal can be obtained, and the following CPU running status data is extracted:
User:处于用户态的运行时间,不包含nice值为负的进程;User: Run time in user mode, does not include processes with a negative value of negative;
nice:nice值为负的进程所占用的CPU时间,nice值是系统中表示静态优先级的数值,每个进程都有自己的静态优先级,优先级高的进程得以优先运行;Nice: The CPU time occupied by the process whose negative value is negative. The nice value is the value indicating the static priority in the system. Each process has its own static priority, and the process with the highest priority is given priority.
system:处于核心态的运行时间;System: the running time in the core state;
idle:除IO等待时间以外的其他等待时间;Idle: wait time other than IO wait time;
iowait:IO等待时间;Iowait: IO wait time;
Irq:服务中断时间;Irq: service interruption time;
softirq:软中断时间;Softirq: soft interrupt time;
stealstolen:在虚拟环境运行时花费在其他操作系统的时间;Stealstolen: Time spent on other operating systems while the virtual environment is running;
guest:操作系统虚拟CPU花费的时间;Guest: the time spent by the operating system virtual CPU;
guest_nice:操作系统虚拟CPU花费在nice进程上的时间。Guest_nice: The time the operating system virtual CPU spends on the nice process.
先后采样两个足够短的时间间隔的CPU运行状态数据,分别记作t1、t2,其中t1、t2的结构均为(user、nice、system、idle、iowait、irq、softirq、stealstolen、guest、guest_nice)的10元组;把第一次的所有10元组数据求和,得到totalCPUTime1;把第二次的所有10元组数据求和,得到totalCPUTime2;获得第一次的idle数据,记为idle1;获得第 二次的idle数据,记为idle2;则所述目标终端当前的CPU使用率λ CPU可以通过下式计算: Sampling two CPU running state data of short enough interval, respectively, t1, t2, where t1, t2 are all structures (user, nice, system, idle, iowait, irq, softirq, steelstolen, guest, guest_nice a 10-tuple; sum all the first 10-tuple data for the first time, get totalCPUTime1; sum all the 10-tuple data of the second time to get totalCPUTime2; get the first idle data, denoted as idle1; Obtain the second idle data, denoted as idle2; then the current CPU usage of the target terminal λ CPU can be calculated by:
Figure PCTCN2018083284-appb-000001
Figure PCTCN2018083284-appb-000001
然后,获取所述目标终端当前的内存使用率。Then, the current memory usage of the target terminal is obtained.
具体地,获取所述目标终端中预设的记录内存信息的文件;从所述记录内存信息的文件中提取出内存空间总量以及内存空间可使用的余量;根据所述内存空间总量以及所述内存空间可使用的余量计算所述内存使用率。Specifically, acquiring a file that records preset memory information in the target terminal; extracting a total amount of memory space and a margin that can be used by the memory space from the file that records the memory information; according to the total amount of the memory space and The memory usage can be calculated by using a margin of the memory space.
例如,可以获取目标终端的/proc/meminfo文件中记录的内存信息,该文件中含有很多的信息,若要计算内存的使用率,只需要其中的两个变量值,即代表内存空间总量的MemTotal和代表内存空间可使用的余量的MemFree,所述目标终端当前的内存使用率λ Memory可以通过下式计算: For example, the memory information recorded in the /proc/meminfo file of the target terminal may be obtained. The file contains a lot of information. To calculate the memory usage, only two variable values are needed, that is, the total amount of memory space. MemTotal and MemFree representing the margin available for the memory space, the current memory usage of the target terminal λ Memory can be calculated by:
Figure PCTCN2018083284-appb-000002
Figure PCTCN2018083284-appb-000002
最后,根据下式计算所述目标终端当前的硬件资源使用率:Finally, the current hardware resource usage rate of the target terminal is calculated according to the following formula:
η=(sinλ max) 2max+(cosλ max) 2minη=(sinλ max ) 2max +(cosλ max ) 2min ;
其中,λ max=max(λ CPUMemory),λ min=min(λ CPUMemory),λ CPU为所述目标终端当前的CPU使用率,λ Memory为所述目标终端当前的内存使用率,η为所述目标终端当前的硬件资源使用率。 Where λ max =max(λ CPU , λ Memory ), λ min =min(λ CPU , λ Memory ), λ CPU is the current CPU usage of the target terminal, and λ Memory is the current memory usage of the target terminal Rate, η is the current hardware resource usage rate of the target terminal.
步骤S107、在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间。Step S107: Query a target response time corresponding to the hardware resource usage rate in a preset relationship correspondence table.
所述目标响应时间与所述硬件资源使用率正相关。即硬件资源使用率越高,则对应的目标响应时间也越长。The target response time is positively correlated with the hardware resource usage rate. That is, the higher the hardware resource usage rate, the longer the corresponding target response time.
其中,所述关系对应表的预设过程具体可以包括如图2所示的步骤:The preset process of the relationship correspondence table may specifically include the steps shown in FIG. 2:
步骤S1071、将所述硬件资源使用率的取值范围划分为预设数目的子区间。Step S1071: The value range of the hardware resource usage rate is divided into a preset number of sub-intervals.
例如,可以将所述硬件资源使用率的取值范围划分为(0,10%]、(10%,20%]、(20%,30%]、……、(90%,100%]这十个子区间。For example, the range of values of the hardware resource usage rate may be divided into (0, 10%), (10%, 20%), (20%, 30%), ..., (90%, 100%). Ten sub-intervals.
步骤S1072、从所述子区间中任意选取一个子区间作为当前测试子区间。Step S1072, arbitrarily selecting one subinterval from the subinterval as the current test subinterval.
步骤S1073、运行预设的任务。Step S1073: Running a preset task.
该预设的任务预先设置在所述目标终端中,其目的在于消耗硬件资源,通过调整 同时运行的任务的数量,可以对当前的硬件资源使用率进行调节。容易理解地,若同时运行的任务的数量越多,则当前的硬件资源使用率越高。The preset task is preset in the target terminal, and the purpose is to consume hardware resources, and the current hardware resource usage rate can be adjusted by adjusting the number of concurrently running tasks. It is easy to understand that if the number of tasks running simultaneously is higher, the current hardware resource usage rate is higher.
步骤S1074、计算当前的硬件资源使用率。Step S1074: Calculate the current hardware resource usage rate.
硬件资源使用率的具体计算过程可以参见步骤S106中的内容,本实施例在此不再赘述。For the specific calculation process of the hardware resource usage, refer to the content in the step S106, which is not described herein again.
步骤S1075、判断所述硬件资源使用率与目标使用率之差是否在预设的误差范围内;Step S1075: determining whether the difference between the hardware resource usage rate and the target usage rate is within a preset error range;
所述目标使用率为所述当前测试子区间的上限值。若所述硬件资源使用率与所述目标使用率之差不在预设的误差范围内,则执行步骤S1076,若所述硬件资源使用率与所述目标使用率之差在所述误差范围内,则执行步骤S1077及其后续步骤。The target usage rate is an upper limit value of the current test subinterval. If the difference between the hardware resource usage rate and the target usage rate is not within a preset error range, step S1076 is performed, if the difference between the hardware resource usage rate and the target usage rate is within the error range, Then, step S1077 and subsequent steps are performed.
步骤S1076、调整所述预设的任务的运行数量。Step S1076: Adjust the running quantity of the preset task.
具体地,若所述硬件资源使用率与所述目标使用率之差大于0,则减少任务的运行数量,若所述硬件资源使用率与所述目标使用率之差小于0,则增加任务的运行数量。Specifically, if the difference between the hardware resource usage rate and the target usage rate is greater than 0, the running quantity of the task is reduced, and if the difference between the hardware resource usage rate and the target usage rate is less than 0, the task is increased. The number of runs.
在步骤S1076之后,返回执行步骤S1074及其后续步骤。After step S1076, the process returns to step S1074 and subsequent steps.
步骤S1077、触发预设的自动点击事件,并记录所述自动点击事件的响应时间。Step S1077: trigger a preset automatic click event, and record a response time of the automatic click event.
所述自动点击事件为由系统自动执行的点击事件,可以将其看作是对用户实施的点击事件的一种模拟,其过程无需用户的参与。The automatic click event is a click event automatically executed by the system, which can be regarded as a simulation of a click event implemented by the user, and the process does not require user participation.
以安卓系统为例,其系统中提供了辅助功能服务,也即AccessibilityService来实现所述自动点击事件,具体地,可以首先实现一个辅助功能服务要求继承AccessibilityService类并实现它的抽象方法,自定义一个服务类继承系统的AccessibilityService并覆写onAccessibilityEvent和onInterrupt方法。编写好服务类之后,在系统配置文件AndroidManifest.xml中注册服务。完成前面两个步骤就完成了基本辅助功能服务的注册与配置,具体的功能实现需要在onAccessibilityEvent中完成,根据onAccessibilityEvent回调方法传递过来的AccessibilityEvent对象,结合所述服务类本身提供的模拟点击相关的接口即可实现所述自动点击事件。Taking the Android system as an example, an auxiliary function service, that is, an AccessibilityService is provided in the system to implement the automatic click event. Specifically, an auxiliary function service may be first implemented to inherit the AccessibilityService class and implement its abstract method, and customize one. The service class inherits the AccessibilityService of the system and overrides the onAccessibilityEvent and onInterrupt methods. After writing the service class, register the service in the system configuration file AndroidManifest.xml. After completing the first two steps, the registration and configuration of the basic auxiliary function service is completed. The specific function implementation needs to be completed in the onAccessibilityEvent. The AccessibilityEvent object passed according to the onAccessibilityEvent callback method is combined with the analog click-related interface provided by the service class itself. The automatic click event can be implemented.
步骤S1078、将所述当前测试子区间与所述响应时间之间的对应关系存储入所述关系对应表中。Step S1078: Store a correspondence between the current test subinterval and the response time in the relationship correspondence table.
步骤S1079、判断各个子区间是否均被选取过。In step S1079, it is determined whether each sub-interval has been selected.
若存在未被选取过的子区间,则返回执行步骤S1072,若各个子区间均被选取过,则执行步骤S10710。If there are sub-intervals that have not been selected, the process returns to step S1072, and if each sub-interval is selected, step S10710 is performed.
步骤S10710、保存所述关系对应表。Step S10710: Save the relationship correspondence table.
在初始状态下,硬件资源使用率一般较低,此时,不断增加任务的运行数量,硬 件资源使用率达到第一个目标使用率(例如10%)为止,自动运行点击事件,记录下点击事件起始时刻,在接收到响应后,再次记录当前时刻,减去点击事件起始时刻即可计算出第一个子区间对应的响应时间;继续增加任务的运行数量,直至硬件资源使用率达到第二个目标使用率(例如20%)为止,自动运行点击事件,并按照上述方法计算出第二个子区间对应的响应时间;持续以上过程,直至计算出各个子区间对应的响应时间。In the initial state, the hardware resource usage rate is generally low. At this time, the number of running tasks is continuously increased, and the hardware resource usage rate reaches the first target usage rate (for example, 10%), the click event is automatically run, and the click event is recorded. At the beginning time, after receiving the response, the current time is recorded again, and the response time corresponding to the first sub-interval can be calculated by subtracting the start time of the click event; the number of running of the task is continuously increased until the hardware resource usage rate reaches the first Before the two target usage rates (for example, 20%), the click event is automatically run, and the response time corresponding to the second subinterval is calculated according to the above method; the above process is continued until the response time corresponding to each subinterval is calculated.
以上仅仅是一次测试过程,为了提高精确度,可以多次重复以上过程,将各次计算得到的响应时间求平均值,最终得到的关系对应表更为准确可靠。The above is only a test process. In order to improve the accuracy, the above process can be repeated multiple times, and the response time obtained by each calculation is averaged, and the resulting relationship correspondence table is more accurate and reliable.
步骤S108、根据所述目标响应时间对所述第二点击事件进行响应。Step S108: Respond to the second click event according to the target response time.
综上所述,本申请实施例在用户正常点击时,按照正常的系统响应时间对点击事件进行响应,当用户做出连续点击事件时,按照当前的硬件资源使用率确定响应时间,且两者是正相关的关系,硬件资源使用率越高,响应时间越长,这样留出了足够的时间来对连续点击事件进行响应,避免了系统响应的紊乱,减少了卡机现象的发生,大大提升了用户的使用体验。In summary, the embodiment of the present application responds to the click event according to the normal system response time when the user clicks normally, and determines the response time according to the current hardware resource usage rate when the user makes a continuous click event, and both It is a positive correlation. The higher the hardware resource usage rate and the longer the response time, the more time is left to respond to the continuous click event, which avoids the disorder of the system response and reduces the occurrence of the card machine phenomenon. User experience.
对应于上文实施例所述的一种点击事件响应方法,图3示出了本申请实施例提供的一种点击事件响应装置的一个实施例结构图。Corresponding to a click event response method described in the above embodiment, FIG. 3 is a structural diagram of an embodiment of a click event response device provided by an embodiment of the present application.
本实施例中,一种点击事件响应装置可以包括:In this embodiment, a click event response device may include:
第一时刻获取模块301,用于获取目标终端接收到第一点击事件时的第一时刻;The first time acquisition module 301 is configured to acquire a first time when the target terminal receives the first click event;
第二时刻获取模块302,用于获取所述目标终端接收到第二点击事件时的第二时刻,所述第二点击事件为在所述第一点击事件之后的第一个点击事件;The second time acquisition module 302 is configured to acquire a second time when the target terminal receives the second click event, where the second click event is the first click event after the first click event;
时间间隔计算模块303,用于计算所述第二时刻与所述第一时刻之间的时间间隔;a time interval calculation module 303, configured to calculate a time interval between the second time and the first time;
第一响应模块304,用于若所述时间间隔大于或等于预设的间隔阈值,则根据预设的系统响应时间对所述第二点击事件进行响应;The first response module 304 is configured to: if the time interval is greater than or equal to a preset interval threshold, respond to the second click event according to a preset system response time;
硬件资源使用率计算模块305,用于若所述时间间隔小于所述间隔阈值,则计算所述目标终端当前的硬件资源使用率;The hardware resource usage calculation module 305 is configured to calculate a current hardware resource usage rate of the target terminal, if the time interval is less than the interval threshold;
目标响应时间查询模块306,用于在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间,所述目标响应时间与所述硬件资源使用率正相关;The target response time query module 306 is configured to query, in a preset relationship correspondence table, a target response time corresponding to the hardware resource usage rate, where the target response time is positively correlated with the hardware resource usage rate;
第二响应模块307,用于根据所述目标响应时间对所述第二点击事件进行响应。The second response module 307 is configured to respond to the second click event according to the target response time.
进一步地,所述硬件资源使用率计算模块可以包括:Further, the hardware resource usage calculation module may include:
CPU使用率获取单元,用于获取所述目标终端当前的CPU使用率;a CPU usage obtaining unit, configured to acquire a current CPU usage rate of the target terminal;
内存使用率获取单元,用于获取所述目标终端当前的内存使用率;a memory usage obtaining unit, configured to acquire a current memory usage rate of the target terminal;
硬件资源使用率计算单元,用于根据下式计算所述目标终端当前的硬件资源使用 率:a hardware resource usage calculation unit, configured to calculate a current hardware resource usage rate of the target terminal according to the following formula:
η=(sinλ max) 2max+(cosλ max) 2minη=(sinλ max ) 2max +(cosλ max ) 2min ;
其中,λ max=max(λ CPUMemory),λ min=min(λ CPUMemory),λ CPU为所述目标终端当前的CPU使用率,λ Memory为所述目标终端当前的内存使用率,η为所述目标终端当前的硬件资源使用率。 Where λ max =max(λ CPU , λ Memory ), λ min =min(λ CPU , λ Memory ), λ CPU is the current CPU usage of the target terminal, and λ Memory is the current memory usage of the target terminal Rate, η is the current hardware resource usage rate of the target terminal.
进一步地,所述CPU使用率获取单元可以包括:Further, the CPU usage obtaining unit may include:
第一CPU信息文件获取子单元,用于在预设的第一采样时刻,获取所述目标终端中预设的记录CPU信息的文件;a first CPU information file obtaining subunit, configured to acquire, at a preset first sampling moment, a file that records preset CPU information in the target terminal;
第一CPU运行状态数据提取子单元,用于从所述记录CPU信息的文件中提取在所述第一采样时刻的CPU运行状态数据;a first CPU running state data extracting subunit, configured to extract CPU operating state data at the first sampling moment from the file that records CPU information;
第二CPU信息文件获取子单元,用于在预设的第二采样时刻,获取所述记录CPU信息的文件,所述第二采样时刻与所述第一采样时刻间隔预设的时长;a second CPU information file obtaining sub-unit, configured to acquire the file for recording CPU information at a preset second sampling time, where the second sampling time is separated from the first sampling time by a preset duration;
第二CPU运行状态数据提取子单元,用于从所述记录CPU信息的文件中提取在所述第二采样时刻的CPU运行状态数据;a second CPU running state data extracting subunit, configured to extract CPU operating state data at the second sampling moment from the file that records CPU information;
CPU使用率计算子单元,用于根据在所述第一采样时刻的CPU运行状态数据和在所述第二采样时刻的CPU运行状态数据计算所述CPU使用率。And a CPU usage calculation subunit configured to calculate the CPU usage rate according to CPU operating state data at the first sampling moment and CPU operating state data at the second sampling moment.
进一步地,所述内存使用率获取单元可以包括:Further, the memory usage obtaining unit may include:
内存信息文件获取子单元,用于获取所述目标终端中预设的记录内存信息的文件;a memory information file obtaining subunit, configured to acquire a file of the preset recording memory information in the target terminal;
内存信息提取子单元,用于从所述记录内存信息的文件中提取出内存空间总量以及内存空间可使用的余量;a memory information extraction subunit, configured to extract a total amount of memory space and a margin that can be used by the memory space from the file that records the memory information;
内存使用率计算子单元,用于根据所述内存空间总量以及所述内存空间可使用的余量计算所述内存使用率。a memory usage calculation subunit, configured to calculate the memory usage rate according to the total amount of the memory space and a margin that can be used by the memory space.
进一步地,所述点击事件响应装置还可以包括:Further, the click event response device may further include:
子区间划分模块,用于将所述硬件资源使用率的取值范围划分为预设数目的子区间;a sub-interval partitioning module, configured to divide a value range of the hardware resource usage rate into a preset number of sub-intervals;
当前测试子区间选取模块,用于从所述子区间中任意选取一个子区间作为当前测试子区间;The current test sub-interval selection module is configured to arbitrarily select one sub-interval from the sub-interval as the current test sub-interval;
任务运行模块,用于运行预设的任务;a task running module for running a preset task;
硬件资源使用率计算模块,用于计算当前的硬件资源使用率;a hardware resource usage calculation module for calculating a current hardware resource usage rate;
任务数量调整模块,用于若所述硬件资源使用率与目标使用率之差不在预设的误差范围内,则调整所述预设的任务的运行数量,所述目标使用率为所述当前测试子区 间的上限值;a task quantity adjustment module, configured to adjust a running quantity of the preset task if the difference between the hardware resource usage rate and the target usage rate is not within a preset error range, where the target usage rate is the current test The upper limit of the subinterval;
响应时间记录模块,用于若所述硬件资源使用率与目标使用率之差在所述误差范围内,则触发预设的自动点击事件,并记录所述自动点击事件的响应时间;a response time recording module, configured to trigger a preset automatic click event if the difference between the hardware resource usage rate and the target usage rate is within the error range, and record a response time of the automatic click event;
关系对应表存储模块,用于将所述当前测试子区间与所述响应时间之间的对应关系存储入所述关系对应表中。The relationship correspondence table storage module is configured to store a correspondence between the current test subinterval and the response time in the relationship correspondence table.
图4示出了本申请实施例提供的一种点击事件响应终端设备的示意框图。所述点击事件响应终端设备4可以是手机、平板电脑、桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该点击事件响应终端设备4可包括:处理器40、存储器41以及存储在所述存储器41中并可在所述处理器40上运行的计算机可读指令42,例如执行上述的点击事件响应方法的计算机可读指令。所述处理器40执行所述计算机可读指令42时实现上述各个点击事件响应方法实施例中的步骤,例如图1所示的步骤S101至S108。或者,所述处理器40执行所述计算机可读指令42时实现上述各装置实施例中各模块/单元的功能,例如图3所示模块301至307的功能。FIG. 4 is a schematic block diagram of a click event response terminal device provided by an embodiment of the present application. The click event response terminal device 4 may be a computing device such as a mobile phone, a tablet computer, a desktop computer, a notebook, a palmtop computer, and a cloud server. The click event response terminal device 4 may include a processor 40, a memory 41, and computer readable instructions 42 stored in the memory 41 and operable on the processor 40, such as performing the click event response method described above. Computer readable instructions. The processor 40 executes the computer readable instructions 42 to implement the steps in the various click event response method embodiments described above, such as steps S101 through S108 shown in FIG. Alternatively, the processor 40, when executing the computer readable instructions 42, implements the functions of the modules/units in the various apparatus embodiments described above, such as the functions of the modules 301 through 307 shown in FIG.
在本申请各个实施例中的各功能单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干计算机可读指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。The functional units in the various embodiments of the present application may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, the technical solution of the present application, in essence or the contribution to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of computer readable instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.

Claims (20)

  1. 一种点击事件响应方法,其特征在于,包括:A click event response method, comprising:
    获取目标终端接收到第一点击事件时的第一时刻;Obtaining a first moment when the target terminal receives the first click event;
    获取所述目标终端接收到第二点击事件时的第二时刻,所述第二点击事件为在所述第一点击事件之后的第一个点击事件;Obtaining a second moment when the target terminal receives the second click event, where the second click event is the first click event after the first click event;
    计算所述第二时刻与所述第一时刻之间的时间间隔;Calculating a time interval between the second moment and the first moment;
    若所述时间间隔大于或等于预设的间隔阈值,则根据预设的系统响应时间对所述第二点击事件进行响应;If the time interval is greater than or equal to a preset interval threshold, responding to the second click event according to a preset system response time;
    若所述时间间隔小于所述间隔阈值,则计算所述目标终端当前的硬件资源使用率;If the time interval is less than the interval threshold, calculating a current hardware resource usage rate of the target terminal;
    在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间,所述目标响应时间与所述硬件资源使用率正相关;Querying, in a preset relationship correspondence table, a target response time corresponding to the hardware resource usage rate, where the target response time is positively correlated with the hardware resource usage rate;
    根据所述目标响应时间对所述第二点击事件进行响应。Responding to the second click event based on the target response time.
  2. 根据权利要求1所述的点击事件响应方法,其特征在于,所述计算所述目标终端当前的硬件资源使用率包括:The click event response method according to claim 1, wherein the calculating the current hardware resource usage rate of the target terminal comprises:
    获取所述目标终端当前的CPU使用率;Obtaining a current CPU usage rate of the target terminal;
    获取所述目标终端当前的内存使用率;Obtaining a current memory usage rate of the target terminal;
    根据下式计算所述目标终端当前的硬件资源使用率:Calculating the current hardware resource usage rate of the target terminal according to the following formula:
    η=(sinλ max) 2max+(cosλ max) 2minη=(sinλ max ) 2max +(cosλ max ) 2min ;
    其中,λ max=max(λ CPUMemory),λ min=min(λ CPUMemory),λ CPU为所述目标终端当前的CPU使用率,λ Memory为所述目标终端当前的内存使用率,η为所述目标终端当前的硬件资源使用率。 Where λ max =max(λ CPU , λ Memory ), λ min =min(λ CPU , λ Memory ), λ CPU is the current CPU usage of the target terminal, and λ Memory is the current memory usage of the target terminal Rate, η is the current hardware resource usage rate of the target terminal.
  3. 根据权利要求2所述的点击事件响应方法,其特征在于,所述获取所述目标终端当前的CPU使用率包括:The click event response method according to claim 2, wherein the obtaining the current CPU usage rate of the target terminal comprises:
    在预设的第一采样时刻,获取所述目标终端中预设的记录CPU信息的文件;Obtaining, at a preset first sampling moment, a file that records preset CPU information in the target terminal;
    从所述记录CPU信息的文件中提取在所述第一采样时刻的CPU运行状态数据;Extracting CPU operating state data at the first sampling time from the file that records CPU information;
    在预设的第二采样时刻,获取所述记录CPU信息的文件,所述第二采样时刻与所述第一采样时刻间隔预设的时长;Obtaining, by the preset second sampling moment, the file that records the CPU information, where the second sampling moment is separated from the first sampling time by a preset duration;
    从所述记录CPU信息的文件中提取在所述第二采样时刻的CPU运行状态数据;Extracting CPU operating state data at the second sampling time from the file that records CPU information;
    根据在所述第一采样时刻的CPU运行状态数据和在所述第二采样时刻的CPU运行状态数据计算所述CPU使用率。The CPU usage rate is calculated based on CPU operating state data at the first sampling instant and CPU operating state data at the second sampling instant.
  4. 根据权利要求2所述的点击事件响应方法,其特征在于,所述获取所述目标终 端当前的内存使用率包括:The click event response method according to claim 2, wherein the obtaining the current memory usage rate of the target terminal comprises:
    获取所述目标终端中预设的记录内存信息的文件;Obtaining a file of the preset recording memory information in the target terminal;
    从所述记录内存信息的文件中提取出内存空间总量以及内存空间可使用的余量;Extracting the total amount of memory space and the margin available for the memory space from the file that records the memory information;
    根据所述内存空间总量以及所述内存空间可使用的余量计算所述内存使用率。The memory usage rate is calculated according to the total amount of memory space and a margin that can be used by the memory space.
  5. 根据权利要求1至4中任一项所述的点击事件响应方法,其特征在于,所述关系对应表的预设过程包括:The click event response method according to any one of claims 1 to 4, wherein the preset process of the relationship correspondence table comprises:
    将所述硬件资源使用率的取值范围划分为预设数目的子区间;Dividing the value range of the hardware resource usage rate into a preset number of subintervals;
    从所述子区间中任意选取一个子区间作为当前测试子区间;Selecting a subinterval from the subinterval as the current test subinterval;
    运行预设的任务;Run a preset task;
    计算当前的硬件资源使用率;Calculate the current hardware resource usage rate;
    若所述硬件资源使用率与目标使用率之差不在预设的误差范围内,则调整所述预设的任务的运行数量,并返回执行所述计算当前的硬件资源使用率的步骤,所述目标使用率为所述当前测试子区间的上限值;If the difference between the hardware resource usage rate and the target usage rate is not within a preset error range, adjusting the running quantity of the preset task, and returning to performing the step of calculating the current hardware resource usage rate, The target usage rate is the upper limit value of the current test subinterval;
    若所述硬件资源使用率与目标使用率之差在所述误差范围内,则触发预设的自动点击事件,并记录所述自动点击事件的响应时间;If the difference between the hardware resource usage rate and the target usage rate is within the error range, triggering a preset automatic click event, and recording a response time of the automatic click event;
    将所述当前测试子区间与所述响应时间之间的对应关系存储入所述关系对应表中,然后返回执行所述从所述子区间中任意选取一个子区间作为当前测试子区间的步骤,直至各个子区间均被选取过为止。Storing the correspondence between the current test subinterval and the response time in the relationship correspondence table, and then returning to perform the step of randomly selecting one subinterval from the subinterval as the current test subinterval, Until each sub-interval has been selected.
  6. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by a processor, implement the following steps:
    获取目标终端接收到第一点击事件时的第一时刻;Obtaining a first moment when the target terminal receives the first click event;
    获取所述目标终端接收到第二点击事件时的第二时刻,所述第二点击事件为在所述第一点击事件之后的第一个点击事件;Obtaining a second moment when the target terminal receives the second click event, where the second click event is the first click event after the first click event;
    计算所述第二时刻与所述第一时刻之间的时间间隔;Calculating a time interval between the second moment and the first moment;
    若所述时间间隔大于或等于预设的间隔阈值,则根据预设的系统响应时间对所述第二点击事件进行响应;If the time interval is greater than or equal to a preset interval threshold, responding to the second click event according to a preset system response time;
    若所述时间间隔小于所述间隔阈值,则计算所述目标终端当前的硬件资源使用率;If the time interval is less than the interval threshold, calculating a current hardware resource usage rate of the target terminal;
    在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间,所述目标响应时间与所述硬件资源使用率正相关;Querying, in a preset relationship correspondence table, a target response time corresponding to the hardware resource usage rate, where the target response time is positively correlated with the hardware resource usage rate;
    根据所述目标响应时间对所述第二点击事件进行响应。Responding to the second click event based on the target response time.
  7. 根据权利要求6所述的计算机可读存储介质,其特征在于,所述计算所述目标终端当前的硬件资源使用率包括:The computer readable storage medium according to claim 6, wherein the calculating the current hardware resource usage rate of the target terminal comprises:
    获取所述目标终端当前的CPU使用率;Obtaining a current CPU usage rate of the target terminal;
    获取所述目标终端当前的内存使用率;Obtaining a current memory usage rate of the target terminal;
    根据下式计算所述目标终端当前的硬件资源使用率:Calculating the current hardware resource usage rate of the target terminal according to the following formula:
    η=(sinλ max) 2max+(cosλ max) 2minη=(sinλ max ) 2max +(cosλ max ) 2min ;
    其中,λ max=max(λ CPUMemory),λ min=min(λ CPUMemory),λ CPU为所述目标终端当前的CPU使用率,λ Memory为所述目标终端当前的内存使用率,η为所述目标终端当前的硬件资源使用率。 Where λ max =max(λ CPU , λ Memory ), λ min =min(λ CPU , λ Memory ), λ CPU is the current CPU usage of the target terminal, and λ Memory is the current memory usage of the target terminal Rate, η is the current hardware resource usage rate of the target terminal.
  8. 根据权利要求7所述的计算机可读存储介质,其特征在于,所述获取所述目标终端当前的CPU使用率包括:The computer readable storage medium according to claim 7, wherein the obtaining the current CPU usage of the target terminal comprises:
    在预设的第一采样时刻,获取所述目标终端中预设的记录CPU信息的文件;Obtaining, at a preset first sampling moment, a file that records preset CPU information in the target terminal;
    从所述记录CPU信息的文件中提取在所述第一采样时刻的CPU运行状态数据;Extracting CPU operating state data at the first sampling time from the file that records CPU information;
    在预设的第二采样时刻,获取所述记录CPU信息的文件,所述第二采样时刻与所述第一采样时刻间隔预设的时长;Obtaining, by the preset second sampling moment, the file that records the CPU information, where the second sampling moment is separated from the first sampling time by a preset duration;
    从所述记录CPU信息的文件中提取在所述第二采样时刻的CPU运行状态数据;Extracting CPU operating state data at the second sampling time from the file that records CPU information;
    根据在所述第一采样时刻的CPU运行状态数据和在所述第二采样时刻的CPU运行状态数据计算所述CPU使用率。The CPU usage rate is calculated based on CPU operating state data at the first sampling instant and CPU operating state data at the second sampling instant.
  9. 根据权利要求7所述的计算机可读存储介质,其特征在于,所述获取所述目标终端当前的内存使用率包括:The computer readable storage medium according to claim 7, wherein the obtaining the current memory usage of the target terminal comprises:
    获取所述目标终端中预设的记录内存信息的文件;Obtaining a file of the preset recording memory information in the target terminal;
    从所述记录内存信息的文件中提取出内存空间总量以及内存空间可使用的余量;Extracting the total amount of memory space and the margin available for the memory space from the file that records the memory information;
    根据所述内存空间总量以及所述内存空间可使用的余量计算所述内存使用率。The memory usage rate is calculated according to the total amount of memory space and a margin that can be used by the memory space.
  10. 根据权利要求6至9中任一项所述的计算机可读存储介质,其特征在于,所述关系对应表的预设过程包括:The computer readable storage medium according to any one of claims 6 to 9, wherein the preset process of the relationship correspondence table comprises:
    将所述硬件资源使用率的取值范围划分为预设数目的子区间;Dividing the value range of the hardware resource usage rate into a preset number of subintervals;
    从所述子区间中任意选取一个子区间作为当前测试子区间;Selecting a subinterval from the subinterval as the current test subinterval;
    运行预设的任务;Run a preset task;
    计算当前的硬件资源使用率;Calculate the current hardware resource usage rate;
    若所述硬件资源使用率与目标使用率之差不在预设的误差范围内,则调整所述预设的任务的运行数量,并返回执行所述计算当前的硬件资源使用率的步骤,所述目标使用率为所述当前测试子区间的上限值;If the difference between the hardware resource usage rate and the target usage rate is not within a preset error range, adjusting the running quantity of the preset task, and returning to performing the step of calculating the current hardware resource usage rate, The target usage rate is the upper limit value of the current test subinterval;
    若所述硬件资源使用率与目标使用率之差在所述误差范围内,则触发预设的自动 点击事件,并记录所述自动点击事件的响应时间;If the difference between the hardware resource usage rate and the target usage rate is within the error range, triggering a preset automatic click event, and recording a response time of the automatic click event;
    将所述当前测试子区间与所述响应时间之间的对应关系存储入所述关系对应表中,然后返回执行所述从所述子区间中任意选取一个子区间作为当前测试子区间的步骤,直至各个子区间均被选取过为止。Storing the correspondence between the current test subinterval and the response time in the relationship correspondence table, and then returning to perform the step of randomly selecting one subinterval from the subinterval as the current test subinterval, Until each sub-interval has been selected.
  11. 一种点击事件响应终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A click event response terminal device comprising a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, wherein the processor executes the computer readable instructions The following steps are implemented:
    获取目标终端接收到第一点击事件时的第一时刻;Obtaining a first moment when the target terminal receives the first click event;
    获取所述目标终端接收到第二点击事件时的第二时刻,所述第二点击事件为在所述第一点击事件之后的第一个点击事件;Obtaining a second moment when the target terminal receives the second click event, where the second click event is the first click event after the first click event;
    计算所述第二时刻与所述第一时刻之间的时间间隔;Calculating a time interval between the second moment and the first moment;
    若所述时间间隔大于或等于预设的间隔阈值,则根据预设的系统响应时间对所述第二点击事件进行响应;If the time interval is greater than or equal to a preset interval threshold, responding to the second click event according to a preset system response time;
    若所述时间间隔小于所述间隔阈值,则计算所述目标终端当前的硬件资源使用率;If the time interval is less than the interval threshold, calculating a current hardware resource usage rate of the target terminal;
    在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间,所述目标响应时间与所述硬件资源使用率正相关;Querying, in a preset relationship correspondence table, a target response time corresponding to the hardware resource usage rate, where the target response time is positively correlated with the hardware resource usage rate;
    根据所述目标响应时间对所述第二点击事件进行响应。Responding to the second click event based on the target response time.
  12. 根据权利要求11所述的点击事件响应终端设备,其特征在于,所述计算所述目标终端当前的硬件资源使用率包括:The click event response terminal device according to claim 11, wherein the calculating the current hardware resource usage rate of the target terminal comprises:
    获取所述目标终端当前的CPU使用率;Obtaining a current CPU usage rate of the target terminal;
    获取所述目标终端当前的内存使用率;Obtaining a current memory usage rate of the target terminal;
    根据下式计算所述目标终端当前的硬件资源使用率:Calculating the current hardware resource usage rate of the target terminal according to the following formula:
    η=(sinλ max) 2max+(cosλ max) 2minη=(sinλ max ) 2max +(cosλ max ) 2min ;
    其中,λ max=max(λ CPUMemory),λ min=min(λ CPUMemory),λ CPU为所述目标终端当前的CPU使用率,λ Memory为所述目标终端当前的内存使用率,η为所述目标终端当前的硬件资源使用率。 Where λ max =max(λ CPU , λ Memory ), λ min =min(λ CPU , λ Memory ), λ CPU is the current CPU usage of the target terminal, and λ Memory is the current memory usage of the target terminal Rate, η is the current hardware resource usage rate of the target terminal.
  13. 根据权利要求12所述的点击事件响应终端设备,其特征在于,所述获取所述目标终端当前的CPU使用率包括:The click event response terminal device according to claim 12, wherein the obtaining the current CPU usage rate of the target terminal comprises:
    在预设的第一采样时刻,获取所述目标终端中预设的记录CPU信息的文件;Obtaining, at a preset first sampling moment, a file that records preset CPU information in the target terminal;
    从所述记录CPU信息的文件中提取在所述第一采样时刻的CPU运行状态数据;Extracting CPU operating state data at the first sampling time from the file that records CPU information;
    在预设的第二采样时刻,获取所述记录CPU信息的文件,所述第二采样时刻与所 述第一采样时刻间隔预设的时长;Obtaining, in a preset second sampling moment, the file that records the CPU information, where the second sampling moment is separated from the first sampling time by a preset duration;
    从所述记录CPU信息的文件中提取在所述第二采样时刻的CPU运行状态数据;Extracting CPU operating state data at the second sampling time from the file that records CPU information;
    根据在所述第一采样时刻的CPU运行状态数据和在所述第二采样时刻的CPU运行状态数据计算所述CPU使用率。The CPU usage rate is calculated based on CPU operating state data at the first sampling instant and CPU operating state data at the second sampling instant.
  14. 根据权利要求12所述的点击事件响应终端设备,其特征在于,所述获取所述目标终端当前的内存使用率包括:The click event response terminal device according to claim 12, wherein the obtaining the current memory usage rate of the target terminal comprises:
    获取所述目标终端中预设的记录内存信息的文件;Obtaining a file of the preset recording memory information in the target terminal;
    从所述记录内存信息的文件中提取出内存空间总量以及内存空间可使用的余量;Extracting the total amount of memory space and the margin available for the memory space from the file that records the memory information;
    根据所述内存空间总量以及所述内存空间可使用的余量计算所述内存使用率。The memory usage rate is calculated according to the total amount of memory space and a margin that can be used by the memory space.
  15. 根据权利要求11至14中任一项所述的点击事件响应终端设备,其特征在于,所述关系对应表的预设过程包括:The click event response terminal device according to any one of claims 11 to 14, wherein the preset process of the relationship correspondence table comprises:
    将所述硬件资源使用率的取值范围划分为预设数目的子区间;Dividing the value range of the hardware resource usage rate into a preset number of subintervals;
    从所述子区间中任意选取一个子区间作为当前测试子区间;Selecting a subinterval from the subinterval as the current test subinterval;
    运行预设的任务;Run a preset task;
    计算当前的硬件资源使用率;Calculate the current hardware resource usage rate;
    若所述硬件资源使用率与目标使用率之差不在预设的误差范围内,则调整所述预设的任务的运行数量,并返回执行所述计算当前的硬件资源使用率的步骤,所述目标使用率为所述当前测试子区间的上限值;If the difference between the hardware resource usage rate and the target usage rate is not within a preset error range, adjusting the running quantity of the preset task, and returning to performing the step of calculating the current hardware resource usage rate, The target usage rate is the upper limit value of the current test subinterval;
    若所述硬件资源使用率与目标使用率之差在所述误差范围内,则触发预设的自动点击事件,并记录所述自动点击事件的响应时间;If the difference between the hardware resource usage rate and the target usage rate is within the error range, triggering a preset automatic click event, and recording a response time of the automatic click event;
    将所述当前测试子区间与所述响应时间之间的对应关系存储入所述关系对应表中,然后返回执行所述从所述子区间中任意选取一个子区间作为当前测试子区间的步骤,直至各个子区间均被选取过为止。Storing the correspondence between the current test subinterval and the response time in the relationship correspondence table, and then returning to perform the step of randomly selecting one subinterval from the subinterval as the current test subinterval, Until each sub-interval has been selected.
  16. 一种点击事件响应装置,其特征在于,包括:A click event response device, comprising:
    第一时刻获取模块,用于获取目标终端接收到第一点击事件时的第一时刻;a first time acquiring module, configured to acquire a first time when the target terminal receives the first click event;
    第二时刻获取模块,用于获取所述目标终端接收到第二点击事件时的第二时刻,所述第二点击事件为在所述第一点击事件之后的第一个点击事件;a second time acquisition module, configured to acquire a second time when the target terminal receives the second click event, where the second click event is a first click event after the first click event;
    时间间隔计算模块,用于计算所述第二时刻与所述第一时刻之间的时间间隔;a time interval calculation module, configured to calculate a time interval between the second time and the first time;
    第一响应模块,用于若所述时间间隔大于或等于预设的间隔阈值,则根据预设的系统响应时间对所述第二点击事件进行响应;a first response module, configured to respond to the second click event according to a preset system response time if the time interval is greater than or equal to a preset interval threshold;
    硬件资源使用率计算模块,用于若所述时间间隔小于所述间隔阈值,则计算所述目标终端当前的硬件资源使用率;a hardware resource usage calculation module, configured to calculate a current hardware resource usage rate of the target terminal, if the time interval is less than the interval threshold;
    目标响应时间查询模块,用于在预设的关系对应表中查询与所述硬件资源使用率对应的目标响应时间,所述目标响应时间与所述硬件资源使用率正相关;a target response time querying module, configured to query, in a preset relationship correspondence table, a target response time corresponding to the hardware resource usage rate, where the target response time is positively correlated with the hardware resource usage rate;
    第二响应模块,用于根据所述目标响应时间对所述第二点击事件进行响应。a second response module, configured to respond to the second click event according to the target response time.
  17. 根据权利要求16所述的点击事件响应装置,其特征在于,所述硬件资源使用率计算模块包括:The click event response device according to claim 16, wherein the hardware resource usage calculation module comprises:
    CPU使用率获取单元,用于获取所述目标终端当前的CPU使用率;a CPU usage obtaining unit, configured to acquire a current CPU usage rate of the target terminal;
    内存使用率获取单元,用于获取所述目标终端当前的内存使用率;a memory usage obtaining unit, configured to acquire a current memory usage rate of the target terminal;
    硬件资源使用率计算单元,用于根据下式计算所述目标终端当前的硬件资源使用率:a hardware resource usage calculation unit, configured to calculate a current hardware resource usage rate of the target terminal according to the following formula:
    η=(sinλ max) 2max+(cosλ max) 2minη=(sinλ max ) 2max +(cosλ max ) 2min ;
    其中,λ max=max(λ CPUMemory),λ min=min(λ CPUMemory),λ CPU为所述目标终端当前的CPU使用率,λ Memory为所述目标终端当前的内存使用率,η为所述目标终端当前的硬件资源使用率。 Where λ max =max(λ CPU , λ Memory ), λ min =min(λ CPU , λ Memory ), λ CPU is the current CPU usage of the target terminal, and λ Memory is the current memory usage of the target terminal Rate, η is the current hardware resource usage rate of the target terminal.
  18. 根据权利要求17所述的点击事件响应装置,其特征在于,所述CPU使用率获取单元包括:The click event response device according to claim 17, wherein the CPU usage rate obtaining unit comprises:
    第一CPU信息文件获取子单元,用于在预设的第一采样时刻,获取所述目标终端中预设的记录CPU信息的文件;a first CPU information file obtaining subunit, configured to acquire, at a preset first sampling moment, a file that records preset CPU information in the target terminal;
    第一CPU运行状态数据提取子单元,用于从所述记录CPU信息的文件中提取在所述第一采样时刻的CPU运行状态数据;a first CPU running state data extracting subunit, configured to extract CPU operating state data at the first sampling moment from the file that records CPU information;
    第二CPU信息文件获取子单元,用于在预设的第二采样时刻,获取所述记录CPU信息的文件,所述第二采样时刻与所述第一采样时刻间隔预设的时长;a second CPU information file obtaining sub-unit, configured to acquire the file for recording CPU information at a preset second sampling time, where the second sampling time is separated from the first sampling time by a preset duration;
    第二CPU运行状态数据提取子单元,用于从所述记录CPU信息的文件中提取在所述第二采样时刻的CPU运行状态数据;a second CPU running state data extracting subunit, configured to extract CPU operating state data at the second sampling moment from the file that records CPU information;
    CPU使用率计算子单元,用于根据在所述第一采样时刻的CPU运行状态数据和在所述第二采样时刻的CPU运行状态数据计算所述CPU使用率。And a CPU usage calculation subunit configured to calculate the CPU usage rate according to CPU operating state data at the first sampling moment and CPU operating state data at the second sampling moment.
  19. 根据权利要求17所述的点击事件响应装置,其特征在于,所述内存使用率获取单元包括:The click event response device according to claim 17, wherein the memory usage rate obtaining unit comprises:
    内存信息文件获取子单元,用于获取所述目标终端中预设的记录内存信息的文件;a memory information file obtaining subunit, configured to acquire a file of the preset recording memory information in the target terminal;
    内存信息提取子单元,用于从所述记录内存信息的文件中提取出内存空间总量以及内存空间可使用的余量;a memory information extraction subunit, configured to extract a total amount of memory space and a margin that can be used by the memory space from the file that records the memory information;
    内存使用率计算子单元,用于根据所述内存空间总量以及所述内存空间可使用的 余量计算所述内存使用率。And a memory usage calculation subunit, configured to calculate the memory usage rate according to the total amount of the memory space and a margin that can be used by the memory space.
  20. 根据权利要求16至19中任一项所述的点击事件响应装置,其特征在于,还包括:The click event response device according to any one of claims 16 to 19, further comprising:
    子区间划分模块,用于将所述硬件资源使用率的取值范围划分为预设数目的子区间;a sub-interval partitioning module, configured to divide a value range of the hardware resource usage rate into a preset number of sub-intervals;
    当前测试子区间选取模块,用于从所述子区间中任意选取一个子区间作为当前测试子区间;The current test sub-interval selection module is configured to arbitrarily select one sub-interval from the sub-interval as the current test sub-interval;
    任务运行模块,用于运行预设的任务;a task running module for running a preset task;
    硬件资源使用率计算模块,用于计算当前的硬件资源使用率;a hardware resource usage calculation module for calculating a current hardware resource usage rate;
    任务数量调整模块,用于若所述硬件资源使用率与目标使用率之差不在预设的误差范围内,则调整所述预设的任务的运行数量,所述目标使用率为所述当前测试子区间的上限值;a task quantity adjustment module, configured to adjust a running quantity of the preset task if the difference between the hardware resource usage rate and the target usage rate is not within a preset error range, where the target usage rate is the current test The upper limit of the subinterval;
    响应时间记录模块,用于若所述硬件资源使用率与目标使用率之差在所述误差范围内,则触发预设的自动点击事件,并记录所述自动点击事件的响应时间;a response time recording module, configured to trigger a preset automatic click event if the difference between the hardware resource usage rate and the target usage rate is within the error range, and record a response time of the automatic click event;
    关系对应表存储模块,用于将所述当前测试子区间与所述响应时间之间的对应关系存储入所述关系对应表中。The relationship correspondence table storage module is configured to store a correspondence between the current test subinterval and the response time in the relationship correspondence table.
PCT/CN2018/083284 2018-02-07 2018-04-17 Method for responding to click event, readable storage medium, terminal device, and apparatus WO2019153502A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810121665.6A CN108491122B (en) 2018-02-07 2018-02-07 Click event response method, computer readable storage medium and terminal equipment
CN201810121665.6 2018-02-07

Publications (1)

Publication Number Publication Date
WO2019153502A1 true WO2019153502A1 (en) 2019-08-15

Family

ID=63344654

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/083284 WO2019153502A1 (en) 2018-02-07 2018-04-17 Method for responding to click event, readable storage medium, terminal device, and apparatus

Country Status (2)

Country Link
CN (1) CN108491122B (en)
WO (1) WO2019153502A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159038A (en) * 2019-12-30 2020-05-15 北京声智科技有限公司 Method for simulating CPU load and electronic equipment

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111025010B (en) * 2019-11-25 2022-03-11 科华恒盛股份有限公司 Method and device for measuring active response time of equipment and terminal equipment
CN111176966A (en) * 2019-12-26 2020-05-19 京信通信系统(中国)有限公司 Method, device and equipment for determining CPU utilization rate and storage medium
CN112698594B (en) * 2020-12-14 2022-09-02 北京小米移动软件有限公司 Equipment control method and device
CN113163483B (en) * 2021-04-19 2022-08-23 北京字节跳动网络技术有限公司 Timestamp updating method and device and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040237087A1 (en) * 2003-05-08 2004-11-25 Nong Ye Job scheduling techniques to reduce the variance of waiting time
EP2280345A1 (en) * 2009-07-20 2011-02-02 Nxp B.V. A device for and a method of managing computer tasks
CN102306095A (en) * 2011-07-21 2012-01-04 宇龙计算机通信科技(深圳)有限公司 Application management method and terminal
CN104765557A (en) * 2015-03-18 2015-07-08 北京畅游天下网络技术有限公司 Method and device for reducing mis-operation of touch screen
CN105094826A (en) * 2015-07-23 2015-11-25 上海斐讯数据通信技术有限公司 Response method and device thereof for interactive interface views in client terminal system
CN106125984A (en) * 2016-06-28 2016-11-16 维沃移动通信有限公司 The touch-control processing method of a kind of mobile terminal and mobile terminal
CN107168757A (en) * 2017-03-31 2017-09-15 武汉斗鱼网络科技有限公司 A kind of Android ends prevent View controls from clicking on the method and device of shake

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040237087A1 (en) * 2003-05-08 2004-11-25 Nong Ye Job scheduling techniques to reduce the variance of waiting time
EP2280345A1 (en) * 2009-07-20 2011-02-02 Nxp B.V. A device for and a method of managing computer tasks
CN102306095A (en) * 2011-07-21 2012-01-04 宇龙计算机通信科技(深圳)有限公司 Application management method and terminal
CN104765557A (en) * 2015-03-18 2015-07-08 北京畅游天下网络技术有限公司 Method and device for reducing mis-operation of touch screen
CN105094826A (en) * 2015-07-23 2015-11-25 上海斐讯数据通信技术有限公司 Response method and device thereof for interactive interface views in client terminal system
CN106125984A (en) * 2016-06-28 2016-11-16 维沃移动通信有限公司 The touch-control processing method of a kind of mobile terminal and mobile terminal
CN107168757A (en) * 2017-03-31 2017-09-15 武汉斗鱼网络科技有限公司 A kind of Android ends prevent View controls from clicking on the method and device of shake

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159038A (en) * 2019-12-30 2020-05-15 北京声智科技有限公司 Method for simulating CPU load and electronic equipment
CN111159038B (en) * 2019-12-30 2023-07-14 北京声智科技有限公司 Method for simulating CPU load and electronic equipment

Also Published As

Publication number Publication date
CN108491122A (en) 2018-09-04
CN108491122B (en) 2020-02-18

Similar Documents

Publication Publication Date Title
WO2019153502A1 (en) Method for responding to click event, readable storage medium, terminal device, and apparatus
CN106407190B (en) Event record query method and device
US10678596B2 (en) User behavior-based dynamic resource capacity adjustment
CN108874535B (en) Task adjusting method, computer readable storage medium and terminal device
CN107273182B (en) Method and system for dynamically expanding virtual machine resources
TW201510868A (en) Methods and apparatuses of switching applications and adding entry information
US20100251254A1 (en) Information processing apparatus, storage medium, and state output method
CN109117280B (en) Electronic device, method for limiting inter-process communication thereof and storage medium
WO2019085307A1 (en) Data sampling method, terminal, and device, and computer readable storage medium
WO2021088351A1 (en) Node data deployment method, deployment node, system and medium
WO2021093365A1 (en) Gpu video memory management control method and related device
WO2018149085A1 (en) Method and system for optimizing database system, electronic device, and storage medium
WO2021184724A1 (en) Method and apparatus and device for automatically adjusting timing backup operation initiation time, and medium
WO2014067298A1 (en) Real-time information retrieval acquisition method and device and server
EP2972826A1 (en) Multi-core binary translation task processing
CN106648916B (en) Method and device for reporting pedometer message
WO2023193527A1 (en) Thread execution method and apparatus, electronic device, and computer-readable storage medium
WO2020224125A1 (en) Method and device for monitoring io delay of distributed file system, and storage medium
WO2022257389A1 (en) Task delay risk detection method, electronic device and storage medium
CN107517273B (en) Data migration method, system, computer readable storage medium and server
CN116361106A (en) Log processing method and device, electronic equipment and storage medium
WO2019169727A1 (en) Network traffic test method and apparatus, device, and computer-readable storage medium
US20210165724A1 (en) Universal profiling device and method
CN110865877B (en) Task request response method and device
CN111767137B (en) System deployment method and device, electronic equipment and storage medium

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: 18904937

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 03.11.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18904937

Country of ref document: EP

Kind code of ref document: A1