Movatterモバイル変換


[0]ホーム

URL:


CN114461323B - Clamping and processing method and device, electronic equipment and storage medium - Google Patents

Clamping and processing method and device, electronic equipment and storage medium
Download PDF

Info

Publication number
CN114461323B
CN114461323BCN202210091573.4ACN202210091573ACN114461323BCN 114461323 BCN114461323 BCN 114461323BCN 202210091573 ACN202210091573 ACN 202210091573ACN 114461323 BCN114461323 BCN 114461323B
Authority
CN
China
Prior art keywords
application
refresh
frame
time
duration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN202210091573.4A
Other languages
Chinese (zh)
Other versions
CN114461323A (en
Inventor
胡自健
闫森
王洪烛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Electronic Technology Shenzhen Co ltd
Original Assignee
Hisense Electronic Technology Shenzhen Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Electronic Technology Shenzhen Co ltdfiledCriticalHisense Electronic Technology Shenzhen Co ltd
Priority to CN202210091573.4ApriorityCriticalpatent/CN114461323B/en
Publication of CN114461323ApublicationCriticalpatent/CN114461323A/en
Application grantedgrantedCritical
Publication of CN114461323BpublicationCriticalpatent/CN114461323B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The application provides a method and a device for processing a card, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps of determining a system frame set after determining that application refreshing is blocked and meets a set condition based on a first time-consuming time length of an application refreshing frame in terminal screen refreshing, determining an overall time-consuming time length of the system frame set based on a second time-consuming time length of each system refreshing frame in the system frame set, adjusting GPU frequency if the overall time-consuming time length exceeds the first set time length, and adjusting CPU frequency and/or application rendering thread based on system load and application rendering thread load if the overall time-consuming time length does not exceed the first set time length. Because the time consumption of the application refreshing frame and the system refreshing frame in the refreshing process can be obtained, the blocking can be accurately identified, and the problem that the blocking is caused by the application refreshing or the system refreshing can be effectively distinguished, so that corresponding system resources are scheduled for processing, and continuous blocking is prevented.

Description

Translated fromChinese
一种卡顿处理方法、装置、电子设备及存储介质Method, device, electronic device and storage medium for freezing

技术领域technical field

本申请涉及计算机技术领域,具体涉及一种卡顿处理方法、装置、电子设备及存储介质。The present application relates to the field of computer technology, and in particular to a freezing processing method, device, electronic equipment, and storage medium.

背景技术Background technique

得益于手机的硬件资源的不断刷新,能够承担的场景也越来越复杂,但受限于发热问题,手机不可能一直以最高性能运行。而随着应用(APP)版本更新,应用厂商为了提升用户手机应用视觉体验,不断加入新的功能和资源,页面复杂度也在不断提升。同时,Android系统是一个多进程实时系统,当多个APP同时运行时,会因资源争夺产生APP卡顿现象。Thanks to the continuous refresh of the hardware resources of the mobile phone, the scenarios that can be undertaken are becoming more and more complex, but due to the heat problem, the mobile phone cannot always run at the highest performance. With the update of the application (APP) version, application manufacturers continue to add new functions and resources in order to improve the user's mobile phone application visual experience, and the complexity of the page is also constantly increasing. At the same time, the Android system is a multi-process real-time system. When multiple APPs are running at the same time, APP freezes will occur due to resource competition.

APP卡顿直观表现,就是为及时更新界面。更新界面,涉及到三个部分,应用刷新率、系统刷新率,硬件刷新率。应用刷新率,即应用以一定周期进行界面的刷新数据的准备;系统刷新率,即系统以一定周期进行多个应用界面刷新数据的合成;硬件刷新率,即硬件屏幕的刷新周期。The intuitive performance of APP freeze is to update the interface in time. The update interface involves three parts, application refresh rate, system refresh rate, and hardware refresh rate. The application refresh rate means that the application prepares the refresh data of the interface at a certain period; the system refresh rate means that the system synthesizes the refresh data of multiple application interfaces at a certain period; the hardware refresh rate refers to the refresh cycle of the hardware screen.

相关技术中,通常采用图像识别方法通过对系统界面的比较来实现APP卡顿的识别,以确定APP是否存在卡顿的,然而,当系统界面不更新或者差异小时,该方法会存在误判的情况,因此对APP卡顿识别的准确度不高。In related technologies, image recognition methods are usually used to identify APP freezes by comparing the system interface to determine whether there is a freeze in the APP. However, when the system interface is not updated or the difference is small, this method may cause misjudgment. Therefore, the accuracy of APP freeze recognition is not high.

发明内容Contents of the invention

为解决现有存在的技术问题,本申请实施例提供一种卡顿处理方法、装置、电子设备及存储介质,可以有效地提高对APP卡顿识别的准确度。In order to solve the existing technical problems, the embodiments of the present application provide a freeze processing method, device, electronic equipment, and storage medium, which can effectively improve the accuracy of APP freeze recognition.

为达到上述目的,本申请实施例的技术方案是这样实现的:In order to achieve the above-mentioned purpose, the technical scheme of the embodiment of the present application is realized in this way:

第一方面,本申请实施例提供一种卡顿处理方法,包括:In the first aspect, the embodiment of the present application provides a freeze handling method, including:

终端屏幕每刷新一次,确定最近刷新使用的应用刷新帧;Each time the terminal screen is refreshed, determine the application refresh frame used for the latest refresh;

基于所述应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合,其中所述系统帧集合包括初始系统刷新帧和最近刷新使用的系统刷新帧,以及所述初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧;所述初始系统刷新帧为所述终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合设定条件对应的系统刷新帧的下一个系统刷新帧;所述第一耗时时长为应用基于对应的所述应用刷新帧组织所述终端屏幕的刷新帧数据的耗时时长;所述设定条件为所述应用刷新卡顿符合严重卡顿条件,或所述终端屏幕的刷新达到设定次数;Based on the first time-consuming period of the application refresh frame, after it is determined that the application refresh freeze occurs and meets the set conditions, a system frame set is determined, wherein the system frame set includes the initial system refresh frame and the system used for the latest refresh Refresh frame, and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh; the initial system refresh frame is the first system refresh frame after the terminal screen is on or the last time The next system refresh frame that meets the system refresh frame corresponding to the set condition; the first time-consuming duration is the time-consuming duration for the application to organize the refresh frame data of the terminal screen based on the corresponding application refresh frame; the setting The predetermined condition is that the refresh of the application meets the severe freeze condition, or the refreshing of the terminal screen reaches a set number of times;

基于所述系统帧集合中各所述系统刷新帧的第二耗时时长,确定所述系统帧集合的整体耗时时长;所述第二耗时时长为系统基于对应的所述系统刷新帧合成所述终端屏幕的刷新帧数据的耗时时长;Based on the second time-consuming duration of each of the system refresh frames in the system frame set, determine the overall time-consuming duration of the system frame set; the second time-consuming duration is synthesized by the system based on the corresponding system refresh frame The time-consuming time for refreshing the frame data of the terminal screen;

若所述整体耗时时长超过第一设定时长,则对GPU频率进行调整;其中,所述第一设定时长为所述系统刷新帧的正常耗时时长;若所述整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整。If the overall time-consuming duration exceeds the first set duration, the GPU frequency is adjusted; wherein, the first set duration is the normal time-consuming duration of the system refresh frame; if the overall time-consuming duration is not If the first set duration is exceeded, the CPU frequency and/or the application rendering thread are adjusted based on the system load and the application rendering thread load.

本申请实施例提供的卡顿处理方法,根据终端屏幕每刷新一次,确定出最近刷新使用的应用刷新帧,并基于应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合,基于系统帧集合中各系统刷新帧的第二耗时时长,确定系统帧集合的整体耗时时长,若整体耗时时长超过第一设定时长,则对GPU频率进行调整,若整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整。由于可以根据在刷新过程中,应用刷新帧和系统刷新帧的耗时来识别卡顿,可以准确地识别出卡顿,且可以有效地区分出卡顿的原因是应用刷新还是系统刷新的问题,并调度对应资源进行处理,防止连续卡顿的发生。The freeze processing method provided by the embodiment of the present application determines the application refresh frame used for the latest refresh every time the terminal screen is refreshed, and based on the first time-consuming period of the application refresh frame, when it is determined that the application refresh freeze occurs, and meets the After setting the conditions, determine the system frame set, and determine the overall time-consuming time of the system frame set based on the second time-consuming time of each system refresh frame in the system frame set. If the overall time-consuming time exceeds the first set time, then the The GPU frequency is adjusted, and if the overall time-consuming time does not exceed the first set time, the CPU frequency and/or the application rendering thread are adjusted based on the system load and the application rendering thread load. Since the freeze can be identified according to the time consumption of the application refresh frame and the system refresh frame during the refresh process, the freeze can be accurately identified, and the cause of the freeze can be effectively distinguished whether it is an application refresh or a system refresh. And schedule the corresponding resources for processing to prevent the occurrence of continuous freezes.

在一种可选的实施例中,所述应用刷新卡顿通过以下方式确定:In an optional embodiment, the application refresh freeze is determined by the following method:

若确定存在所述第一耗时时长超过第二设定时长的应用刷新帧,则确定出现应用刷新卡顿;所述第二设定时长为所述应用刷新帧的平均耗时时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a second set duration, it is determined that an application refresh freeze occurs; the second set duration is an average time-consuming duration of the application refresh frame.

在该实施例中,当确定存在第一耗时时长超过第二设定时长的应用刷新帧时,可以确定出现应用刷新卡顿,从而可以根据应用刷新帧的耗时来准确地识别出应用刷新卡顿。In this embodiment, when it is determined that there is an application refresh frame whose first duration exceeds the second set duration, it can be determined that the application refresh lag occurs, so that the application refresh can be accurately identified according to the time consumption of the application refresh frame Stuck and stopped.

在一种可选的实施例中,所述严重卡顿条件通过以下方式确定:In an optional embodiment, the severe freezing condition is determined in the following manner:

若确定存在所述第一耗时时长超过第三设定时长的应用刷新帧,则确定所述应用刷新帧符合严重卡顿条件;所述第三设定时长大于所述第二设定时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a third set duration, it is determined that the application refresh frame meets a severe freeze condition; the third set duration is longer than the second set duration.

在该实施例中,若确定存在第一耗时时长超过第三设定时长的应用刷新帧,则确定应用刷新帧符合严重卡顿条件,从而可以根据应用刷新帧的耗时来准确地识别出符合严重卡顿条件的应用刷新帧。In this embodiment, if it is determined that there is an application refresh frame whose first time-consuming duration exceeds the third set duration, it is determined that the application refresh frame meets the severe freezing condition, so that it can be accurately identified according to the time-consuming application refresh frame Apps that meet severe jank conditions refresh frames.

在一种可选的实施例中,所述在确定出现应用刷新卡顿,且符合设定条件后,所述方法还包括:In an optional embodiment, after it is determined that the application refresh is stuck and the set conditions are met, the method further includes:

确定应用帧集合,其中所述应用帧集合包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及所述初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;所述初始应用刷新帧为所述终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合设定条件对应的应用刷新帧的下一个应用刷新帧;Determine an application frame set, wherein the application frame set includes an initial application refresh frame and an application refresh frame used for the latest refresh, and an application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial The application refresh frame is the first application refresh frame after the terminal screen is turned on or the next application refresh frame corresponding to the application refresh frame that meets the set conditions last time;

基于所述应用帧集合中各所述应用刷新帧的第一耗时时长,确定所述应用帧集合的整体耗时时长,并将所述整体耗时时长作为一个抽样时长;Based on the first time-consuming duration of each of the application refresh frames in the application frame set, determine the overall time-consuming duration of the application frame set, and use the overall time-consuming duration as a sampling duration;

获取所述抽样时长内系统的各个CPU状态的累加记录时间,并根据所述累加记录时间和所述抽样时长,确定系统负载;Obtain the cumulative recording time of each CPU state of the system within the sampling duration, and determine the system load according to the cumulative recording time and the sampling duration;

获取所述抽样时长内应用渲染线程的运行时间和所述各个应用刷新帧在所述应用渲染线程上的整体处理时间,并根据所述运行时间和所述整体处理时间,确定应用渲染线程负载。Obtain the running time of the application rendering thread and the overall processing time of each application refresh frame on the application rendering thread within the sampling duration, and determine the load of the application rendering thread according to the running time and the overall processing time.

在该实施例中,在确定出现应用刷新卡顿,且符合设定条件后,还可以确定应用帧集合,基于应用帧集合中各应用刷新帧的第一耗时时长,确定应用帧集合的整体耗时时长,并将整体耗时时长作为一个抽样时长,获取抽样时长内系统的各个CPU状态的累加记录时间,并根据累加记录时间和抽样时长,确定系统负载,以及获取抽样时长内应用渲染线程的运行时间和各个应用刷新帧在应用渲染线程上的整体处理时间,并根据运行时间和整体处理时间,确定应用渲染线程负载。从而在根据应用刷新帧的耗时确定应用帧集合,并基于应用帧集合确定抽样时长后,计算得到抽样时长内的系统负载和应用渲染线程负载。In this embodiment, after it is determined that the application refresh is stuck and meets the set conditions, the application frame set can also be determined, and the overall application frame set can be determined based on the first time-consuming period of each application refresh frame in the application frame set. Time-consuming, and take the overall time-consuming time as a sampling time to obtain the accumulated recording time of each CPU state of the system within the sampling time, and determine the system load based on the accumulated recording time and sampling time, and obtain the application rendering thread within the sampling time The running time and the overall processing time of each application refresh frame on the application rendering thread, and determine the application rendering thread load according to the running time and the overall processing time. Therefore, after the application frame set is determined according to the application frame refresh time, and the sampling duration is determined based on the application frame set, the system load and the application rendering thread load within the sampling duration are calculated.

在一种可选的实施例中,所述基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整,包括:In an optional embodiment, the adjusting the CPU frequency and/or the application rendering thread based on the system load and the application rendering thread load includes:

若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对所述CPU频率进行调整;If the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, then adjust the CPU frequency;

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整;If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread load exceeds the second set threshold, then adjust the scheduling priority of the application rendering thread;

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the load of the application rendering thread is lower than the second set threshold, the running core of the application rendering thread is adjusted.

在该实施例中,若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对CPU频率进行调整,若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整,若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。从而可以基于不同的卡顿原因,及时调度相应的系统资源进行卡顿处理,可以快速解决和修复系统资源造成的卡顿问题,避免连续卡顿造成的无响应问题。In this embodiment, if the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, the CPU frequency is adjusted. If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread load exceeds the second set threshold, then adjust the scheduling priority of the application rendering thread, if the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread If the thread load is lower than the second set threshold, the running core of the application rendering thread is adjusted. Therefore, based on different reasons for freezing, corresponding system resources can be dispatched in time to deal with freezing, which can quickly solve and repair the freezing problem caused by system resources, and avoid the unresponsive problem caused by continuous freezing.

第二方面,本申请实施例还提供了一种卡顿处理装置,包括:In the second aspect, the embodiment of the present application also provides a stuck processing device, including:

刷新帧确定单元,用于终端屏幕每刷新一次,确定最近刷新使用的应用刷新帧;The refresh frame determination unit is used to determine the application refresh frame used for the latest refresh every time the terminal screen is refreshed;

帧集合确定单元,用于基于所述应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合,其中所述系统帧集合包括初始系统刷新帧和最近刷新使用的系统刷新帧,以及所述初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧;所述初始系统刷新帧为所述终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合设定条件对应的系统刷新帧的下一个系统刷新帧;所述第一耗时时长为应用基于对应的所述应用刷新帧组织所述终端屏幕的刷新帧数据的耗时时长;所述设定条件为所述应用刷新卡顿符合严重卡顿条件,或所述终端屏幕的刷新达到设定次数;A frame set determination unit, configured to determine a system frame set after determining that the application refresh freezes and meets the set conditions based on the first time-consuming period of the application refresh frame, wherein the system frame set includes the initial system refresh frame and the system refresh frame used for the latest refresh, and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh; the initial system refresh frame is the first frame after the terminal screen is on A system refresh frame or the next system refresh frame of the system refresh frame corresponding to the set condition last time; the first time-consuming period is the time for the application to organize the refresh frame data of the terminal screen based on the corresponding application refresh frame It takes a long time; the set condition is that the refresh of the application meets the severe freeze condition, or the refreshing of the terminal screen reaches the set number of times;

整体耗时确定单元,基于所述系统帧集合中各所述系统刷新帧的第二耗时时长,确定所述系统帧集合的整体耗时时长;所述第二耗时时长为系统基于对应的所述系统刷新帧合成所述终端屏幕的刷新帧数据的耗时时长;The overall time-consuming determination unit determines the overall time-consuming duration of the system frame set based on the second time-consuming duration of each system refresh frame in the system frame set; the second time-consuming duration is the system based on the corresponding The time-consuming time for the system refresh frame to synthesize the refresh frame data of the terminal screen;

卡顿处理单元,用于若所述整体耗时时长超过第一设定时长,则对GPU频率进行调整;其中,所述第一设定时长为所述系统刷新帧的正常耗时时长;若所述整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整。A stuck processing unit, configured to adjust the frequency of the GPU if the overall time-consuming time exceeds a first set time; wherein, the first set time is the normal time-consuming time for the system to refresh frames; if If the overall time-consuming duration does not exceed the first set duration, then the CPU frequency and/or the application rendering thread are adjusted based on the system load and the application rendering thread load.

在一种可选的实施例中,所述帧集合确定单元,还用于:In an optional embodiment, the frame set determining unit is further configured to:

若确定存在所述第一耗时时长超过第二设定时长的应用刷新帧,则确定出现应用刷新卡顿;所述第二设定时长为所述应用刷新帧的平均耗时时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a second set duration, it is determined that an application refresh freeze occurs; the second set duration is an average time-consuming duration of the application refresh frame.

在一种可选的实施例中,所述帧集合确定单元,还用于:In an optional embodiment, the frame set determining unit is further configured to:

若确定存在所述第一耗时时长超过第三设定时长的应用刷新帧,则确定所述应用刷新帧符合严重卡顿条件;所述第三设定时长大于所述第二设定时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a third set duration, it is determined that the application refresh frame meets a severe freeze condition; the third set duration is longer than the second set duration.

在一种可选的实施例中,所述装置还包括负载确定单元,用于:In an optional embodiment, the device further includes a load determination unit, configured to:

确定应用帧集合,其中所述应用帧集合包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及所述初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;所述初始应用刷新帧为所述终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合设定条件对应的应用刷新帧的下一个应用刷新帧;Determine an application frame set, wherein the application frame set includes an initial application refresh frame and an application refresh frame used for the latest refresh, and an application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial The application refresh frame is the first application refresh frame after the terminal screen is turned on or the next application refresh frame corresponding to the application refresh frame that meets the set conditions last time;

基于所述应用帧集合中各所述应用刷新帧的第一耗时时长,确定所述应用帧集合的整体耗时时长,并将所述整体耗时时长作为一个抽样时长;Based on the first time-consuming duration of each of the application refresh frames in the application frame set, determine the overall time-consuming duration of the application frame set, and use the overall time-consuming duration as a sampling duration;

获取所述抽样时长内系统的各个CPU状态的累加记录时间,并根据所述累加记录时间和所述抽样时长,确定系统负载;Obtain the cumulative recording time of each CPU state of the system within the sampling duration, and determine the system load according to the cumulative recording time and the sampling duration;

获取所述抽样时长内应用渲染线程的运行时间和所述各个应用刷新帧在所述应用渲染线程上的整体处理时间,并根据所述运行时间和所述整体处理时间,确定应用渲染线程负载。Obtain the running time of the application rendering thread and the overall processing time of each application refresh frame on the application rendering thread within the sampling duration, and determine the load of the application rendering thread according to the running time and the overall processing time.

在一种可选的实施例中,所述卡顿处理单元,具体用于:In an optional embodiment, the freeze processing unit is specifically used for:

若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对所述CPU频率进行调整;If the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, then adjust the CPU frequency;

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整;If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread load exceeds the second set threshold, then adjust the scheduling priority of the application rendering thread;

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the load of the application rendering thread is lower than the second set threshold, the running core of the application rendering thread is adjusted.

第三方面,本申请实施例还提供了一种电子设备,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器实现上述第一方面的卡顿处理方法。In the third aspect, the embodiment of the present application also provides an electronic device, including a memory and a processor, the memory stores a computer program that can run on the processor, when the computer program is executed by the processor During execution, the processor is made to implement the stall handling method in the first aspect above.

第四方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时,实现上述第一方面的卡顿处理方法。In the fourth aspect, the embodiment of the present application also provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the above-mentioned lag in the first aspect is realized Approach.

第二方面、第三方面或第四方面中任意一种实现方式所带来的技术效果可参见第一方面的实现方式所带来的技术效果,此处不再赘述。For the technical effects brought about by any one of the implementations in the second aspect, the third aspect, or the fourth aspect, please refer to the technical effects brought about by the implementation in the first aspect, which will not be repeated here.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.

图1为本申请实施例提供的一种卡顿处理方法的流程图;FIG. 1 is a flow chart of a freeze processing method provided in an embodiment of the present application;

图2为本申请实施例提供的另一种卡顿处理方法的流程图;FIG. 2 is a flow chart of another freeze processing method provided in the embodiment of the present application;

图3为本申请实施例提供的一种卡顿识别方法的流程图;FIG. 3 is a flow chart of a stall identification method provided in an embodiment of the present application;

图4为本申请实施例提供的一种卡顿处理装置的结构示意图;FIG. 4 is a schematic structural diagram of a stuck processing device provided in an embodiment of the present application;

图5为本申请实施例提供的另一种卡顿处理装置的结构示意图;FIG. 5 is a schematic structural diagram of another stuck processing device provided in an embodiment of the present application;

图6为本申请实施例提供的一种电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the application clearer, the application will be further described in detail below in conjunction with the accompanying drawings. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

需要说明的是,本申请的文件中涉及的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second" and the like involved in the documents of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

下面结合附图及具体实施例对本申请作进一步详细的说明。The present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

下文中所用的词语“示例性”的意思为“用作例子、实施例或说明性”。作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。The word "exemplary" is used hereinafter to mean "serving as an example, embodiment or illustration". Any embodiment described as "exemplary" is not necessarily to be construed as superior or better than other embodiments. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

本申请实施例提供了一种卡顿处理方法,如图1所示,包括如下步骤:The embodiment of the present application provides a stuck processing method, as shown in Figure 1, including the following steps:

步骤S101,终端屏幕每刷新一次,确定最近刷新使用的应用刷新帧。Step S101 , each time the terminal screen is refreshed, determine the refresh frame of the application used for the latest refresh.

终端屏幕每刷新一次,就可以对应于一帧的应用刷新帧和系统刷新帧,通过在终端系统的相关流程中插入节点,就可以获取到经过这些流程节点的时间,从而终端屏幕每刷新一次,就可以获取到当前刷新对应的一个应用刷新帧的耗时和一个系统刷新帧的耗时。Every time the terminal screen is refreshed, it can correspond to a frame of application refresh frame and system refresh frame. By inserting nodes in the relevant processes of the terminal system, the time passing through these process nodes can be obtained, so that every time the terminal screen is refreshed, The time consumption of an application refresh frame and the time consumption of a system refresh frame corresponding to the current refresh can be obtained.

步骤S102,基于应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合。Step S102: Based on the first time-consuming period of application refresh frames, after it is determined that application refresh freezes occur and the set conditions are met, a set of system frames is determined.

其中,系统帧集合包括初始系统刷新帧和最近刷新使用的系统刷新帧,以及初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧,初始系统刷新帧为终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合设定条件对应的系统刷新帧的下一个系统刷新帧。Among them, the system frame set includes the initial system refresh frame and the system refresh frame used for the latest refresh, and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh, the initial system refresh frame is after the terminal screen is on The system refresh frame of the first system refresh frame or the next system refresh frame of the system refresh frame corresponding to the last set condition.

第一耗时时长为应用基于对应的应用刷新帧组织终端屏幕的刷新帧数据的耗时时长,设定条件为应用刷新卡顿符合严重卡顿条件,或终端屏幕的刷新达到设定次数。The first time-consuming period is the time-consuming period for the application to organize the refresh frame data of the terminal screen based on the corresponding application refresh frame, and the set condition is that the application refresh freeze meets the severe freeze condition, or the refresh of the terminal screen reaches the set number of times.

应用刷新卡顿可以通过以下方式确定:若确定存在第一耗时时长超过第二设定时长的应用刷新帧,则确定出现应用刷新卡顿。其中,第二设定时长为应用刷新帧的平均耗时时长。The application refresh stall may be determined in the following manner: if it is determined that there is an application refresh frame whose first time-consuming duration exceeds the second set duration, it is determined that the application refresh stall occurs. Wherein, the second set time length is an average time-consuming time for the application to refresh frames.

严重卡顿条件可以通过以下方式确定:若确定存在第一耗时时长超过第三设定时长的应用刷新帧,则确定应用刷新帧符合严重卡顿条件。其中,第三设定时长大于第二设定时长。The severe freeze condition may be determined in the following manner: if it is determined that there is an application refresh frame whose first time-consuming duration exceeds the third set duration, it is determined that the application refresh frame meets the severe freeze condition. Wherein, the third set duration is longer than the second set duration.

在一种实施例中,基于应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合时,也可以同时确定应用帧集合。其中,应用帧集合包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;初始应用刷新帧为终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合设定条件对应的应用刷新帧的下一个应用刷新帧。In one embodiment, based on the first time-consuming period of the application refresh frame, after it is determined that the application refresh freeze occurs and the set condition is met, when determining the system frame set, the application frame set may also be determined at the same time. Among them, the application frame set includes the initial application refresh frame and the application refresh frame used for the latest refresh, and the application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial application refresh frame is after the terminal screen is on The first application refresh frame of , or the next application refresh frame corresponding to the application refresh frame that meets the set conditions last time.

例如,设定每轮终端屏幕的刷新次数为20次,即设定终端屏幕每刷新20次就对识别出的卡顿进行处理。顺序地获取本轮的20次刷新分别对应的应用刷新帧和每个应用刷新帧的第一耗时时长,假定第1次刷新对应的应用刷新帧为第1帧,第二设定时长为16ms。For example, setting the refresh times of the terminal screen in each round is 20 times, that is, setting the terminal screen to refresh every 20 times to process the recognized freeze. Sequentially obtain the application refresh frames corresponding to the 20 refreshes of this round and the first time-consuming period of each application refresh frame. Assume that the application refresh frame corresponding to the first refresh is the first frame, and the second set duration is 16ms .

如果获取到的第1帧、第2帧和第3帧的第一耗时时长均为16ms,第4帧和第5帧的第一耗时时长均为34ms,第6帧的第一耗时时长为50ms,则可以将第1帧至第6帧作为一个应用帧集合,并根据该应用帧集合确定相应的系统帧集合,即该系统帧集合中可以包括第1次刷新对应的系统刷新帧和第6次刷新对应的系统刷新帧,以及第1次刷新对应的系统刷新帧和第6次刷新对应的系统刷新帧之间的系统刷新帧;If the first time-consuming duration of the obtained first frame, second frame and third frame is 16ms, the first time-consuming duration of the fourth frame and the fifth frame is 34ms, and the first time-consuming duration of the sixth frame If the duration is 50ms, the first frame to the sixth frame can be regarded as an application frame set, and the corresponding system frame set can be determined according to the application frame set, that is, the system frame set can include the system refresh frame corresponding to the first refresh The system refresh frame corresponding to the sixth refresh, and the system refresh frame between the system refresh frame corresponding to the first refresh and the system refresh frame corresponding to the sixth refresh;

如果在本轮的20次刷新中,除了第3帧和第7帧的第一耗时时长为34ms之外,其余的应用刷新帧的第一耗时时长均为16ms,则可以将第1帧至第20帧作为一个应用帧集合,并根据该应用帧集合确定相应的系统帧集合,即该系统帧集合中可以包括第1次刷新对应的系统刷新帧和第20次刷新对应的系统刷新帧,以及第1次刷新对应的系统刷新帧和第20次刷新对应的系统刷新帧之间的系统刷新帧。If in this round of 20 refreshes, except for the first time-consuming duration of the third frame and the seventh frame which is 34ms, the first time-consuming duration of the rest of the application refresh frames is 16ms, then the first frame can be The 20th frame is used as an application frame set, and the corresponding system frame set is determined according to the application frame set, that is, the system frame set can include the system refresh frame corresponding to the first refresh and the system refresh frame corresponding to the 20th refresh , and the system refresh frame between the system refresh frame corresponding to the first refresh and the system refresh frame corresponding to the 20th refresh.

在确定出应用帧集合后,基于应用帧集合中各应用刷新帧的第一耗时时长,确定应用帧集合的整体耗时时长,并将整体耗时时长作为一个抽样时长。获取该抽样时长内系统的各个CPU状态的累加记录时间,并根据累加记录时间和抽样时长,确定系统负载。同时获取该抽样时长内应用渲染线程的运行时间和各个应用刷新帧在应用渲染线程上的整体处理时间,并根据运行时间和整体处理时间,确定应用渲染线程负载。After the application frame set is determined, based on the first time-consuming duration of each application refresh frame in the application frame set, the overall time-consuming duration of the application frame set is determined, and the overall time-consuming duration is used as a sampling duration. The accumulated recording time of each CPU state of the system within the sampling period is obtained, and the system load is determined according to the accumulated recording time and the sampling period. At the same time, the running time of the application rendering thread and the overall processing time of each application refresh frame on the application rendering thread within the sampling period are obtained, and the load of the application rendering thread is determined according to the running time and the overall processing time.

步骤S103,基于系统帧集合中各系统刷新帧的第二耗时时长,确定系统帧集合的整体耗时时长。Step S103, based on the second time-consuming duration of each system refresh frame in the system frame set, determine the overall time-consuming duration of the system frame set.

其中,第二耗时时长为系统基于对应的系统刷新帧合成所述终端屏幕的刷新帧数据的耗时时长。Wherein, the second time-consuming period is the time-consuming period for the system to synthesize the refresh frame data of the terminal screen based on the corresponding system refresh frame.

步骤S104,若整体耗时时长超过第一设定时长,则对GPU频率进行调整。Step S104, if the overall time-consuming time exceeds the first set time, adjust the GPU frequency.

当系统帧集合的整体耗时时长超过第一设定时长时,可以对GPU频率进行调整,以加快数据的合成。When the overall time-consuming time of the system frame set exceeds the first set time, the frequency of the GPU may be adjusted to speed up the synthesis of data.

其中,第一设定时长为所述系统刷新帧的正常耗时时长。Wherein, the first set duration is the normal time-consuming duration of the system refresh frame.

步骤S105,若整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整。Step S105, if the overall time-consuming duration does not exceed the first set duration, adjust the CPU frequency and/or the application rendering thread based on the system load and the application rendering thread load.

当整体耗时时长不超过第一设定时长时,若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对CPU频率进行调整。When the overall time-consuming duration does not exceed the first set duration, if the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, the CPU frequency is adjusted.

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整。If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread load exceeds the second set threshold, the scheduling priority of the application rendering thread is adjusted.

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the load of the application rendering thread is lower than the second set threshold, the running core of the application rendering thread is adjusted.

在一些实施例中,本申请实施例中的卡顿处理方法还可以按照图2示出的过程进行实现。In some embodiments, the freezing processing method in the embodiment of the present application may also be implemented according to the process shown in FIG. 2 .

如图2所示,可以包括如下步骤:As shown in Figure 2, the following steps may be included:

步骤S201,在终端屏幕刷新过程中,获取应用刷新帧的第一耗时时长和系统刷新帧的第二耗时时长。Step S201 , during the screen refreshing process of the terminal, acquire the first time-consuming duration of the application refresh frame and the second time-consuming duration of the system refresh frame.

通过在系统中Surface、Egl和系统刷新SurfaceFlinger进行插桩获取经过对应流程节点的时间,能够获取初始的应用刷新和系统刷新各阶段耗时以及刷新周期,从而在终端屏幕每刷新一次时,就可以获取到一帧的应用刷新帧的第一耗时时长和一帧的系统刷新帧的第二耗时时长。By inserting Surface, Egl and system refresh SurfaceFlinger in the system to obtain the time of passing through the corresponding process nodes, you can obtain the time-consuming and refresh cycle of each stage of the initial application refresh and system refresh, so that every time the terminal screen is refreshed, you can The first time-consuming period of one frame of application refresh frame and the second time-consuming period of one frame of system refresh frame are obtained.

步骤S202,基于应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合和应用帧集合。Step S202, based on the first time-consuming period of the application refresh frame, after it is determined that the application refresh freeze occurs and meets the set conditions, determine the system frame set and the application frame set.

基于应用刷新帧的第一耗时时长,可以进行卡顿识别。设定记录的应用刷新帧数量不超过N,单个应用刷新帧的第一耗时时长记为Tn,单个应用刷新帧的平均耗时时长为Tavg,当出现Tn超过2倍Tavg的应用刷新帧时,可以认为出现应用刷新卡顿,当出现Tn超过3倍Tavg的应用刷新帧时,可以认为出现严重卡顿,终止记录循环。Stall recognition can be performed based on the first time-consuming period of application refresh frames. Set the number of recorded application refresh frames to not exceed N. The first time-consuming duration of a single application refresh frame is recorded as Tn, and the average time-consuming duration of a single application refresh frame is Tavg. When an application refresh frame with Tn exceeding 2 times Tavg occurs , it can be considered that there is an application refresh freeze, and when there is an application refresh frame with Tn exceeding 3 times Tavg, it can be considered that there is a serious freeze, and the recording cycle is terminated.

具体地,基于应用刷新帧的第一耗时时长,进行卡顿识别的过程可以如图3所示,包括以下步骤:Specifically, based on the first time-consuming period of the application refresh frame, the process of stall identification may be shown in Figure 3, including the following steps:

步骤S301,循环记录单个应用刷新帧的数据。Step S301, cyclically record the data of a single application refresh frame.

步骤S302,设定记录的应用刷新帧数量不超过N,并确定单个应用刷新帧的平均耗时时长Tavg。Step S302, setting the number of recorded application refresh frames to not exceed N, and determining the average duration Tavg of a single application refresh frame.

步骤S303,基于应用刷新帧的第一耗时时长,若确定当前应用刷新帧的第一耗时时长超过2倍Tavg,则记录当前应用刷新帧出现卡顿。Step S303, based on the first time-consuming period of the application refresh frame, if it is determined that the first time-consuming period of the current application refresh frame exceeds 2 times Tavg, record that the current application refresh frame is stuck.

步骤S304,基于应用刷新帧的第一耗时时长,若确定当前应用刷新帧的第一耗时时长超过3倍Tavg,则记录当前应用刷新帧出现严重卡顿。Step S304, based on the first time-consuming period of the application refresh frame, if it is determined that the first time-consuming period of the current application refresh frame exceeds 3 times Tavg, record that the current application refresh frame is seriously stuck.

步骤S305,若当前应用刷新帧出现严重卡顿,或当前记录的应用刷新帧数量超过N,则跳出循环。Step S305, if the current application refresh frame is seriously stuck, or the number of currently recorded application refresh frames exceeds N, jump out of the loop.

例如,假设每次循环记录应用刷新帧数据的设定记录帧数量不超过10,单个应用刷新帧的平均耗时时长Tavg为16ms,从终端屏幕处于亮屏后的第一个应用刷新帧开始记录,且每个应用刷新帧的第一耗时时长可以如表1所示:For example, assuming that the set number of recorded frames for each cycle of recording application refresh frame data does not exceed 10, the average time-consuming time Tavg of a single application refresh frame is 16ms, and the recording starts from the first application refresh frame after the terminal screen is turned on , and the first time-consuming duration of each application refresh frame can be shown in Table 1:

表1Table 1

frame112233445566778899101011111212131314141515耗时(ms)Time-consuming (ms)161616163535161652521616161616163636161635351616161616161616

由表1可知,第3个应用刷新帧出现卡顿,第5个应用刷新帧出现严重卡顿,第9个应用刷新帧和第11个应用刷新帧出现卡顿,其余的应用刷新帧均为正常帧,且从第一个应用刷新帧开始,在第5个应用刷新帧时跳出了循环,即第一次循环记录了5帧的应用刷新帧数据。下一次循环从第6个应用刷新帧开始,到第15个应用刷新帧刚好满足10帧,则在第15个应用刷新帧时跳出了第二次循环,即第二次循环记录了10帧的应用刷新帧数据。It can be seen from Table 1 that the third application refresh frame is stuck, the fifth application refresh frame is severely stuck, the ninth application refresh frame and the eleventh application refresh frame are stuck, and the rest of the application refresh frames are Normal frame, starting from the first application refresh frame, jumping out of the loop at the fifth application refresh frame, that is, the first cycle records 5 frames of application refresh frame data. The next cycle starts from the 6th application refresh frame, and when the 15th application refresh frame just satisfies 10 frames, then the second cycle jumps out at the 15th application refresh frame, that is, the second cycle records 10 frames Application refresh frame data.

基于应用刷新帧的第一耗时时长,在确定应用刷新帧出现卡顿,且应用刷新帧出现严重卡顿或终端屏幕的刷新达到设定次数时,可以确定出系统帧集合和应用帧集合。其中,系统帧集合中初始系统刷新帧和最近刷新使用的系统刷新帧以及初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧,初始系统刷新帧为终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合应用刷新帧出现严重卡顿或终端屏幕的刷新达到设定次数条件对应的系统刷新帧的下一个系统刷新帧。应用帧集合中包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;初始应用刷新帧为终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合应用刷新帧出现严重卡顿或终端屏幕的刷新达到设定次数条件对应的应用刷新帧的下一个应用刷新帧。Based on the first time-consuming period of the application refresh frame, the system frame set and the application frame set can be determined when it is determined that the application refresh frame is stuck, and the application refresh frame is severely stuck or the refresh of the terminal screen reaches a set number of times. Among them, the initial system refresh frame and the system refresh frame used for the latest refresh in the system frame set and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh, the initial system refresh frame is the terminal screen after the screen is on The first system refresh frame or the next system refresh frame corresponding to the system refresh frame corresponding to the last system refresh frame that meets the application refresh frame serious freeze or the refresh of the terminal screen reaches the set number of times. The application frame set includes the initial application refresh frame and the application refresh frame used for the latest refresh, and the application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial application refresh frame is the frame after the terminal screen is turned on The first application refresh frame or the next application refresh frame corresponding to the application refresh frame corresponding to the application refresh frame of the previous application refresh frame or the refresh of the terminal screen reaching the set number of times.

在一种实施例中,每次循环记录的应用刷新帧数量不超过N,在基于应用刷新帧的第一耗时时长进行卡顿识别时,若没有出现存在卡顿和严重卡顿的应用刷新帧,则在记录的应用刷新帧达到N个时,对该N个应用刷新帧不进行处理,继续进入下一次循环,即对下一次循环中的N个应用刷新帧进行数据录。In one embodiment, the number of application refresh frames recorded in each cycle does not exceed N, and when the stall identification is performed based on the first time-consuming period of the application refresh frame, if there is no application refresh with stall or severe stall frame, when the number of recorded application refresh frames reaches N, the N application refresh frames are not processed, and the next cycle is continued, that is, the data is recorded for the N application refresh frames in the next cycle.

步骤S203,基于系统帧集合中各系统刷新帧的第二耗时时长,确定系统帧集合的整体耗时时长。Step S203, based on the second time-consuming duration of each system refresh frame in the system frame set, determine the overall time-consuming duration of the system frame set.

步骤S204,若整体耗时时长超过第一设定时长,则对GPU频率进行调整。Step S204, if the overall time-consuming time exceeds the first set time, adjust the GPU frequency.

步骤S205,若整体耗时时长不超过第一设定时长,则基于应用帧集合中各所述应用刷新帧的第一耗时时长,确定应用帧集合的整体耗时时长,并将整体耗时时长作为一个抽样时长。Step S205, if the overall time-consuming duration does not exceed the first set duration, based on the first time-consuming duration of each application refresh frame in the application frame set, determine the overall time-consuming duration of the application frame set, and set the overall time-consuming Duration as a sampling duration.

步骤S206,获取抽样时长内系统的各个CPU状态的累加记录时间,并根据累加记录时间和抽样时长,确定系统负载。In step S206, the accumulated recording time of each CPU state of the system within the sampling period is obtained, and the system load is determined according to the accumulated recording time and the sampling period.

步骤S207,若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对CPU频率进行调整。Step S207, if the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, adjust the CPU frequency.

步骤S208,若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,则获取抽样时长内应用渲染线程的运行时间和各个应用刷新帧在应用渲染线程上的整体处理时间,并根据运行时间和整体处理时间,确定应用渲染线程负载。Step S208, if the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, obtain the running time of the application rendering thread and the overall processing time of each application refresh frame on the application rendering thread within the sampling period, and Determines the app's rendering thread load based on elapsed time and overall processing time.

步骤S209,若应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整。Step S209, if the load of the application rendering thread exceeds the second set threshold, then adjust the scheduling priority of the application rendering thread.

步骤S210,若应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。Step S210, if the load of the application rendering thread is lower than the second set threshold, adjust the running core of the application rendering thread.

具体地,当前的系统整体负载值等于系统的各个CPU状态的记录时间累加除以抽样时长。当系统整体负载高的时候,可能是因为任务过重,也有可能是CPU频率过低。Specifically, the current overall system load value is equal to the cumulative recording time of each CPU state of the system divided by the sampling duration. When the overall load of the system is high, it may be because the task is too heavy, or the CPU frequency may be too low.

应用渲染线程负载,即当前的应用渲染线程能够有效运行在CPU的比例等于渲染线程运行时间,即在CPU上处于Running态的时间,除以帧在渲染线程处理时间。Application rendering thread load, that is, the ratio of the current application rendering thread that can effectively run on the CPU is equal to the rendering thread running time, that is, the time that the CPU is in the Running state, divided by the frame processing time in the rendering thread.

系统引起的卡顿主要来源为系统刷新周期不稳定,或者APP调度存在异常。The main source of the freeze caused by the system is that the system refresh cycle is unstable, or the APP scheduling is abnormal.

系统刷新周期不稳定,主要表现于系统帧形成时间超出硬件刷新周期。此时,优先调整GPU,加快帧合成速度。The system refresh cycle is unstable, mainly when the system frame formation time exceeds the hardware refresh cycle. At this point, give priority to adjusting the GPU to speed up frame synthesis.

APP调度异常,严重卡顿发生时,可以获取APP在CPU运行时间,系统负载占用率比较高,则优先调整CPU运行频率,提升CPU处理速度。如果抽样时长与帧耗时差异不大,即渲染线程CPU负载较低,APP能够及时获取系统资源,调度CPU渲染线程到大核心。如果抽样时长与帧耗时明显差异,即APP因资源竞争并不能一直持续在CPU运行,长时间处于Running状态,此时,调度APP的对应渲染线程优先级,使其能够获取充足的CPU运行时间。When the APP scheduling is abnormal and serious freezes occur, you can obtain the APP running time on the CPU. If the system load occupancy rate is relatively high, the CPU operating frequency will be adjusted first to increase the CPU processing speed. If there is not much difference between the sampling time and the frame time, that is, the CPU load of the rendering thread is low, the APP can obtain system resources in time and schedule the CPU rendering thread to the big core. If the sampling time is significantly different from the frame time consumption, that is, the APP cannot continue to run on the CPU due to resource competition and is in the Running state for a long time, at this time, schedule the priority of the corresponding rendering thread of the APP so that it can obtain sufficient CPU running time .

本申请实施例中的卡顿处理方法,通过在系统层预埋节点统计刷新时各阶段的耗时,得到应用刷新帧的第一耗时时长和系统刷新帧的第二耗时时长,并基于应用刷新帧的第一耗时时长和系统刷新帧的第二耗时时长,更加准确地识别出卡顿原因,以通过及时调度对应的系统资源进行处理,可快速解决和修复系统资源造成的卡顿问题,避免连续卡顿造成的无响应问题。In the freeze processing method in the embodiment of the present application, the first time-consuming period of the application refresh frame and the second time-consuming period of the system refresh frame are obtained by pre-buried nodes at the system layer to count the time-consuming of each stage of refresh, and based on The first time-consuming period of the application refresh frame and the second time-consuming period of the system refresh frame can more accurately identify the cause of the freeze, so that the corresponding system resources can be timely dispatched for processing, and the card caused by the system resource can be quickly resolved and repaired To avoid unresponsive problems caused by continuous freezes.

与图1所示的卡顿处理方法基于同一发明构思,本申请实施例中还提供了一种卡顿处理装置。由于该装置是本申请卡顿处理方法对应的装置,并且该装置解决问题的原理与该方法相似,因此该装置的实施可以参见上述方法的实施,重复之处不再赘述。Based on the same inventive concept as the stuck processing method shown in FIG. 1 , an embodiment of the present application also provides a stuck processing device. Since this device is the device corresponding to the stuck processing method of the present application, and the problem-solving principle of the device is similar to that of the method, the implementation of the device can refer to the implementation of the above method, and the repetition will not be repeated.

图4示出了本申请实施例提供的一种卡顿处理装置的结构示意图,如图4所示,该卡顿处理装置包括刷新帧确定单元401,帧集合确定单元402,整体耗时确定单元403和卡顿处理单元404。Fig. 4 shows a schematic structural diagram of a stutter processing device provided by an embodiment of the present application. As shown in Fig. 4, the stutter processing device includes a refreshframe determination unit 401, a frame setdetermination unit 402, and an overall time-consumingdetermination unit 403 and thefreeze processing unit 404.

其中,刷新帧确定单元401,用于终端屏幕每刷新一次,确定最近刷新使用的应用刷新帧;Wherein, the refreshframe determination unit 401 is used to determine the application refresh frame used for the latest refresh every time the terminal screen is refreshed;

帧集合确定单元402,用于基于应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合,其中系统帧集合包括初始系统刷新帧和最近刷新使用的系统刷新帧,以及初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧;初始系统刷新帧为终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合设定条件对应的系统刷新帧的下一个系统刷新帧;第一耗时时长为应用基于对应的应用刷新帧组织终端屏幕的刷新帧数据的耗时时长;设定条件为应用刷新卡顿符合严重卡顿条件,或终端屏幕的刷新达到设定次数;The frameset determining unit 402 is configured to determine the system frame set after determining that the application refresh freeze occurs and meets the set conditions based on the first time-consuming period of the application refresh frame, wherein the system frame set includes the initial system refresh frame and the latest frame set The system refresh frame used for refreshing, and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh; the initial system refresh frame is the first system refresh frame after the terminal screen is on or the last time it meets the setting The next system refresh frame of the system refresh frame corresponding to the specified condition; the first time-consuming period is the time-consuming period for the application to organize the refresh frame data of the terminal screen based on the corresponding application refresh frame; the set condition is that the application refresh lag meets the serious card frame condition, or the refresh of the terminal screen reaches the set number of times;

整体耗时确定单元403,基于系统帧集合中各系统刷新帧的第二耗时时长,确定系统帧集合的整体耗时时长;第二耗时时长为系统基于对应的系统刷新帧合成终端屏幕的刷新帧数据的耗时时长;The overall time-consumingdetermination unit 403, based on the second time-consuming duration of each system refresh frame in the system frame set, determines the overall time-consuming duration of the system frame set; the second time-consuming duration is the time for the system to synthesize the terminal screen based on the corresponding system refresh frame The time-consuming time to refresh the frame data;

卡顿处理单元404,用于若整体耗时时长超过第一设定时长,则对GPU频率进行调整;其中,第一设定时长为系统刷新帧的正常耗时时长;若整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整。Stuck processing unit 404, configured to adjust the frequency of the GPU if the overall time-consuming duration exceeds the first set duration; wherein, the first set duration is the normal time-consuming duration of the system refresh frame; if the overall time-consuming duration is not If the first set duration is exceeded, the CPU frequency and/or the application rendering thread are adjusted based on the system load and the application rendering thread load.

在一种可选的实施例中,帧集合确定单元402,还用于:In an optional embodiment, the frame set determiningunit 402 is also configured to:

若确定存在第一耗时时长超过第二设定时长的应用刷新帧,则确定出现应用刷新卡顿;第二设定时长为应用刷新帧的平均耗时时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds the second set duration, it is determined that an application refresh freeze occurs; the second set duration is an average time-consuming period of the application refresh frame.

在一种可选的实施例中,帧集合确定单元402,还用于:In an optional embodiment, the frame set determiningunit 402 is also configured to:

若确定存在第一耗时时长超过第三设定时长的应用刷新帧,则确定应用刷新帧符合严重卡顿条件;第三设定时长大于第二设定时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds the third set duration, then it is determined that the application refresh frame meets a severe freeze condition; the third set duration is longer than the second set duration.

在一种可选的实施例中,如图5所示,上述装置还可以包括负载确定单元501,用于:In an optional embodiment, as shown in FIG. 5, the above device may further include aload determining unit 501, configured to:

确定应用帧集合,其中应用帧集合包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;初始应用刷新帧为终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合设定条件对应的应用刷新帧的下一个应用刷新帧;Determine the application frame set, where the application frame set includes the initial application refresh frame and the application refresh frame used for the latest refresh, and the application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial application refresh frame is the terminal screen The first application refresh frame after the screen is turned on or the next application refresh frame corresponding to the application refresh frame that meets the set conditions last time;

基于应用帧集合中各应用刷新帧的第一耗时时长,确定应用帧集合的整体耗时时长,并将整体耗时时长作为一个抽样时长;Based on the first time-consuming period of each application refresh frame in the application frame set, determine the overall time-consuming period of the application frame set, and use the overall time-consuming period as a sampling period;

获取抽样时长内系统的各个CPU状态的累加记录时间,并根据累加记录时间和抽样时长,确定系统负载;Obtain the accumulated recording time of each CPU state of the system within the sampling period, and determine the system load according to the accumulated recording time and sampling period;

获取抽样时长内应用渲染线程的运行时间和各个应用刷新帧在应用渲染线程上的整体处理时间,并根据运行时间和整体处理时间,确定应用渲染线程负载。Obtain the running time of the application rendering thread and the overall processing time of each application refresh frame on the application rendering thread within the sampling period, and determine the load of the application rendering thread according to the running time and the overall processing time.

在一种可选的实施例中,卡顿处理单元404,具体用于:In an optional embodiment, thefreeze processing unit 404 is specifically used for:

若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对CPU频率进行调整;If the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, then adjust the CPU frequency;

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整;If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread load exceeds the second set threshold, then adjust the scheduling priority of the application rendering thread;

若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the load of the application rendering thread is lower than the second set threshold, the running core of the application rendering thread is adjusted.

与上述方法实施例基于同一发明构思,本申请实施例中还提供了一种电子设备。该电子设备可以用于进行卡顿处理。在一种实施例中,该电子设备可以是服务器,也可以是终端设备或其他电子设备。在该实施例中,电子设备的结构可以如图6所示,包括存储器601,通讯模块603以及一个或多个处理器602。Based on the same inventive concept as the foregoing method embodiments, an electronic device is also provided in the embodiments of the present application. The electronic device can be used for carton processing. In an embodiment, the electronic device may be a server, or a terminal device or other electronic devices. In this embodiment, the structure of the electronic device may be as shown in FIG. 6 , including amemory 601 , acommunication module 603 and one ormore processors 602 .

存储器601,用于存储处理器602执行的计算机程序。存储器601可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统,以及运行即时通讯功能所需的程序等;存储数据区可存储各种即时通讯信息和操作指令集等。Thememory 601 is used for storing computer programs executed by theprocessor 602 . Thememory 601 can mainly include a program storage area and a data storage area, wherein the program storage area can store the operating system and the programs needed to run the instant messaging function, etc.; the storage data area can store various instant messaging information and operation instruction sets, etc.

存储器601可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器601也可以是非易失性存储器(non-volatilememory),例如只读存储器,快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)、或者存储器601是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器601可以是上述存储器的组合。Thememory 601 can be a volatile memory (volatile memory), such as a random-access memory (random-access memory, RAM); thememory 601 can also be a non-volatile memory (non-volatile memory), such as a read-only memory, a flash memory (flash memory), hard disk (hard disk drive, HDD) or solid-state drive (solid-state drive, SSD), ormemory 601 can be used to carry or store the desired program code with instruction or data structure form and can be used by computer Any other medium accessed, but not limited to. Thememory 601 may be a combination of the above-mentioned memories.

