CN115686994A - Application program pause monitoring method and device, computer equipment and storage medium - Google Patents

Application program pause monitoring method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115686994A
CN115686994A CN202110872892.4A CN202110872892A CN115686994A CN 115686994 A CN115686994 A CN 115686994A CN 202110872892 A CN202110872892 A CN 202110872892A CN 115686994 A CN115686994 A CN 115686994A
Authority
CN
China
Prior art keywords
application program
time
target function
function
consuming
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110872892.4A
Other languages
Chinese (zh)
Inventor
戴忠恒
李斌
郭永智
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110872892.4A priority Critical patent/CN115686994A/en
Publication of CN115686994A publication Critical patent/CN115686994A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application relates to an application program pause monitoring method and device, computer equipment and a storage medium. The method comprises the following steps: when each target function in the application program starts to run, recording the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on the annotation; after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on the annotation; determining the operation duration of the target function according to the operation ending time and the operation starting time; performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate pause monitoring results; and the stuck monitoring result is used for reflecting an objective function causing the stuck of the application program based on the running time when the stuck of the application program is monitored. By adopting the method, the monitoring efficiency of the application program can be improved.

Description

Application program pause monitoring method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for monitoring applications stuck in a computer, a computer device, and a storage medium.
Background
With the development of computer technology, users have higher and higher requirements on fluency of operating applications, and therefore, it is very important to effectively monitor and optimize the pause phenomenon of the applications. Currently, there are many tools available in the market for monitoring the performance of an application program, and these monitoring tools can check the layout and state of UI (User Interface) components of the application program, diagnose the problem of too low performance of the UI in the application program, and view the conventional logs and diagnostic information related to the running application program. For example, the Flutter platform officially provides the tool DevTools that can monitor Flutter application program performance.
However, the monitoring tool monitors the application program, the amount of monitoring information fed back by the monitoring tool is too large, and tedious analysis needs to be performed manually from a large amount of monitoring information to find out the cause of the application program jam, so that the monitoring efficiency of the application program is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an application program stuck monitoring method, an apparatus, a computer device, and a storage medium, which can improve the monitoring efficiency of an application program.
An application program stuck monitoring method, the method comprising:
when each target function in an application program starts to run, recording the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on an annotation;
after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
determining the operation duration of the target function according to the operation ending time and the operation starting time;
performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate pause monitoring results; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
An application stuck monitoring apparatus, the apparatus comprising:
the recording module is used for recording the running starting time of each target function in the application program by annotating the time-consuming starting statistical code inserted aiming at the target function; after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
the determining module is used for determining the operation duration of the target function according to the operation ending time and the operation starting time;
the generating module is used for performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate a pause monitoring result; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
In one embodiment, the apparatus further comprises:
the inserting module is used for inserting a time-consuming starting statistical code into the front of the target function and inserting a time-consuming ending statistical code into the back of the target function based on the corresponding annotation of the target function in the application program in the business code compiling process of the application program; and the annotation is provided for the target function based on the tangent-oriented programming framework.
In an embodiment, the inserting module is further configured to insert, in a service code compiling process of the application program, a time-consuming start statistical code at a call start point of an object function based on a corresponding annotation of the object function in the application program; the calling starting point is the position where the target function starts to be called; inserting a time-consuming end statistic code at the calling end point of the target function; the call end point is a position where the target function is called.
In an embodiment, the inserting module is further configured to insert a time-consuming start statistical code at an execution start point of an object function in the application program based on a corresponding annotation of the object function in the application program in a business code compiling process of the application program; the execution starting point is a position where execution of the objective function is started; inserting a time-consuming end statistical code at an execution end point of the target function; the execution end point is a position where the execution of the objective function ends.
In an embodiment, the insertion module is further configured to search, in a business code compiling process of the application program, for an annotation corresponding to an intermediate file generated in the compiling process; if the annotation is found, reading a target function in the intermediate file; and inserting a time-consuming start statistical code before the target function and inserting a time-consuming end statistical code after the target function according to the annotation.
In one embodiment, the determining module is further configured to insert a hierarchical calling relationship of a function in the application program during the service code compiling process of the application program; during the running period of the application program, binding functions in the application program according to the inserted hierarchy calling relationship; determining a subfunction of a preset series to be called, which is bound by an entry function of the application program, and determining the subfunction of the preset series as a target function.
In one embodiment, the determining module is further configured to determine a drawing time duration for each image frame drawn by the application when the page of the application is refreshed; taking the number of the image frames with the corresponding drawing time length larger than the preset time length as the number of lost frames; and determining the page refresh rate of the application program according to the number of the drawn image frames, the lost frame number and a preset page refresh rate.
In one embodiment, the determining module is further configured to monitor a page drawing start function and a page drawing end function during the process of drawing each image frame for the application program; and determining the drawing time of the image frame based on the drawing starting time corresponding to the page drawing starting function and the drawing ending time corresponding to the page drawing ending function.
In one embodiment, the determining module is further configured to store the drawing duration of each image frame into an array after the drawing of the image frame is completed; and taking the numerical value corresponding to the length of the array as the number of the drawn image frames.
In one embodiment, the generating module is further configured to generate a page refresh rate display graph of the application program in the running process based on the page refresh rate of the application program; generating a running time sorting result of each target function in the application program based on the running time of each target function; and displaying the page refresh rate display graph and the running time length sequencing result of each objective function through a pause monitoring page.
In one embodiment, the generating module is further configured to store the operation duration of the objective function as a value, and the function name of the objective function and the class name of the class to which the objective function belongs by way of a key-value pair as keys; and extracting the values in the stored key value pair to obtain the running time length of each target function, executing the running time length based on each target function, and generating a running time length sequencing result of each target function in the application program.
In one embodiment, the generation module is further configured to determine a pause time for an application program to pause according to a page refresh rate of the application program; and determining an objective function causing the applications to be stuck from the objective functions according to the running duration of each objective function in the stuck time.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
when each target function in an application program starts to run, recording the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on an annotation;
after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
determining the operation duration of the target function according to the operation ending time and the operation starting time;
performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate pause monitoring results; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
when each target function in an application program starts to run, recording the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on an annotation;
after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
determining the operation duration of the target function according to the operation ending time and the operation starting time;
performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate pause monitoring results; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
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 instructions from the computer readable storage medium, and when executing the computer instructions, the processor performs the following steps:
when each target function in an application program starts to run, recording the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on an annotation;
after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
determining the operation duration of the target function according to the operation ending time and the operation starting time;
performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate pause monitoring results; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
According to the application program pause monitoring method, the application program pause monitoring device, the computer equipment and the storage medium, when each target function in the application program starts to run, the running starting time of the target function is recorded through the time-consuming starting statistical code inserted aiming at the target function based on the annotation; after the target function is operated, recording the operation ending time of the target function through the time-consuming ending statistical code inserted aiming at the target function based on the annotation, so that the operation duration of the target function can be automatically calculated according to the operation ending time and the operation starting time. According to the two dimensions of the page refresh rate of the application program and the operation time of each objective function, the application program is subjected to pause monitoring, so that when the application program is monitored to have pause, the objective function which causes the application program to have pause can be quickly positioned based on the operation time, and the monitoring efficiency of the application program is improved.
Drawings
FIG. 1 is a diagram of an application environment for a method for application stuck monitoring in one embodiment;
FIG. 2 is a flowchart illustrating a method for monitoring applications stuck in one embodiment;
FIG. 3 is a block diagram that illustrates application stuck monitoring, under an embodiment;
FIG. 4 is a flow diagram illustrating code compilation in one embodiment;
FIG. 5 is a flow diagram that illustrates the intrusive compilation of a cut-plane-oriented programming framework, according to one embodiment;
FIG. 6 is a flow diagram that illustrates annotation intrusion compilation in one embodiment;
FIG. 7 is a flow diagram of a page refresh rate calculation in one embodiment;
FIG. 8 is a schematic flow chart illustrating modification of a target function based on annotations in one embodiment;
FIG. 9 is a block diagram of an embodiment of an application stuck monitoring device;
FIG. 10 is a block diagram showing the structure of an apparatus for monitoring the stuck state of an application in another embodiment;
FIG. 11 is a diagram illustrating an internal structure of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The application program pause monitoring method provided by the application program pause monitoring method can be applied to the application environment shown in fig. 1. An application program runs in the terminal 102, and a user can operate the application program in the terminal 102. The terminal 102 may be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.
Upon starting to run each target function in the application, the terminal 102 may record the run start time of the target function by annotating the time-consuming start statistical code inserted for the target function. After the target function is run, the terminal 102 may record the running end time of the target function by inserting a time-consuming end statistical code for the target function based on the annotation. The terminal 102 may determine the operation duration of the objective function according to the operation ending time and the operation starting time, and may perform stuck monitoring on the application program according to the page refresh rate of the application program and the operation duration of each objective function, so as to generate a stuck monitoring result; and a stuck monitoring result, which is used for reflecting an objective function causing the stuck of the application program based on the running time when the stuck of the application program is monitored.
In one embodiment, as shown in FIG. 2, an application stuck monitoring method is provided. The embodiment is described by taking the method applied to the terminal 102 in fig. 1 as an example, and includes the following steps:
step 202, when each target function in the application program starts to run, recording the running start time of the target function by inserting the time-consuming start statistical code aiming at the target function based on the annotation.
An application is a computer program that performs one or more specific tasks. The application program operates in a user mode, can interact with a user, and has a visual user interface. For example, the application may be a Flutter application based on a Flutter platform. Flutter is an open-source construction user interface toolkit, helps developers to efficiently construct multi-platform exquisite applications through a set of code base, and supports mobile, web (World Wide Web), desktop and embedded platforms.
The objective function is a function in the business code of the application. It is understood that the objective function may be all of the functions in the service code of the application program, or may be a part of the functions in the service code of the application program.
Annotations are special tags in the code. The annotations may be read at compile, class load, or runtime, and corresponding processing performed. It will be appreciated that by annotation, developers can embed supplemental information in the original business code of an application without changing the original business code and logic of the application.
The time-consuming starting statistical code is pre-inserted into the code before the target function and is used for recording the time before the target function is called or executed. The run start time is the time before the target function call or execution.
Starting to run each target function in the application means starting to call or execute the target function for each target function in the application.
Specifically, an application may be deployed in the terminal, and the service code of the application may include an objective function. In response to a user operation, the terminal may start running an application. When the terminal starts to run each target function in the application program, the terminal can record the running starting time of the target function by annotating the time-consuming starting statistical code inserted aiming at the target function.
And step 204, after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on the annotation.
The time-consuming end statistic code is a code pre-inserted into the target function and used for recording the time after the target function is called or executed. The end-of-run time is the time after the target function call or execution. The target function is executed completely, that is, the target function is called or executed for each target function in the application program.
Specifically, the terminal can run each target function in the application program, and for each target function, after the target function is run completely, the running end time of the target function is recorded through annotating the time-consuming end statistical code inserted for the target function.
And step 206, determining the operation duration of the objective function according to the operation ending time and the operation starting time.
Where the run length is the length of time it takes to run the objective function.
Specifically, the terminal may calculate a time difference between the operation end time of the objective function and the operation start time of the objective function, and take the time difference as the operation duration of the objective function.
For example, if the objective function is a function a, and the operation start time of the function a is 16.
Step 208, performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each objective function, and generating a pause monitoring result; and the stuck monitoring result is used for reflecting an objective function causing the stuck of the application program based on the running time when the stuck of the application program is monitored.
Wherein the page refresh rate is a frequency at which the application draws image frames when refreshing the pages of the application. For example, the page refresh rate may be FPS (Frames transmitted Per Second), and it is understood that the more Frames of image Frames transmitted Per Second, the smoother the page display will be. The stuck monitoring refers to monitoring the running performance of the application program in the running process. The result of the stuck monitoring is the performance result of the running performance of the application program in the running process.
Specifically, the terminal may perform stuck monitoring on the application program according to the page refresh rate of the application program and the operation duration of each objective function, and generate a stuck monitoring result. The terminal can display the card pause monitoring result on a card pause monitoring page. It can be understood that when the application program is monitored to be stuck, the target function causing the application program to be stuck can be quickly located based on the stuck monitoring result displayed by the stuck monitoring page. The pause monitoring page is a page for monitoring the pause condition of the application program.
In one embodiment, the terminal may perform stuck monitoring on the application program according to the page refresh rate of the application program, and generate a stuck monitoring result corresponding to the page refresh rate. Meanwhile, the terminal can perform pause monitoring on the application program according to the running time of each target function of the application program, and generates pause monitoring results corresponding to the running time. The terminal can display the pause monitoring result corresponding to the page refreshing rate and the pause monitoring result corresponding to the operation duration in the pause monitoring page. It can be understood that the stuck monitoring result may include a stuck monitoring result corresponding to the page refresh rate and a stuck monitoring result corresponding to the running time length.
Further, the developer may determine a time period for the application to be stuck based on the page refresh rate exhibited by the stuck monitoring page. Furthermore, the developer can view the objective functions running in the time period, and based on the running time of each objective function, the developer can quickly determine the objective function causing the application program to be stuck.
In one embodiment, the terminal may automatically determine an objective function causing the application to be stuck according to the page refresh rate of the application and the running time length of each objective function, and display the objective function causing the application to be stuck in the stuck monitoring page. It can be understood that the result of the stuck monitoring is an objective function shown in the stuck monitoring page, which causes the stuck of the application program.
In an embodiment, as shown in fig. 3, the terminal monitors the stuck of the application program mainly through an operation duration counting module of the objective function, a stuck monitoring page displaying module, and a page refresh rate calculating module. Specifically, the terminal can count the operation duration of the objective function through the operation duration counting module of the objective function, calculate the page refresh rate of the application program through the page refresh rate calculating module, and further display the operation duration of each objective function and the page refresh rate of the application program through the pause monitoring page display module.
In the application program pause monitoring method, when each target function in the application program starts to run, the running starting time of the target function is recorded through a time-consuming starting statistical code inserted aiming at the target function based on the annotation; after the target function is operated, recording the operation ending time of the target function through a time-consuming ending statistical code inserted aiming at the target function based on the annotation, so that the operation duration of the target function can be automatically calculated according to the operation ending time and the operation starting time. According to the two dimensions of the page refresh rate of the application program and the operation time of each objective function, the application program is subjected to pause monitoring, so that when the application program is monitored to have pause, the objective function which causes the application program to have pause can be quickly positioned based on the operation time, and the monitoring efficiency of the application program is improved.
In addition, the existing tools for monitoring the application program performance are only suitable for performance monitoring of the application program in the local development stage. According to the application program jam monitoring method, the time-consuming statistical codes aiming at the target functions are added in the business codes of the application programs through the annotations, and the running time of each target function can be automatically calculated through the time-consuming statistical codes, so that the target functions causing the jam of the application programs can be quickly positioned based on the page refresh rate of the application programs and the running time of the target functions, and the monitoring efficiency of the application programs is improved.
In an embodiment, the method for monitoring stuck of an application program further includes: in the business code compiling process of the application program, based on the corresponding annotation of the target function in the application program, inserting a time-consuming starting statistical code before the target function and inserting a time-consuming ending statistical code after the target function; the annotation is provided for the target function based on the facet-oriented programming framework.
The service code compiling process refers to a process of converting the service code into a binary language based on a compiler. It can be understood that the service code is a high-level language, and the computer can recognize only a binary language, so that it is a precondition for the terminal to run the application program by compiling the service code of the application program into the binary language.
The annotation corresponding to the target function is the annotation corresponding to the time-consuming starting statistical code and the time-consuming ending statistical code of the target function. For example, the annotation corresponding to the target function may specifically include at least one of a Call annotation (i.e., a Call annotation), an Execute annotation (i.e., an Execute annotation), and an Inject annotation (i.e., an Inject annotation).
Aspect Oriented Programming (AOP) is a technology for dynamically adding a specific function to an application program in a pre-compiling manner without modifying the service code of the application program. The section-oriented programming framework is provided for a section-oriented programming technology. For example, the profile-oriented programming framework may specifically include an AspectD framework. The AspectD framework provides call and execution syntax, and provides a method named Inject (i.e., injection) to enhance code operations.
Specifically, before the application program starts to run, the terminal may compile the service code of the application program. In the process of compiling the service code of the application program, the terminal can insert the time-consuming starting statistical code into front of the target function based on the corresponding annotation of the target function in the application program. Meanwhile, the terminal can insert the time-consuming end statistical code into the target function based on the corresponding annotation of the target function in the application program.
In the above embodiment, before the time-consuming start statistical code is inserted into the objective function by the annotation, and after the time-consuming end statistical code is inserted into the objective function, an additional time-consuming statistical code may be added to the application program on the premise of not changing the original business logic of the business code of the application program, so that the time consumption of each objective function in the application program is conveniently counted.
In one embodiment, in a process of compiling a service code of an application program, based on a corresponding annotation of an objective function in the application program, a step of inserting a time-consuming start statistical code before inserting a time-consuming end statistical code after inserting the time-consuming start statistical code into the objective function specifically includes: inserting a time-consuming initial statistical code at a calling initial point of a target function based on a corresponding annotation of the target function in the application program in a business code compiling process of the application program; the calling starting point is the position where the target function starts to be called; inserting a time-consuming end statistic code at the calling end point of the target function; the call end point is a position where the target function is called.
Specifically, before the application program starts to run, the terminal may compile the service code of the application program. In the business code compiling process of the application program, the terminal can insert a time-consuming starting statistical code at the calling starting point of the target function based on the corresponding annotation of the target function in the application program. Meanwhile, the terminal can insert a time-consuming end statistical code at the call end point of the target function based on the corresponding annotation of the target function in the application program.
In the above embodiment, based on the corresponding annotation of the target function in the application program, the time-consuming start statistical code is inserted into the call start point of the target function, and the time-consuming end statistical code is inserted into the call end point of the target function, so that the running duration of the target function can be counted without changing the original structure of the target function.
In an embodiment, in a business code compiling process of an application program, based on a corresponding annotation of an objective function in the application program, before inserting a time-consuming start statistical code into the objective function, a step of inserting a time-consuming end statistical code into the objective function specifically includes: inserting a time-consuming initial statistical code at an execution starting point of an object function based on corresponding annotation of the object function in the application program in a business code compiling process of the application program; the execution starting point is a position where execution of the objective function is started; inserting a time-consuming end statistic code at an execution end point of the target function; the execution end point is a position where the execution of the objective function ends.
Specifically, before the application program starts to run, the terminal may compile the service code of the application program. In the business code compiling process of the application program, the terminal can insert a time-consuming starting statistical code at the execution starting point of the target function based on the corresponding annotation of the target function in the application program. Meanwhile, the terminal can insert a time-consuming end statistical code at the execution end point of the target function based on the corresponding annotation of the target function in the application program.
In the above embodiment, a time-consuming start statistical code is inserted into the execution start point of the target function and a time-consuming end statistical code is inserted into the execution end point of the target function based on the corresponding annotation of the target function in the application program, so that a way of counting the running time of the target function by changing the original structure of the target function is provided.
In one embodiment, as shown in fig. 4, during the process of compiling the code, the terminal may convert the code into an intermediate file (i.e., app. Dill) through a front-end compiler (i.e., front _ server). In the debug mode (i.e., debug mode), the terminal may convert the intermediate file into a file of a first format, for example, a bin file, i.e., a binary file, and may be a kernel _ blob. In the release mode (i.e., release mode), the terminal may convert the intermediate file into a first format file, such as a.frame file or a.so file, and may specifically be an app.frame file. Wherein the intermediate file is a file of an intermediate state generated in the compiling process.
In one embodiment, as shown in fig. 5, during the compilation process of the service code (i.e., business hook) of the application program, the terminal may insert the time-consuming statistical code into the service code of the application program based on the annotation provided by the profile-oriented programming framework, for example, the AspectD framework. In particular, the dependent library of the AspectD framework (i.e., aspectd dependency) may provide an application patch (i.e., apply patch) that may provide annotations, where the annotations may include Call annotations (i.e., call annotations), execute annotations (i.e., execute annotations), and Inject annotations (i.e., inject annotations). The terminal can convert the time-consuming statistic codes (including the time-consuming starting statistic codes and the time-consuming ending statistic codes) into time-consuming statistic code intermediate files (namely aspect. The terminal can search the annotation from the time-consuming statistical code intermediate file through a search tool (i.e., observed Transformation) provided by the observed framework, and modify the target function in the corresponding time-consuming statistical code intermediate file through the searched annotation to generate the time-consuming code patch (i.e., aop _ observed. The terminal can merge the time-consuming code patch into an application program intermediate file (i.e., app _ dil) corresponding to the service code through a patch Flutter _ tools provided by a Flutter platform.
In one embodiment, the corresponding annotation of the target function in the application program can be Call annotation and/or Execute annotation. If the corresponding annotation of the target function in the application program is Call annotation, inserting a time-consuming initial statistical code at a calling initial point of the target function based on the corresponding annotation (namely Call annotation) of the target function in the application program in the business code compiling process of the application program; and inserting a time-consuming end statistic code at the calling end point of the target function. If the annotation corresponding to the target function in the application program is an Execute annotation, inserting a time-consuming start statistical code into an execution start point of the target function based on the annotation corresponding to the target function in the application program (namely the Execute annotation) in the business code compiling process of the application program; and inserting a time-consuming end statistic code at the execution end point of the target function.
In one embodiment, in a process of compiling a service code of an application program, based on a corresponding annotation of an objective function in the application program, a step of inserting a time-consuming start statistical code before inserting a time-consuming end statistical code after inserting the time-consuming start statistical code into the objective function specifically includes: in the business code compiling process of the application program, searching annotations corresponding to intermediate files generated in the compiling process; if the annotation is found, reading a target function in the intermediate file; and inserting a time-consuming start statistical code before the target function and inserting a time-consuming end statistical code after the target function according to the annotation.
Specifically, before the application starts to run, the terminal may compile the service code of the application, and many intermediate files may be generated in the compiling process, where it should be noted that some intermediate files may contain annotations and some intermediate files may not contain annotations. In the business code compiling process of the application program, the terminal can search the annotation corresponding to the intermediate file generated in the compiling process. And if the intermediate file containing the annotation is found, reading the target function in the intermediate file. The terminal can insert the time-consuming start statistical code before the objective function according to the annotation, and simultaneously, the terminal can insert the time-consuming end statistical code after the objective function according to the annotation.
In the above embodiment, the annotations corresponding to the intermediate files are searched by traversing the intermediate files generated in the compiling process one by one, so that the intermediate files containing the annotations can be guaranteed to be processed. And the target function in the intermediate file is uniformly modified through annotation, so that the insertion efficiency of the time-consuming starting statistical code and the time-consuming ending statistical code is improved.
In an embodiment, as shown in fig. 6, the terminal may receive the intermediate file, search for the intermediate file containing the annotation, and if the intermediate file containing the annotation is found, the terminal may read the target function in the intermediate file and modify the target function according to the annotation corresponding to the target function, that is, insert the time-consuming start statistical code before the target function according to the annotation, and insert the time-consuming end statistical code after the target function. After the target function is modified, the terminal can write the target function back to the corresponding intermediate file. If the intermediate file which does not contain the annotation is found, the intermediate file is not processed, and the processing flow is directly ended.
In an embodiment, the method for monitoring applications stuck specifically includes: inserting a function level calling relation in the application program in the business code compiling process of the application program; binding functions in the application program according to the inserted level calling relationship during the running period of the application program; determining subfunctions of preset series to be called and bound by an entry function of the application program, and determining the subfunctions of the preset series as target functions.
The hierarchical call relation of the functions is the call relation among the functions in the application program. The entry function is a function that provides an entry for the time-consuming statistics. A sub-function is the function to which the entry function points.
Specifically, before the application program starts to run, the terminal may compile the service code of the application program. In the process of compiling the service code of the application program, the terminal can insert the hierarchical calling relation of the function in the application program. During the operation of the application program, the terminal can bind the functions in the application program according to the inserted hierarchy calling relationship. Furthermore, the terminal can determine the subfunction of the preset series bound by the entry function of the application program and needing to be called, and determine the subfunction of the preset series as the target function. For example, the terminal may determine 5 levels of sub-functions to be called, which are bound by the entry function of the application program, and determine the 5 levels of sub-functions as the target function
In the embodiment, the sub-function of the preset stage number to be called, which is bound to the entry function, is used as the target function, so that the problem of too long compiling time caused by the super-multi-stage calling of the function can be solved, and the compiling efficiency is improved.
In an embodiment, the method for monitoring applications stuck specifically includes: when a page of an application program is refreshed, determining the drawing time length of each image frame drawn aiming at the application program; taking the number of the image frames with the corresponding drawing time length larger than the preset time length as the number of lost frames; and determining the page refresh rate of the application program according to the number of the drawn image frames, the number of lost frames and a preset page refresh rate.
The drawing time of the image frame is the time length required for drawing one frame of image frame. The lost frame number is the number of lost image frames in the process of drawing the image frames for the application program.
Specifically, during the interaction process between the user and the application program, the terminal can refresh the page of the application program. It will be appreciated that a page of an application may include multiple image frames. When refreshing a page of an application, the terminal may determine a drawing time period for each image frame drawn for the application. And comparing the drawing time of the terminal image frames with a preset time for each image frame, and taking the number of the image frames with the corresponding drawing time longer than the preset time as the number of lost frames, namely the number of the lost image frames. The terminal can calculate the page refresh rate of the application program according to the number of the drawn image frames, the number of lost frames and the preset page refresh rate.
In the above embodiment, the number of the image frames with the corresponding drawing time length longer than the preset time length is used as the number of the lost frames, so that the number of the lost image frames in the process of drawing the image frames can be quickly calculated. The page refresh rate of the application program is calculated according to the number of the drawn image frames, the number of lost frames and the preset page refresh rate, so that the calculation efficiency of the page refresh rate can be improved.
In one embodiment, the step of determining a drawing time duration of each image frame drawn by the application program specifically includes: monitoring a page drawing starting function and a page drawing ending function in the process of drawing each image frame aiming at an application program; and determining the drawing time length of the image frame based on the drawing starting time corresponding to the page drawing starting function and the drawing ending time corresponding to the page drawing ending function.
The page drawing starting function is a function for starting to draw each image frame corresponding to the application program. The page rendering end function is a function for ending rendering of each image frame corresponding to the application program. The drawing start time is a time at which drawing of each image frame corresponding to the application program is started. The drawing end time is a time at which each image frame corresponding to the drawing application is ended.
Specifically, in the process of drawing each image frame for the application program, the terminal may obtain the drawing start time corresponding to the page drawing start function by monitoring the page drawing start function. And the terminal can acquire the drawing ending time corresponding to the page drawing ending function by monitoring the page drawing ending function. Further, the terminal may use a time difference between the rendering end time corresponding to the page rendering end function and the rendering start time corresponding to the page rendering start function as the rendering duration of the image frame.
In one embodiment, the page drawing start function may be handlebeginnfamme () and the page drawing end function may be handledrawdrawframe (). The terminal can register WidgetFlutterbinding and monitors handleBeginFrame () and handleDrawFrame () through the successfully registered WidgetFlutterbinding.
In the above embodiment, the page drawing start function and the page drawing end function are monitored to calculate the drawing time of the image frame, so that the calculation efficiency of the drawing time of the image frame can be improved.
In an embodiment, the method for monitoring stuck of an application program further includes: after each image frame is drawn, storing the drawing duration of the image frame into an array; and taking the numerical value corresponding to the length of the array as the number of the drawn image frames.
Specifically, the page of the application may include a plurality of image frames, and the terminal may draw each image frame one by one while refreshing the page of the application. After each image frame is drawn, the terminal can store the drawing duration of the image frame into an array. The terminal can calculate the length of the corresponding array in the preset time interval, and the numerical value corresponding to the length of the array is used as the number of the drawn image frames.
For example, the timer may be set to 1 second in the terminal, and the terminal may store the drawing time length of each image frame drawn in the 1 second into the array a. The terminal can calculate the length A.length of the array A, and the numerical value corresponding to the length A.length of the array is used as the number of the drawn image frames.
In the above embodiment, the drawing duration of the image frames is stored into the array, so that the number of the image frames is calculated, and the calculation efficiency of the number of the image frames is improved.
In one embodiment, as shown in FIG. 7, the terminal may refresh the page of the application during the user's interaction with the application. For each image frame, the terminal can call a page refreshing starting function to start drawing the image frame, and record the drawing starting time corresponding to the page refreshing starting function. The terminal can call a page refreshing ending function to end the drawing of the image frame and record the drawing ending time corresponding to the page refreshing ending function. After each image frame is drawn, the terminal can store the drawing duration of the image frame into an array. When the time of the timer exceeds the preset time length, the terminal can calculate the number of the image frames based on the length of the array, and calculate the number of the lost frames, namely the number of the lost image frames based on the drawing time length of each image frame in the array. Further, the terminal may calculate a page refresh rate of the application based on the number of drawn image frames, the number of lost frames, and a preset page refresh rate.
For example, if the timer is set to 1 second and the preset page refresh rate is 60 frames per second, the preset duration may be set to 16.6 milliseconds. It is understood that, in the case that the page refresh rate is 60 frames per second, the terminal may draw 60 frames in 1 second, and the drawing time duration of each image frame is 16.6 milliseconds. After each image frame is drawn, the terminal can store the drawing time of the image frame into the array A, and the numerical value corresponding to the length A.length of the array A is used as the number of the drawn image frames. The terminal may regard the number of image frames corresponding to a rendering duration of more than 16.6 milliseconds within 1 second as the number of lost frames within 1 second. Further, the terminal may calculate a page refresh rate of the application based on the number of drawn image frames, the number of lost frames, and a preset page refresh rate (60 frames per second).
In an embodiment, in step 208, that is, the step of performing stuck monitoring on the application program according to the page refresh rate of the application program and the running time of each objective function, and generating a stuck monitoring result specifically includes: generating a page refresh rate display graph of the application program in the running process based on the page refresh rate of the application program; generating a running time sorting result of each target function in the application program based on the running time of each target function; and displaying a page refresh rate display graph and the running time length sequencing result of each objective function through the pause monitoring page.
The page refresh rate display graph is a graph used for displaying the page refresh rate of the application program in the running process. And the running time length sequencing result is a sequencing result used for representing the running time length of each objective function in the application program.
Specifically, the terminal may generate a page refresh rate display diagram of the application program in the running process based on the page refresh rate of the application program, and display the page refresh rate display diagram by monitoring the page through the pause. The terminal can generate the running time sorting result of each target function in the application program based on the running time of each target function, and the running time sorting result of each target function is displayed through the pause monitoring page.
In the embodiment, the page refresh rate display graph is generated based on the page refresh rate of the application program, so that the display effect of the page refresh rate of the application program in the running process can be improved. By generating the running time sorting result based on the running time of each target function, the display effect of the running time of each target function in the application program can be improved, so that the target function causing the jamming of the application program can be quickly positioned based on the page refresh rate display graph and the running time sorting result.
In one embodiment, as shown in fig. 8, the terminal may insert the time consuming start statistics code before the objective function in the application service code by annotation. Meanwhile, the terminal can insert the time-consuming end statistical code into the target function in the application program service code through annotation. And determining the running time of the target function according to the time-consuming starting statistical code and the time-consuming ending statistical code. The terminal can sequence the operation time length of each objective function in the service code to obtain an operation time length sequencing result. The terminal obtains the running time length sequencing result of each target function through the obtaining function, and displays the running time length sequencing result of each target function on the morton monitoring page.
In an embodiment, the method for monitoring applications stuck specifically includes: taking the running time of the target function as a value, taking the function name of the target function and the class name of the class to which the target function belongs as keys, and storing the keys in a key-value pair mode; and extracting the values in the stored key value pairs to obtain the running time length of each target function, executing the running time length based on each target function, and generating a running time length sequencing result of each target function in the application program.
Specifically, the terminal may take the operation time length of the target function as a value (i.e., value), and take the function name of the target function and the class name of the class to which the target function belongs as keys (i.e., key). The terminal can store the running time of the objective function in a key value pair mode. When the operation duration of each objective function needs to be sorted, the terminal can extract the values in the stored key value pairs to obtain the operation duration of each objective function. Furthermore, the terminal can generate the running time sorting result of each target function in the application program based on the running time of each target function.
In the above embodiment, the running durations of the objective functions are stored in a key-value pair manner, so that the running durations of each objective function are sequenced in the following process, and the monitoring efficiency of the application program is further improved.
In an embodiment, in step 208, that is, the step of performing stuck monitoring on the application program according to the page refresh rate of the application program and the running time of each objective function, and generating a stuck monitoring result specifically includes: determining the pause time of the application program according to the page refresh rate of the application program; and determining the objective function causing the application program to be stuck from the objective functions according to the running time length of each objective function in the stuck time.
The pause time refers to a time period or a time point when the application program pauses.
Specifically, the terminal may determine the pause time for the application to pause according to the page refresh rate of the application. It can be understood that the higher the page refresh rate, the lower the probability of the application program jamming, and the lower the page refresh rate, the higher the probability of the application program jamming. The terminal can determine the objective function causing the application program to be stuck from the objective functions according to the running time length of each objective function in the stuck time. It will be appreciated that the longer the run length of the objective function, the greater the probability that characterizing the objective function will cause the application to become stuck, and the shorter the run length of the objective function, the less the probability that characterizing the objective function will cause the application to become stuck.
In the embodiment, the objective function causing the application program to be stuck is automatically determined according to the page refresh rate of the application program and the operation duration of each objective function, so that the stuck monitoring of the application program is more intelligent, and the stuck monitoring efficiency of the application program is further improved.
In one embodiment, an application morton monitoring method is provided, which specifically comprises the following steps:
(1) And inserting the hierarchical calling relation of the functions in the application program in the business code compiling process of the application program.
(2) And during the running period of the application program, binding the functions in the application program according to the inserted hierarchical calling relation.
(3) Determining a subfunction of a preset series to be called, which is bound by an entry function of an application program, and determining the subfunction of the preset series as a target function.
(4) In the business code compiling process of the application program, searching annotations corresponding to intermediate files generated in the compiling process; if the annotation is found, reading a target function in the intermediate file; when the annotation corresponding to the target function is a call annotation, inserting a time-consuming start statistical code at a call start point of the target function based on the call annotation; inserting a time-consuming end statistical code at a calling end point of the target function; when the corresponding annotation of the target function is an execution annotation, inserting a time-consuming starting statistical code at the execution starting point of the target function based on the execution annotation; and inserting a time-consuming end statistic code at the execution end point of the target function.
(5) When each target function in the application program starts to run, the running starting time of the target function is recorded through a time-consuming starting statistical code inserted aiming at the target function based on the annotation.
(6) And after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on the annotation.
(7) Determining the operation duration of the target function according to the operation ending time and the operation starting time; and storing the running time of the target function as a value, and the function name of the target function and the class name of the class to which the target function belongs as keys in a key-value pair mode.
(8) When the page of the application program is refreshed, monitoring a page drawing starting function and a page drawing ending function in the process of drawing each image frame aiming at the application program.
(9) And determining the drawing time of the image frame based on the drawing starting time corresponding to the page drawing starting function and the drawing ending time corresponding to the page drawing ending function.
(10) And taking the number of the image frames with the corresponding drawing time length larger than the preset time length as the number of the lost frames.
(11) And after each image frame is drawn, storing the drawing time of the image frame into an array.
(12) And taking the numerical value corresponding to the length of the array as the number of the drawn image frames.
(13) And determining the page refresh rate of the application program according to the number of the drawn image frames, the number of lost frames and a preset page refresh rate.
(14) Determining the pause time of the application program according to the page refresh rate of the application program; extracting values in the stored key value pairs to obtain the operation duration of each target function; and determining the objective function causing the application program to be stuck from the objective functions according to the running time length of each objective function in the stuck time.
In one embodiment, the terminal may further generate a page refresh rate display graph of the application program in the running process based on the page refresh rate of the application program; generating a running time sorting result of each target function in the application program based on the running time of each target function; and displaying a page refresh rate display graph and the running time length sequencing result of each objective function through the pause monitoring page.
The application also provides an application scene, and the application scene applies the application program pause monitoring method. Specifically, the application program stuck monitoring method can be applied to a scene of a target function causing the application program to be stuck by analyzing a stuck monitoring result by a developer. When the terminal starts to run each target function in the application program, the terminal can record the running starting time of the target function by annotating the time-consuming starting statistical code inserted aiming at the target function. After the target function is operated, the terminal can record the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on the annotation. The terminal can generate a page refresh rate display graph of the application program in the operation process based on the page refresh rate of the application program, and generate the operation time length sequencing result of each objective function in the application program based on the operation time length of each objective function. The terminal can display the page refresh rate display graph and the running time sequencing result of each objective function through the pause monitoring page. Furthermore, the developer can quickly determine the time when the application program is stuck based on the page refresh rate display diagram displayed by the stuck monitoring page. Further, the developer can quickly locate the objective function that caused the application to become stuck based on the time the application was stuck. The developer may optimize the objective function that caused the application to jam, thereby optimizing the performance of the application.
It should be noted that, before the application starts running, the terminal may compile the service code of the application. In the process of compiling the service code of the application program, the terminal can insert the time-consuming starting statistical code before the target function and the time-consuming ending statistical code after the target function based on the corresponding annotation of the target function in the application program.
Specifically, the corresponding annotation of the target function in the application program may be a Call annotation and/or an Execute annotation. If the annotation corresponding to the target function in the application program is a Call annotation, the terminal can insert a time-consuming starting statistical code at the calling starting point of the target function and insert a time-consuming ending statistical code at the calling ending point of the target function based on the Call annotation in the business code compiling process of the application program. If the annotation corresponding to the target function in the application program is an Execute annotation, the terminal may insert a time-consuming start statistical code at an execution start point of the target function and insert a time-consuming end statistical code at an execution end point of the target function based on the Execute annotation in a business code compiling process of the application program.
The page refresh rate of the application program can be calculated by the following method:
when a user refreshes a page of an application program, in the process of drawing each image frame aiming at the application program, the terminal can monitor a page drawing starting function and a page drawing ending function, and determine the drawing duration of the image frame based on the drawing starting time corresponding to the page drawing starting function and the drawing ending time corresponding to the page drawing ending function. After each image frame is drawn, the terminal can store the drawing duration of the image frame into an array, and the numerical value corresponding to the length of the array is used as the number of the drawn image frames. The terminal may use the number of image frames having a corresponding drawing time length greater than a preset time length as the number of lost frames. Further, the terminal may calculate the page refresh rate of the application according to the number of the drawn image frames, the number of lost frames, and a preset page refresh rate.
The application further provides an application scenario applying the application program stuck monitoring method. Specifically, the application program stuck monitoring method can be applied to a scene in which the terminal automatically positions an objective function causing the application program to be stuck. When the terminal starts to run each target function in the application program, the terminal can record the running starting time of the target function by annotating the time-consuming starting statistical code inserted aiming at the target function. After the target function is operated, the terminal can record the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on the annotation. The terminal can determine the pause time of the application program according to the page refresh rate of the application program, and determine the objective function causing the application program to pause from the objective functions according to the running time length of each objective function in the pause time. The terminal can display the objective function which causes the application program to be stuck on a stuck monitoring page. Furthermore, the developer can optimize the objective function which is displayed by the stuck monitoring page and causes the stuck of the application program, thereby optimizing the performance of the application program.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in fig. 2 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
In one embodiment, as shown in fig. 9, an application stuck monitoring apparatus 900 is provided, which may be a part of a computer device using a software module or a hardware module, or a combination of the two, and specifically includes: a recording module 901, a determining module 902 and a generating module 903, wherein:
a recording module 901, configured to record, when starting to run each target function in the application program, a running start time of the target function by using a time-consuming start statistical code inserted for the target function based on the annotation; and after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on the annotation.
A determining module 902, configured to determine an operation duration of the objective function according to the operation ending time and the operation starting time.
A generating module 903, configured to perform stuck monitoring on the application according to the page refresh rate of the application and the operation duration of each objective function, and generate a stuck monitoring result; and the stuck monitoring result is used for reflecting an objective function causing the stuck of the application program based on the running time when the stuck of the application program is monitored.
In one embodiment, the determining module 902 is further configured to insert a hierarchical call relationship of a function in the application program during the service code compiling process of the application program; during the operation of the application program, binding the functions in the application program according to the inserted level calling relationship; determining a subfunction of a preset series to be called, which is bound by an entry function of an application program, and determining the subfunction of the preset series as a target function.
In one embodiment, the determining module 902 is further configured to determine a drawing duration for each image frame drawn by the application when the page of the application is refreshed; taking the number of the image frames with the corresponding drawing time length larger than the preset time length as the number of lost frames; and determining the page refresh rate of the application program according to the number of the drawn image frames, the number of lost frames and a preset page refresh rate.
In one embodiment, the determining module 902 is further configured to monitor a page drawing start function and a page drawing end function during the process of drawing each image frame for the application; and determining the drawing time length of the image frame based on the drawing starting time corresponding to the page drawing starting function and the drawing ending time corresponding to the page drawing ending function.
In one embodiment, the determining module 902 is further configured to store the drawing duration of each image frame into an array after the drawing of each image frame is completed; and taking the numerical value corresponding to the length of the array as the number of the drawn image frames.
In one embodiment, the generating module 903 is further configured to generate a page refresh rate display graph of the application program in the running process based on the page refresh rate of the application program; generating a running time sorting result of each target function in the application program based on the running time of each target function; and displaying a page refresh rate display graph and the running time length sequencing result of each objective function through the pause monitoring page.
In one embodiment, the generating module 903 is further configured to store the running time of the objective function as a value, and the function name of the objective function and the class name of the class to which the objective function belongs by using key value pairs as keys; and extracting the values in the stored key value pairs to obtain the operation duration of each objective function, executing the operation duration based on each objective function, and generating the operation duration sequencing result of each objective function in the application program.
In one embodiment, the generating module 903 is further configured to determine a pause time for the application to pause according to the page refresh rate of the application; and determining the objective function causing the application program to be stuck from the objective functions according to the running time length of each objective function in the stuck time.
Referring to fig. 10, in one embodiment, the application stuck monitoring apparatus 900 further includes: a plug-in module 904, wherein:
an inserting module 904, configured to insert a time-consuming start statistical code before the target function and insert a time-consuming end statistical code after the target function based on a corresponding annotation of the target function in the application program during a service code compiling process of the application program; the annotation is provided for the target function based on the facet-oriented programming framework.
In one embodiment, the inserting module 904 is further configured to insert a time-consuming start statistical code at a call start point of the target function based on a corresponding annotation of the target function in the application program during a service code compiling process of the application program; the calling starting point is the position where the target function starts to be called; inserting a time-consuming end statistical code at a calling end point of the target function; the call end point is a position where the target function is called.
When each target function in the application program starts to run, the application program pause monitoring device records the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on the annotation; after the target function is operated, recording the operation ending time of the target function through a time-consuming ending statistical code inserted aiming at the target function based on the annotation, so that the operation duration of the target function can be automatically calculated according to the operation ending time and the operation starting time. According to the two dimensions of the page refresh rate of the application program and the operation time length of each objective function, the application program is subjected to pause monitoring, so that when the application program is monitored to be paused, the objective function which causes the application program to be paused can be quickly positioned based on the operation time length, and the monitoring efficiency of the application program is improved.
For specific limitations of the application stagnation monitoring apparatus, reference may be made to the above limitations of the application stagnation monitoring method, which will not be described herein again. The modules in the application program card monitoring device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 11. The computer device comprises a processor, a memory, a communication interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for communicating with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement an application stuck monitoring method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 11 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is specific and detailed, but not to be understood as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent application shall be subject to the appended claims.

Claims (15)

1. An application morton monitoring method, characterized in that the method comprises:
when each target function in an application program starts to run, recording the running starting time of the target function through a time-consuming starting statistical code inserted aiming at the target function based on an annotation;
after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
determining the operation duration of the target function according to the operation ending time and the operation starting time;
performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate pause monitoring results; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
2. The method of claim 1, further comprising:
in the business code compiling process of the application program, based on the corresponding annotation of the target function in the application program, inserting a time-consuming starting statistical code before the target function and inserting a time-consuming ending statistical code after the target function;
and the annotation is provided for the target function based on the section-oriented programming framework.
3. The method according to claim 2, wherein during the compiling process of the business code of the application program, based on the corresponding annotation of the target function in the application program, before inserting the time-consuming start statistical code into the target function, and after inserting the time-consuming end statistical code into the target function, the method includes:
inserting a time-consuming start statistical code into a call start point of a target function based on a corresponding annotation of the target function in the application program in a business code compiling process of the application program; the calling starting point is the position where the target function starts to be called;
inserting a time-consuming end statistical code at the calling end point of the target function; the call end point is a position where the target function is called.
4. The method according to claim 2, wherein during the compiling process of the business code of the application program, based on the corresponding annotation of the target function in the application program, before inserting the time-consuming start statistical code into the target function, and after inserting the time-consuming end statistical code into the target function, the method includes:
inserting a time-consuming start statistical code into an execution start point of an object function based on a corresponding annotation of the object function in the application program in a business code compiling process of the application program; the execution starting point is a position where execution of the objective function is started;
inserting a time-consuming end statistical code at an execution end point of the target function; the execution end point is a position where the execution of the objective function ends.
5. The method according to claim 2, wherein during the compiling process of the business code of the application program, based on the corresponding annotation of the target function in the application program, before inserting the time-consuming start statistical code into the target function, and after inserting the time-consuming end statistical code into the target function, the method includes:
in the business code compiling process of the application program, searching annotations corresponding to intermediate files generated in the compiling process;
if the annotation is found, reading a target function in the intermediate file;
and inserting a time-consuming starting statistical code before the time-consuming starting statistical code is inserted into the target function according to the annotation, and inserting a time-consuming ending statistical code after the target function.
6. The method of claim 1, further comprising:
inserting a hierarchical calling relation of functions in the application program in the business code compiling process of the application program;
during the running period of the application program, binding functions in the application program according to the inserted hierarchy calling relationship;
and determining a subfunction of a preset series to be called, which is bound by the entry function of the application program, and determining the subfunction of the preset series as a target function.
7. The method of claim 1, further comprising:
when a page of an application program is refreshed, determining drawing time of each image frame drawn by the application program;
taking the number of the image frames with the corresponding drawing time length larger than the preset time length as the number of lost frames;
and determining the page refresh rate of the application program according to the number of the drawn image frames, the lost frame number and a preset page refresh rate.
8. The method of claim 7, wherein determining a rendering duration for each image frame rendered by the application comprises:
monitoring a page drawing starting function and a page drawing ending function in the process of drawing each image frame aiming at the application program;
and determining the drawing time of the image frame based on the drawing starting time corresponding to the page drawing starting function and the drawing ending time corresponding to the page drawing ending function.
9. The method of claim 8, further comprising:
after each image frame is drawn, storing the drawing time of the image frame into an array;
and taking the numerical value corresponding to the length of the array as the number of the drawn image frames.
10. The method according to any one of claims 1 to 9, wherein the performing stuck monitoring on the application program according to the page refresh rate of the application program and the running time length of each objective function to generate a stuck monitoring result comprises:
generating a page refresh rate display graph of the application program in the running process based on the page refresh rate of the application program;
generating a running time sorting result of each target function in the application program based on the running time of each target function;
and displaying the page refresh rate display graph and the operation duration sequencing result of each objective function through a pause monitoring page.
11. The method of claim 10, further comprising:
taking the running time of the target function as a value, taking the function name of the target function and the class name of the class to which the target function belongs as keys, and storing the keys in a key-value pair mode;
and extracting the values in the stored key value pair to obtain the running time length of each target function, executing the running time length based on each target function, and generating a running time length sequencing result of each target function in the application program.
12. The method according to any one of claims 1 to 9, wherein the performing stuck monitoring on the application program according to the page refresh rate of the application program and the running time of each objective function to generate a stuck monitoring result comprises:
determining the pause time of the application program according to the page refresh rate of the application program;
and determining an objective function causing the applications to be stuck from the objective functions according to the running duration of each objective function in the stuck time.
13. An application jam monitoring apparatus, the apparatus comprising:
the recording module is used for recording the running starting time of each target function in the application program by means of a time-consuming starting statistical code inserted aiming at the target function based on the annotation when the target function starts to run; after the target function is operated, recording the operation end time of the target function through a time-consuming end statistical code inserted aiming at the target function based on annotation;
the determining module is used for determining the operation duration of the target function according to the operation ending time and the operation starting time;
the generating module is used for performing pause monitoring on the application program according to the page refresh rate of the application program and the operation duration of each target function to generate a pause monitoring result; and the pause monitoring result is used for reflecting an objective function which causes the application program to be paused based on the running time when the pause of the application program is monitored.
14. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 12.
15. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 12.
CN202110872892.4A 2021-07-30 2021-07-30 Application program pause monitoring method and device, computer equipment and storage medium Pending CN115686994A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110872892.4A CN115686994A (en) 2021-07-30 2021-07-30 Application program pause monitoring method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110872892.4A CN115686994A (en) 2021-07-30 2021-07-30 Application program pause monitoring method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115686994A true CN115686994A (en) 2023-02-03

Family

ID=85059317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110872892.4A Pending CN115686994A (en) 2021-07-30 2021-07-30 Application program pause monitoring method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115686994A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116610479A (en) * 2023-05-15 2023-08-18 成都赛力斯科技有限公司 Automatic fault monitoring method and device, electronic equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116610479A (en) * 2023-05-15 2023-08-18 成都赛力斯科技有限公司 Automatic fault monitoring method and device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
US20060143596A1 (en) Program analyzing apparatus and testing apparatus, and analyzing method and program therefor
US9454467B2 (en) Method and apparatus for mining test coverage data
CN111177113A (en) Data migration method and device, computer equipment and storage medium
Ongkosit et al. Responsiveness analysis tool for android application
CN111078279A (en) Processing method, device and equipment of byte code file and storage medium
CN110597704A (en) Application program pressure testing method, device, server and medium
CN114297700B (en) Dynamic and static combined mobile application privacy protocol extraction method and related equipment
CN115686994A (en) Application program pause monitoring method and device, computer equipment and storage medium
CN110688245A (en) Information acquisition method, device, storage medium and equipment
US10162629B1 (en) Compiler independent identification of application components
WO2021051583A1 (en) Method and apparatus for transmitting and collecting variable, and computer-readable storage medium
CN112861138A (en) Software security analysis method and analysis device, electronic device, and storage medium
WO2023284877A1 (en) Detection method and apparatus, and electronic device
CN113805861B (en) Code generation method based on machine learning, code editing system and storage medium
CN115904928A (en) Pile inserting method, device, equipment and storage medium for slow function monitoring
CN114385155A (en) vue project visualization tool generation method, device, equipment and storage medium
CN110262856B (en) Application program data acquisition method, device, terminal and storage medium
CN113268221A (en) File matching method and device, storage medium and computer equipment
CN108304294B (en) Real-time frame number monitoring method, storage medium, equipment and system for IOS application
CN112650959A (en) Page loading duration statistical method, device, equipment and storage medium
US8539171B2 (en) Analysis and timeline visualization of storage channels
CN113139190A (en) Program file detection method and device, electronic equipment and storage medium
CN110888628B (en) Method, apparatus, device and storage medium for generating control tool
US11500759B2 (en) Information processing system, information processing method, and development apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40081841

Country of ref document: HK