处理器602,可以包括一个或多个中央处理单元(central processing unit,CPU)或者为数字处理单元等等。处理器602,用于调用存储器601中存储的计算机程序时实现上述卡顿处理方法。Theprocessor 602 may include one or more central processing units (central processing unit, CPU) or be a digital processing unit or the like. Theprocessor 602 is configured to implement the above-mentioned stuck processing method when calling the computer program stored in thememory 601 .

通讯模块603用于与终端设备和其他服务器进行通信。Thecommunication module 603 is used for communicating with terminal devices and other servers.

本申请实施例中不限定上述存储器601、通讯模块603和处理器602之间的具体连接介质。本公开实施例在图6中以存储器601和处理器602之间通过总线604连接,总线604在图6中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。总线604可以分为地址总线、数据总线、控制总线等。为便于表示,图6中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The embodiment of the present application does not limit the specific connection medium among thememory 601 , thecommunication module 603 and theprocessor 602 . In the embodiment of the present disclosure, in FIG. 6, thememory 601 and theprocessor 602 are connected through a bus 604. The bus 604 is represented by a thick line in FIG. As far as possible. The bus 604 can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 6 , but it does not mean that there is only one bus or one type of bus.

根据本申请的一个方面,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述实施例中的卡顿处理方法。According to an aspect of the present application there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the freezing processing method in the above embodiment.

程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。A program product may take the form of any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: electrical connection with one or more conductors, portable disk, hard disk, random access memory (RAM), read only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application.

Claims (9)

Translated fromChinese
1.一种卡顿处理方法,其特征在于,包括:1. A stuck processing method, characterized in that, comprising:终端屏幕每刷新一次,确定最近刷新使用的应用刷新帧;Each time the terminal screen is refreshed, determine the application refresh frame used for the latest refresh;基于所述应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合,其中所述系统帧集合包括初始系统刷新帧和最近刷新使用的系统刷新帧,以及所述初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧;所述初始系统刷新帧为所述终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合设定条件对应的系统刷新帧的下一个系统刷新帧;所述第一耗时时长为应用基于对应的所述应用刷新帧组织所述终端屏幕的刷新帧数据的耗时时长;所述设定条件为所述应用刷新卡顿符合严重卡顿条件,或所述终端屏幕的刷新达到设定次数;Based on the first time-consuming period of the application refresh frame, after it is determined that the application refresh freeze occurs and meets the set conditions, a system frame set is determined, wherein the system frame set includes the initial system refresh frame and the system used for the latest refresh Refresh frame, and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh; the initial system refresh frame is the first system refresh frame after the terminal screen is on or the last time The next system refresh frame that meets the system refresh frame corresponding to the set condition; the first time-consuming duration is the time-consuming duration for the application to organize the refresh frame data of the terminal screen based on the corresponding application refresh frame; the setting The predetermined condition is that the refresh of the application meets the severe freeze condition, or the refreshing of the terminal screen reaches a set number of times;基于所述系统帧集合中各所述系统刷新帧的第二耗时时长,确定所述系统帧集合的整体耗时时长;所述第二耗时时长为系统基于对应的所述系统刷新帧合成所述终端屏幕的刷新帧数据的耗时时长;Based on the second time-consuming duration of each of the system refresh frames in the system frame set, determine the overall time-consuming duration of the system frame set; the second time-consuming duration is synthesized by the system based on the corresponding system refresh frame The time-consuming time for refreshing the frame data of the terminal screen;若所述整体耗时时长超过第一设定时长,则对GPU频率进行调整;其中,所述第一设定时长为所述系统刷新帧的正常耗时时长;若所述整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整;If the overall time-consuming duration exceeds the first set duration, the GPU frequency is adjusted; wherein, the first set duration is the normal time-consuming duration of the system refresh frame; if the overall time-consuming duration is not If the first set duration is exceeded, the CPU frequency and/or the application rendering thread are adjusted based on the system load and the application rendering thread load;其中,所述在确定出现应用刷新卡顿,且符合设定条件后,所述方法还包括:Wherein, after it is determined that the application refresh is stuck and meets the set conditions, the method further includes:确定应用帧集合,其中所述应用帧集合包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及所述初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;所述初始应用刷新帧为所述终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合设定条件对应的应用刷新帧的下一个应用刷新帧;Determine an application frame set, wherein the application frame set includes an initial application refresh frame and an application refresh frame used for the latest refresh, and an application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial The application refresh frame is the first application refresh frame after the terminal screen is turned on or the next application refresh frame corresponding to the application refresh frame that meets the set conditions last time;基于所述应用帧集合中各所述应用刷新帧的第一耗时时长,确定所述应用帧集合的整体耗时时长,并将所述整体耗时时长作为一个抽样时长;Based on the first time-consuming duration of each of the application refresh frames in the application frame set, determine the overall time-consuming duration of the application frame set, and use the overall time-consuming duration as a sampling duration;获取所述抽样时长内系统的各个CPU状态的累加记录时间,并根据所述累加记录时间和所述抽样时长,确定系统负载;Obtain the cumulative recording time of each CPU state of the system within the sampling duration, and determine the system load according to the cumulative recording time and the sampling duration;获取所述抽样时长内应用渲染线程的运行时间和所述各个应用刷新帧在所述应用渲染线程上的整体处理时间,并根据所述运行时间和所述整体处理时间,确定所述应用渲染线程负载。Obtain the running time of the application rendering thread within the sampling duration and the overall processing time of the respective application refresh frames on the application rendering thread, and determine the application rendering thread according to the running time and the overall processing time load.2.如权利要求1所述的方法,其特征在于,所述应用刷新卡顿通过以下方式确定:2. The method according to claim 1, wherein the application refresh freeze is determined by the following method:若确定存在所述第一耗时时长超过第二设定时长的应用刷新帧,则确定出现应用刷新卡顿;所述第二设定时长为所述应用刷新帧的平均耗时时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a second set duration, it is determined that an application refresh freeze occurs; the second set duration is an average time-consuming duration of the application refresh frame.3.如权利要求2所述的方法,其特征在于,所述严重卡顿条件通过以下方式确定:3. The method according to claim 2, wherein the severe freezing condition is determined in the following manner:若确定存在所述第一耗时时长超过第三设定时长的应用刷新帧,则确定所述应用刷新帧符合严重卡顿条件;所述第三设定时长大于所述第二设定时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a third set duration, it is determined that the application refresh frame meets a severe freeze condition; the third set duration is longer than the second set duration.4.如权利要求1所述的方法,其特征在于,所述基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整,包括:4. The method according to claim 1, wherein the adjusting the CPU frequency and/or the application rendering thread based on the system load and the application rendering thread load comprises:若系统负载超过第一设定阈值,且CPU频率低于设定频率阈值,则对所述CPU频率进行调整;If the system load exceeds the first set threshold and the CPU frequency is lower than the set frequency threshold, then adjust the CPU frequency;若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载超过第二设定阈值,则对应用渲染线程的调度优先级进行调整;If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the application rendering thread load exceeds the second set threshold, then adjust the scheduling priority of the application rendering thread;若系统负载低于第一设定阈值,或CPU频率超过设定频率阈值,且应用渲染线程负载低于第二设定阈值,则对应用渲染线程的运行核心进行调整。If the system load is lower than the first set threshold, or the CPU frequency exceeds the set frequency threshold, and the load of the application rendering thread is lower than the second set threshold, the running core of the application rendering thread is adjusted.5.一种卡顿处理装置,其特征在于,包括:5. A stuck processing device, characterized in that, comprising:刷新帧确定单元,用于终端屏幕每刷新一次,确定最近刷新使用的应用刷新帧;The refresh frame determination unit is used to determine the application refresh frame used for the latest refresh every time the terminal screen is refreshed;帧集合确定单元,用于基于所述应用刷新帧的第一耗时时长,在确定出现应用刷新卡顿,且符合设定条件后,确定系统帧集合,其中所述系统帧集合包括初始系统刷新帧和最近刷新使用的系统刷新帧,以及所述初始系统刷新帧和最近刷新使用的系统刷新帧之间的系统刷新帧;所述初始系统刷新帧为所述终端屏幕处于亮屏后的第一个系统刷新帧或上一次符合设定条件对应的系统刷新帧的下一个系统刷新帧;所述第一耗时时长为应用基于对应的所述应用刷新帧组织所述终端屏幕的刷新帧数据的耗时时长;所述设定条件为所述应用刷新卡顿符合严重卡顿条件,或所述终端屏幕的刷新达到设定次数;A frame set determination unit, configured to determine a system frame set after determining that the application refresh freezes and meets the set conditions based on the first time-consuming period of the application refresh frame, wherein the system frame set includes the initial system refresh frame and the system refresh frame used for the latest refresh, and the system refresh frame between the initial system refresh frame and the system refresh frame used for the latest refresh; the initial system refresh frame is the first frame after the terminal screen is on A system refresh frame or the next system refresh frame of the system refresh frame corresponding to the set condition last time; the first time-consuming period is the time for the application to organize the refresh frame data of the terminal screen based on the corresponding application refresh frame It takes a long time; the set condition is that the refresh of the application meets the severe freeze condition, or the refreshing of the terminal screen reaches the set number of times;整体耗时确定单元,基于所述系统帧集合中各所述系统刷新帧的第二耗时时长,确定所述系统帧集合的整体耗时时长;所述第二耗时时长为系统基于对应的所述系统刷新帧合成所述终端屏幕的刷新帧数据的耗时时长;The overall time-consuming determination unit determines the overall time-consuming duration of the system frame set based on the second time-consuming duration of each system refresh frame in the system frame set; the second time-consuming duration is the system based on the corresponding The time-consuming time for the system refresh frame to synthesize the refresh frame data of the terminal screen;卡顿处理单元,用于若所述整体耗时时长超过第一设定时长,则对GPU频率进行调整;其中,所述第一设定时长为所述系统刷新帧的正常耗时时长;若所述整体耗时时长不超过第一设定时长,则基于系统负载和应用渲染线程负载,对CPU频率和/或应用渲染线程进行调整;A stuck processing unit, configured to adjust the frequency of the GPU if the overall time-consuming time exceeds a first set time; wherein, the first set time is the normal time-consuming time for the system to refresh frames; if If the overall time-consuming duration does not exceed the first set duration, the CPU frequency and/or the application rendering thread are adjusted based on the system load and the application rendering thread load;其中,所述装置还包括负载确定单元,用于:Wherein, the device also includes a load determination unit for:确定应用帧集合,其中所述应用帧集合包括初始应用刷新帧和最近刷新使用的应用刷新帧,以及所述初始应用刷新帧和最近刷新使用的应用刷新帧之间的应用刷新帧;所述初始应用刷新帧为所述终端屏幕处于亮屏后的第一个应用刷新帧或上一次符合设定条件对应的应用刷新帧的下一个应用刷新帧;Determine an application frame set, wherein the application frame set includes an initial application refresh frame and an application refresh frame used for the latest refresh, and an application refresh frame between the initial application refresh frame and the application refresh frame used for the latest refresh; the initial The application refresh frame is the first application refresh frame after the terminal screen is turned on or the next application refresh frame corresponding to the application refresh frame that meets the set conditions last time;基于所述应用帧集合中各所述应用刷新帧的第一耗时时长,确定所述应用帧集合的整体耗时时长,并将所述整体耗时时长作为一个抽样时长;Based on the first time-consuming duration of each of the application refresh frames in the application frame set, determine the overall time-consuming duration of the application frame set, and use the overall time-consuming duration as a sampling duration;获取所述抽样时长内系统的各个CPU状态的累加记录时间,并根据所述累加记录时间和所述抽样时长,确定系统负载;Obtain the cumulative recording time of each CPU state of the system within the sampling duration, and determine the system load according to the cumulative recording time and the sampling duration;获取所述抽样时长内应用渲染线程的运行时间和所述各个应用刷新帧在所述应用渲染线程上的整体处理时间,并根据所述运行时间和所述整体处理时间,确定所述应用渲染线程负载。Obtain the running time of the application rendering thread within the sampling duration and the overall processing time of the respective application refresh frames on the application rendering thread, and determine the application rendering thread according to the running time and the overall processing time load.6.如权利要求5所述的装置,其特征在于,所述帧集合确定单元,还用于:6. The device according to claim 5, wherein the frame set determining unit is further configured to:若确定存在所述第一耗时时长超过第二设定时长的应用刷新帧,则确定出现应用刷新卡顿;所述第二设定时长为所述应用刷新帧的平均耗时时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a second set duration, it is determined that an application refresh freeze occurs; the second set duration is an average time-consuming duration of the application refresh frame.7.如权利要求6所述的装置,其特征在于,所述帧集合确定单元,还用于:7. The device according to claim 6, wherein the frame set determining unit is further configured to:若确定存在所述第一耗时时长超过第三设定时长的应用刷新帧,则确定所述应用刷新帧符合严重卡顿条件;所述第三设定时长大于所述第二设定时长。If it is determined that there is an application refresh frame whose first time-consuming duration exceeds a third set duration, it is determined that the application refresh frame meets a severe freeze condition; the third set duration is longer than the second set duration.8.一种电子设备,其特征在于,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,实现权利要求1~4中任一项所述的方法。8. An electronic device, characterized in that it includes a memory and a processor, the memory stores a computer program that can run on the processor, and when the computer program is executed by the processor, the rights The method described in any one of 1 to 4 is required.9.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序,其特征在于:所述计算机程序被处理器执行时,实现权利要求1~4中任一项所述的方法。9. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, wherein when the computer program is executed by a processor, any one of claims 1 to 4 is realized. method described in the item.
CN202210091573.4A2022-01-262022-01-26Clamping and processing method and device, electronic equipment and storage mediumExpired - Fee RelatedCN114461323B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210091573.4ACN114461323B (en)2022-01-262022-01-26Clamping and processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210091573.4ACN114461323B (en)2022-01-262022-01-26Clamping and processing method and device, electronic equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN114461323A CN114461323A (en)2022-05-10
CN114461323Btrue CN114461323B (en)2023-04-28

Family

ID=81412130

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210091573.4AExpired - Fee RelatedCN114461323B (en)2022-01-262022-01-26Clamping and processing method and device, electronic equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN114461323B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN116048772B (en)*2022-08-262023-10-31荣耀终端有限公司 Central processing unit frequency adjustment method, device and terminal equipment
CN118331524B (en)*2024-03-182025-03-21荣耀终端股份有限公司 Screen refresh rate setting method and electronic device
CN119045939B (en)*2024-10-302025-04-25威海市奥讯软件有限公司Visual platform system for financial data scheduling

Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JPH08107699A (en)*1994-10-051996-04-23Mitsubishi Electric Corp Variable speed device
CN108536367A (en)*2018-03-282018-09-14努比亚技术有限公司A kind of processing method, terminal and the readable storage medium storing program for executing of interaction page interim card
CN109840177A (en)*2017-11-242019-06-04腾讯科技(深圳)有限公司A kind of processing method and relevant device of Caton
CN111338934A (en)*2020-02-132020-06-26北京字节跳动网络技术有限公司Page refreshing test method and device, computer equipment and storage medium
CN111480336A (en)*2018-03-262020-07-31华为技术有限公司 A frame rate adjustment method and terminal
CN112114975A (en)*2020-10-282020-12-22Oppo广东移动通信有限公司Processor frequency adjusting method and device, storage medium and electronic equipment
CN113835950A (en)*2021-08-202021-12-24杭州逗酷软件科技有限公司 Interface display stuck identification method, device, storage medium and electronic device
CN113835871A (en)*2020-06-242021-12-24阿里巴巴集团控股有限公司Thread management method, thread management device, computer storage medium and application software

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JPH08107699A (en)*1994-10-051996-04-23Mitsubishi Electric Corp Variable speed device
CN109840177A (en)*2017-11-242019-06-04腾讯科技(深圳)有限公司A kind of processing method and relevant device of Caton
CN111480336A (en)*2018-03-262020-07-31华为技术有限公司 A frame rate adjustment method and terminal
CN108536367A (en)*2018-03-282018-09-14努比亚技术有限公司A kind of processing method, terminal and the readable storage medium storing program for executing of interaction page interim card
CN111338934A (en)*2020-02-132020-06-26北京字节跳动网络技术有限公司Page refreshing test method and device, computer equipment and storage medium
CN113835871A (en)*2020-06-242021-12-24阿里巴巴集团控股有限公司Thread management method, thread management device, computer storage medium and application software
CN112114975A (en)*2020-10-282020-12-22Oppo广东移动通信有限公司Processor frequency adjusting method and device, storage medium and electronic equipment
CN113835950A (en)*2021-08-202021-12-24杭州逗酷软件科技有限公司 Interface display stuck identification method, device, storage medium and electronic device

Also Published As

Publication numberPublication date
CN114461323A (en)2022-05-10

Similar Documents

PublicationPublication DateTitle
CN114461323B (en)Clamping and processing method and device, electronic equipment and storage medium
CN107491346B (en)Application task processing method, device and system
CN105335099A (en)Memory cleaning method and terminal
CN109698979B (en)Video playing method and device and electronic equipment
CN114168490B (en) Method and related device for determining memory reclamation threshold
US9239742B2 (en)Embedded systems and methods for threads and buffer management thereof
JPWO2005017736A1 (en) System and program for detecting bottleneck in disk array device
CN111124270A (en)Method, apparatus and computer program product for cache management
CN111625456A (en)Stuck positioning method and device
CN112650575A (en)Resource scheduling method and device and cloud service system
WO2016183918A1 (en)Method and device for processing storage space
US9135064B2 (en)Fine grained adaptive throttling of background processes
WO2025020508A1 (en)Memory leak detection method and apparatus, electronic device and readable storage medium
WO2018026452A1 (en)System and method for distributing and replaying trigger packets via a variable latency bus interconnect
CN116244471A (en)Player instance management method and device, electronic equipment and storage medium
US20120254545A1 (en)Systems and methods for background destaging storage tracks
WO2020118601A1 (en)Method, apparatus, electronic device, and storage medium for video encoding
CN106125889B (en)Awakening source processing method and device
CN106095055B (en)Application program closing method and device
CN113467721B (en) A data deletion system, method and device
CN106202262B (en)Information processing method and electronic equipment
US20200081741A1 (en)Information processing apparatus and memory management method
CN111522598A (en)Method and device for recording restart information of embedded equipment
CN111078418A (en)Operation synchronization method and device, electronic equipment and computer readable storage medium
CN110555009A (en)processing method and device for Network File System (NFS) service

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20230428

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp