Data analysis method and device, electronic equipment and computer readable medium
By obtaining the lag description information in the computer system and performing CPU load analysis, the problem of difficulty in determining the cause of ANR in the prior art is solved, and the automatic attribution and diagnosis efficiency of the lag of the computer system is achieved.
Patent Information
- Application Number
- CN202310695743.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art is difficult to effectively determine the causes of computer system applications not responding (ANR), which leads to difficulty in diagnosing and solving lag problems.
After the terminal device is stuttered, it obtains the stutter description information and performs CPU load analysis, including analysis of application dimensions and system dimensions, builds a stack tree, finds nodes that meet preset conditions, and determines the cause of the stutter.
It realizes automatic attribution of the causes of lag in computer systems, improves diagnostic efficiency and accuracy, and can more comprehensively describe the causes of lag.
Smart Images

Figure CN119127454A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data analysis method, device, electronic device, and computer-readable medium. Background Art
[0002] For a computer system (eg, Android system), if an application (Application, App) deployed in the computer system has a problem such as slow response, the computer system will feedback a prompt message of Application Not Responding (ANR).
[0003] However, how to determine the cause of ANR is a technical problem that needs to be solved urgently. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a data analysis method, device, electronic device, and computer-readable medium.
[0005] In order to achieve the above objectives, the technical solutions provided by this application are as follows:
[0006] The present application provides a data analysis method, the method comprising:
[0007] After a freeze occurs on the terminal device, obtain freeze description information;
[0008] If the jamming description information indicates that the CPU load of the central processing unit of the terminal device exceeds the first load threshold when the jamming occurs, then based on the jamming description information and the state description information of the terminal device in the jamming stage, perform at least one dimension of CPU load analysis to obtain at least one dimension of CPU load analysis results;
[0009] According to the CPU load analysis result, the cause analysis result of the jam is determined.
[0010] In a possible implementation, the at least one dimension includes an application dimension and / or a system dimension.
[0011] In one possible implementation, the at least one dimension includes an application dimension;
[0012] The status description information of the terminal device includes running status description information of at least one application deployed on the terminal device;
[0013] The process of determining the CPU load analysis result of the application dimension includes:
[0014] If the jam description information indicates that the CPU load of at least one thread of the target application in the at least one application exceeds the second load threshold when the jam occurs, determining the CPU load analysis result corresponding to the target application using the running state description information of the target application;
[0015] The CPU load analysis result of the application dimension is determined according to the CPU load analysis result corresponding to the target application.
[0016] In a possible implementation manner, the running state description information of the target application includes CPU usage data of at least one thread in the target application;
[0017] The process of determining the CPU load analysis result corresponding to the target application includes:
[0018] Determining, from the at least one thread, a thread that satisfies a preset thread CPU load condition according to the CPU usage data of the at least one thread;
[0019] According to the threads that meet the preset thread CPU load condition, a CPU load analysis result corresponding to the target application is determined.
[0020] In a possible implementation manner, the running state description information of the target application includes tracking data of at least one thread in the target application;
[0021] The process of determining the CPU load analysis result corresponding to the target application includes:
[0022] Build the stack tree of each thread based on the tracking data of each thread;
[0023] Find the node that meets the preset time-consuming condition from the stack tree of each thread;
[0024] According to the nodes that meet the preset time-consuming condition, a CPU load analysis result corresponding to the target application is determined.
[0025] In a possible implementation manner, the running state description information of the target application further includes CPU usage data of each of the threads;
[0026] Before constructing the stack tree of each thread according to the tracking data of each thread, the method further includes:
[0027] Using the CPU usage data of each of the threads, determine the time period corresponding to each of the threads that meets the preset CPU usage condition from the jamming stage;
[0028] According to the time period corresponding to each thread and satisfying the preset CPU usage condition, the tracking data of each thread is screened and processed to obtain the tracking data of each thread in the corresponding time period;
[0029] The step of constructing a stack tree of each thread according to the tracking data of each thread includes:
[0030] According to the tracking data of each thread in the corresponding time period, the stack tree of each thread is constructed.
[0031] In one possible implementation, the at least one dimension includes a system dimension;
[0032] The state description information of the terminal device includes CPU usage data of at least one system process in the terminal device;
[0033] The process of determining the CPU load analysis result of the system dimension includes:
[0034] If the jam description information indicates that the CPU load of the target process in the at least one system process exceeds a third load threshold when the jam occurs, determining a CPU load analysis result of the target process according to the CPU usage data of the target process;
[0035] According to the CPU load analysis result of the target process, the CPU load analysis result of the system dimension is determined.
[0036] In a possible implementation manner, the status description information of the terminal device includes running status description information of at least one application deployed on the terminal device;
[0037] Before determining the cause analysis result of the jamming according to the CPU load analysis result, the method further includes:
[0038] According to the running status description information of each application, a stack tree of each application is constructed;
[0039] Determine, according to the stack tree of each application, the abnormal function corresponding to each application and the abnormal representation data of the abnormal function;
[0040] Determining the cause analysis result of the freeze according to the CPU load analysis result includes:
[0041] The cause analysis result of the jam is determined according to the CPU load analysis result, the abnormal function and the abnormal characterization data of the abnormal function.
[0042] The present application provides a data analysis device, comprising:
[0043] An information acquisition unit, used to acquire freeze description information after freeze occurs in the terminal device;
[0044] A load analysis unit, configured to perform CPU load analysis in at least one dimension based on the jam description information and the state description information of the terminal device during the jam stage, to obtain a CPU load analysis result in at least one dimension if the jam description information indicates that the CPU load of the central processing unit (CPU) of the terminal device exceeds a first load threshold when the jam occurs;
[0045] A result determination unit is used to determine the cause analysis result of the jamming according to the CPU load analysis result.
[0046] The present application provides an electronic device, the device comprising: a processor and a memory;
[0047] The memory is used to store instructions or computer programs;
[0048] The processor is used to execute the instructions or computer programs in the memory so that the electronic device performs the data analysis method provided in the present application.
[0049] The present application provides a computer-readable medium, in which instructions or computer programs are stored. When the instructions or computer programs are executed on a device, the device executes the data analysis method provided by the present application.
[0050] The present application provides a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program codes for executing the data analysis method provided by the present application.
[0051] Compared with the prior art, this application has at least the following advantages:
[0052] In the technical solution provided by the present application, for any terminal device, after the terminal device experiences a freeze (for example, ANR), the freeze description information is first obtained so that the freeze description information can describe the state of the terminal device when the freeze occurs (for example, CPU load state, etc.), so that when it is determined that the freeze description information indicates that the load of the central processing unit (CPU) of the terminal device exceeds a first load threshold when the freeze occurs, a CPU load analysis is performed in at least one dimension based on the freeze description information and the state description information of the terminal device during the freeze stage (for example, tracking data, lock data, input / output data, CPU time consumption, etc.), and a CPU load analysis result in at least one dimension is obtained, so that these CPU load analysis results can represent the CPU load characteristics presented by the terminal device in different dimensions; and then, based on the CPU load analysis result, a cause analysis result of the freeze is determined, so that the cause analysis result can represent the cause of the freeze of the terminal device, thereby achieving the purpose of automatic attribution of the freeze.
[0053] In addition, since at least one of the above dimensions includes the application dimension and / or the system dimension, the CPU load analysis result of the at least one dimension can represent the CPU load characteristics of the terminal device under the application dimension and / or the system dimension, so that the CPU load analysis result of the at least one dimension can more comprehensively represent the CPU load characteristics of the terminal device, so that the cause analysis result of the jamming determined based on the CPU load analysis result of the at least one dimension can more comprehensively describe the cause of the jamming of the terminal device, which is conducive to improving the jamming attribution effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0055] Figure 1 A flowchart of a data analysis method provided in an embodiment of the present application is provided;
[0056] Figure 2 A schematic diagram of an attribution scheme provided in an embodiment of the present application is provided;
[0057] Figure 3 A schematic diagram of an analysis process for tracking data provided by an embodiment of the present application is provided;
[0058] Figure 4 A schematic diagram of an abnormal function attribution analysis provided in an embodiment of the present application is provided;
[0059] Figure 5 A schematic diagram of the structure of a data analysis device provided in an embodiment of the present application;
[0060] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is provided. DETAILED DESCRIPTION
[0061] To facilitate understanding, some technical terms involved in this application are explained below.
[0062] Tracing data, namely trace data, refers to data (such as stack data) obtained when tracing a thread of an application, so that the tracing data records some state information involved in the thread (such as function call information, etc.).
[0063] The stack tree refers to a tree structure constructed based on the tracking data of an App, so that the stack tree can represent the state of the App during runtime (for example, function call state, etc.).
[0064] Jam is used to represent that an application responds slowly; and this application does not limit the jam, for example, it may refer to ANR.
[0065] Based on the above technical terms, the technical solutions provided by this application are introduced below.
[0066] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0067] In order to better understand the technical solution provided by the present application, the data analysis method provided by the present application is described below with reference to some drawings. Figure 1 As shown, the data analysis method provided in the embodiment of the present application includes the following S1-S3. Figure 1 A flowchart of a data analysis method provided in an embodiment of the present application is provided.
[0068] S1: After a freeze occurs on the terminal device, obtain freeze description information.
[0069] Among them, the jam is used to indicate that one or more applications deployed on the terminal device have a slow response. Moreover, the present application does not limit the implementation method of the jam. For example, in some application scenarios, the jam can be implemented using ANR.
[0070] The jam description information is used to describe the state of the terminal device when the jam occurs (for example, the CPU load condition, etc.); and the present application does not limit the implementation method of the jam description information. For example, it can be implemented using any existing or future prompt information that can be generated when the jam occurs (for example, process error status information ProcessErrorStateInfo). For another example, in some application scenarios, the jam description information may not only include the prompt information, but also include trace data obtained by tracing back some or all applications in the terminal device when the jam occurs, so that the jam description information can more comprehensively represent the state of the terminal device when the jam occurs. For ease of understanding, the following is an explanation with examples.
[0071] As an example, when the above jamming refers to ANR, the jamming description information may include: Figure 2 The ANR description information shown is used to describe the state of the terminal device when the ANR occurs. It should be noted that the present application does not limit the ANR description information. For example, the ANR description information may include prompt information generated when the ANR occurs (for example, ANR Info, etc.). As another example, the ANR description information may include prompt information generated when the ANR occurs, as well as trace data obtained by tracing back some applications in the terminal device when the ANR occurs (for example, applications that cause the ANR and applications that have a high CPU occupancy when the ANR occurs, etc.).
[0072] In addition, the present application does not limit the content carried by the above jam description information. For example, in some application scenarios, the jam description information may carry at least one or more of the system overall CPU load data (e.g., Load), application thread CPU load data (e.g., main thread / sub-thread CPU Usage), and system process CPU load data. Among them, the system overall CPU load data is used to describe the CPU load of the terminal device when jam occurs. The application thread CPU load data is used to describe the CPU load of a thread (e.g., main thread or sub-thread) in a certain application when jam occurs; and the present application does not limit the number of application thread CPU load data in the jam description information. In addition, different application thread CPU load data are used to represent the CPU load conditions of different threads. The system process CPU load data is used to describe the CPU load of a certain system process when jam occurs; and the present application does not limit the number of system process CPU load data in the jam description information. In addition, different system process CPU load data are used to represent the CPU load conditions of different system processes. It should be noted that the present application does not limit the system process. For example, it can be implemented using the system process shown in Table 1 below.
[0073]
[0074] Table 1 A possible implementation of system processes that need to be paid attention to when jam occurs
[0075] Based on the relevant content of S1 above, it can be known that for a terminal device, when a freeze occurs in the terminal device (for example, an ANR occurs), the freeze description information (for example, Figure 2 The ANR description information shown) is used to enable the jam description information to indicate the state of the terminal device when the jam occurs (for example, CPU load conditions, etc.), so that jam attribution analysis can be performed based on the jam description information.
[0076] S2: If the jamming description information indicates that the CPU load of the terminal device exceeds a first load threshold when the jamming occurs, a CPU load analysis in at least one dimension is performed based on the jamming description information and the status description information of the terminal device during the jamming stage to obtain the CPU load analysis result in the at least one dimension.
[0077] The first load threshold refers to the threshold required for reference when measuring whether a terminal device has a CPU load abnormality; and the first load threshold can be set in advance according to the actual application scenario. In addition, the present application does not limit the first load threshold. For example, the first load threshold can be Figure 2 The threshold shown is 1 (e.g., 1.5×number of CPU cores).
[0078] In addition, the present application does not limit the determination process of the conclusion above that "the jamming description information indicates that the CPU load of the terminal device exceeds the first load threshold when the jamming occurs". For example, when the jamming description information includes the system's overall CPU load data (for example, Load), if the system's overall CPU load data is greater than the first load threshold (for example, Load>1.5×the number of CPU cores), it can be determined that the CPU load of the terminal device exceeds the first load threshold when the jamming occurs, and thus it can be determined that the terminal device has a CPU load abnormality when the jamming occurs.
[0079] The freeze stage refers to a time period that needs to be referred to when performing freeze attribution analysis; and the present application does not limit the freeze stage. For example, the freeze stage may refer to the time period of [freeze occurrence time - preset duration, freeze occurrence time]. The preset duration may be preset, for example, the preset duration may be 10 seconds.
[0080] The above-mentioned “status description information of the terminal device” is used to describe the status of the terminal device during the freeze stage (for example, CPU usage, function call status, system process execution status, etc.); and the present application does not limit the implementation method of the “status description information of the terminal device”. For example, in some application scenarios, the “status description information of the terminal device” may include the CPU usage data of at least one system process in the terminal device, and one or more of the running status description information of at least one application deployed on the terminal device.
[0081] The CPU usage data of the above system process is used to describe the CPU usage of the system process during the lag stage (for example, CPU load conditions, etc.); and the present application does not limit the "at least one system process" in the above paragraph. For example, the at least one system process may include one or more system processes shown in Table 2 above.
[0082] The above-mentioned running status description information of the application is used to describe the running status of the application during the stuck stage; and the present application does not limit the implementation method of the "running status description information of the application", for example, the "running status description information of the application" may include the state characterization data of at least one thread in the application. Among them, the state characterization data of the thread is used to characterize the state of the thread during the stuck stage; and the present application does not limit the state characterization data of the thread, for example, the state characterization data of the thread may include one or more of the CPU usage data of the thread and the tracking data of the thread. The CPU usage data of the thread is used to describe the CPU usage of the thread during the stuck stage (for example, CPU load, CPU time consumption, etc.). The tracking data of the thread is used to describe the function call of the thread during the stuck stage.
[0083] It should be noted that the present application does not limit the method for obtaining the "thread tracing data" in the previous paragraph. For example, in some application scenarios, the business code of a certain application can be instrumented in advance so that the trace data of all threads of the application can be collected in real time during the running of the application, and the collected trace data can be stored in a certain storage space (for example, a lock-free circular buffer) so that when a freeze is detected later, the trace data matching the freeze stage can be read directly from the storage space.
[0084] The "at least one dimension" in S2 above refers to the dimension required to be referenced when performing CPU load analysis on a terminal device; and this application does not limit the "at least one dimension", for example, the "at least one dimension" may refer to a dimension set in advance based on an application scenario.
[0085] In fact, for terminal devices, since the terminal devices usually provide services to users with the help of some system processes and threads involved in some applications, in order to better improve the comprehensiveness of CPU load analysis, this application also provides a possible implementation of the above "at least one dimension", under which the "at least one dimension" can include application dimension and / or system dimension. For ease of understanding, these two dimensions are introduced below.
[0086] The application dimension mentioned above refers to the dimension required for data analysis of the application deployed in the terminal device, so that the CPU load analysis of the application dimension can specifically refer to the CPU load analysis of the application deployed in the terminal device (for example, Figure 2 The “Application CPU Load Analysis” shown in the figure) enables the CPU load analysis result of the application dimension to represent the characteristics of the CPU load of the application deployed in the terminal device during the jamming stage.
[0087] In addition, the present application does not limit the determination process of the above "CPU load analysis results in the application dimension". For example, when the above "status description information of the terminal device" includes the running status description information of at least one application deployed on the terminal device, the determination process of the "CPU load analysis results in the application dimension" may specifically include the following steps 11-12.
[0088] Step 11: If the above jamming description information indicates that the CPU load of at least one thread of the target application in at least one application above exceeds the second load threshold when the jamming occurs, then use the running status description information of the target application to determine the CPU load analysis result corresponding to the target application.
[0089] Among them, the target application refers to an application deployed on the terminal device that has a higher CPU load when lag occurs; and this application does not limit the number of the target applications.
[0090] In addition, the present application does not limit the determination process of the above target application. For example, when the above jam description information includes N application thread CPU load data, it is determined whether the nth application thread CPU load data exceeds the preset second load threshold. If so, it can be determined that the thread described by the nth application thread CPU load data has a relatively high CPU load when the jam occurs, so the application to which the thread belongs can be regarded as the target application. Among them, the second load threshold refers to the threshold required to identify threads with high CPU loads; and the present application does not limit the second load threshold, for example, it can be Figure 2 The threshold value shown is 2. n is a positive integer, n≤N, and N is a positive integer.
[0091] It can be seen that for any application deployed on the terminal device, the above-mentioned jamming description information can be used to determine the CPU load of some threads in the application (for example, the main thread + multiple sub-threads, etc.) when the jamming occurs. If there are threads among these threads whose CPU load exceeds the second load threshold (for example, the main thread or sub-thread whose CPU Usage is greater than 150%), it can be determined that the application has an abnormal CPU load problem, so the application can be regarded as a target application, so that the CPU load analysis and processing for the target application provided in this application can be used to implement the CPU load analysis and processing for the application.
[0092] The above target application running state description information is used to describe the running state of the target application in the stuck stage. It should be noted that the implementation of the "target application running state description information" is similar to the implementation of the "application running state description information" above.
[0093] The CPU load analysis result corresponding to the target application above is used to indicate the characteristics of the target application in terms of CPU load during the freeze stage; and this application does not limit the determination process of the "CPU load analysis result corresponding to the target application". For ease of understanding, the following is an explanation in combination with several situations.
[0094] Case 1: In some application scenarios, it may be necessary to analyze which threads of the target application have a high CPU load during the jam phase (that is, Figure 2 Coarse attribution for apps shown).
[0095] Based on the above situation 1, the present application provides a possible implementation method of the determination process of the above "CPU load analysis result corresponding to the target application". Under this implementation method, when the running status description information of the target application includes the CPU usage data of at least one thread in the target application, the determination process of the "CPU load analysis result corresponding to the target application" can specifically include the following steps 1101-1102.
[0096] Step 1101: According to CPU usage data of at least one thread in a target application, a thread satisfying a preset thread CPU load condition is determined from the at least one thread.
[0097] The preset thread CPU load condition refers to the condition required for screening high CPU load threads for the target application; and the present application does not limit the implementation method of the preset thread CPU load condition, for example, the preset thread CPU load condition can specifically be: the CPU load exceeds the preset threshold. It should be noted that the CPU load of a thread is determined based on the CPU usage data of the thread; and the present application does not limit the determination process of the CPU load of the thread.
[0098] For another example, after the CPU load of at least one thread in the target application is sorted from high to low, the above preset thread CPU load condition may specifically be: the arrangement sequence number is less than a preset sequence number threshold.
[0099] Based on the relevant contents of step 1101 above, it can be known that in a possible implementation mode, for a target application, after obtaining the CPU usage data of at least one thread in the target application, the CPU load of each thread can be determined according to the CPU usage data of each thread; then, according to the CPU load of these threads, these threads are sorted to obtain a thread sequence, so that threads with higher CPU loads are arranged at the front in the thread sequence, and threads with lower CPU loads are arranged at the back; finally, threads with arrangement numbers less than a preset sequence number threshold are selected from the thread sequence and determined as threads that meet the preset thread CPU load condition (for example, Figure 2 The CPU load analysis result corresponding to the target application can be determined based on these threads that meet the preset thread CPU load conditions.
[0100] Step 1102: Determine the CPU load analysis result corresponding to the target application according to the thread that meets the preset thread CPU load condition.
[0101] It should be noted that the present application does not limit the implementation method of step 1102. For example, it can specifically be: based on the threads that meet the preset thread CPU load conditions above, determine the CPU load analysis results corresponding to the target application, so that the CPU load analysis results corresponding to the target application include these threads that meet the preset thread CPU load conditions, so that the CPU load analysis results corresponding to the target application can indicate which threads in the target application have a higher CPU load during the freeze stage.
[0102] Based on the relevant contents of steps 1101 to 1102 above, it can be known that for an application deployed on a terminal device, if it is determined that the application has an abnormal CPU load problem, the threads with high CPU load in the application can be analyzed based on the running state of the application in the stuck stage, so that the CPU load analysis results corresponding to the target application can be determined based on these threads with high CPU load, so that the CPU load analysis results can indicate which threads in the application have a high CPU load during the stuck stage.
[0103] Case 2: In some application scenarios, it may be necessary to analyze in more detail which CPU-consuming functions the target application called during the stuck phase caused the target application to have abnormal CPU load (that is, Figure 2 Detailed attribution shown).
[0104] Based on the above situation 2, the present application provides a possible implementation method of the determination process of the above "CPU load analysis result corresponding to the target application". Under this implementation method, when the running status description information of the target application includes the tracking data of at least one thread in the target application, the determination process of the "CPU load analysis result corresponding to the target application" can specifically include the following steps 1103-1105.
[0105] Step 1103: construct a stack tree of each thread according to the tracking data of each thread.
[0106] Among them, the stack tree of a thread is used to describe the running status of the thread in the jamming stage (for example, function call status, CPU time consumption, etc.) in a tree structure.
[0107] In addition, the present application does not limit the process of determining the stack tree above. For example, it can be implemented by using any existing or future method that can build a stack tree based on all trace data of a thread within a certain time period.
[0108] Step 1104: Search the stack tree of each thread for a node that meets a preset time-consuming condition.
[0109] Among them, the preset time consumption condition refers to the condition required to be based on when screening functions with high CPU consumption for the target application; and the present application does not limit the preset time consumption condition. For example, the preset time consumption condition can specifically be: the CPU consumption of the function represented by the node is greater than the preset threshold.
[0110] Based on the relevant content of step 1104 above, it can be known that for any thread in the target application, after obtaining the stack tree of the thread, it is determined whether the CPU time consumption of the function represented by the i-th node in the stack tree is greater than the preset threshold. If it is greater, it can be determined that the function represented by the i-th node belongs to a high CPU time consumption function, so the i-th node can be determined as a node with the preset time consumption condition. Wherein, i is a positive integer, i≤the total number of nodes in the stack tree.
[0111] Step 1105: Determine the CPU load analysis result corresponding to the target application according to the nodes that meet the preset time-consuming condition above.
[0112] It should be noted that the present application does not limit the implementation method of step 1102. For example, it can specifically be: based on the nodes that meet the preset time consumption conditions above, determine the CPU load analysis results corresponding to the target application, so that the CPU load analysis results corresponding to the target application include the functions represented by these nodes that meet the preset time consumption conditions, so that the CPU load analysis results corresponding to the target application can indicate which functions in the target application have higher CPU time consumption during the freeze stage.
[0113] For example, in some application scenarios, step 1102 above can be specifically as follows: first, perform at least one preset function analysis on the function represented by the node that meets the preset time-consuming condition above to obtain the function analysis result; then, based on the function analysis result, determine the CPU load analysis result corresponding to the target application, so that the CPU load analysis result includes the function analysis result. Among them, the at least one preset function analysis refers to some pre-set function analysis methods, and the present application does not limit the implementation method of the at least one preset function analysis, for example, it may include one or more of the business attribution analysis and the CPU time-consuming attribution analysis. The business attribution analysis refers to the function analysis process implemented by means of the flame graph aggregated by Caller&Callee, and the present application does not limit the implementation method of the business attribution processing. The CPU time-consuming attribution analysis is used to analyze which objects with high CPU time consumption exist in the function (for example, serialization / deserialization, inflate, a large number of loop / traversal operations, etc.); and the present application does not limit the implementation method of the CPU time-consuming attribution analysis.
[0114] Based on the relevant contents of steps 1103 to 1105 above, it can be known that for an application deployed on a terminal device, if it is determined that the application has an abnormal CPU load problem, the functions with high CPU time consumption called by the application during the stuck stage can be analyzed based on the running state of the application during the stuck stage, so that the CPU load analysis result corresponding to the target application can be determined based on these functions with high CPU time consumption, so that the CPU load analysis result can at least indicate which functions called by the application during the stuck stage have a high CPU load.
[0115] Case 3: In some application scenarios, you may be more concerned about which functions have higher CPU time consumption during the stage of high CPU load.
[0116] Based on the relevant content of the above situation 3, the present application provides a possible implementation method of the determination process of the above "CPU load analysis result corresponding to the target application". Under this implementation method, when the running status description information of the target application includes the tracking data and CPU usage data of at least one thread in the target application, the determination process of the "CPU load analysis result corresponding to the target application" can specifically include the following steps 1106-1110.
[0117] Step 1106: Using the CPU usage data of each thread, determine the time period corresponding to each thread that meets the preset CPU usage conditions from the freeze stage.
[0118] The preset CPU usage condition refers to the condition required for filtering the trace data of a thread; and the present application does not limit the preset CPU usage condition, for example, it can be specifically: the CPU load exceeds the preset filtering threshold (for example, Figure 3 The threshold value shown is 4).
[0119] Based on the relevant content of step 1106 above, it can be known that for any thread of the target application (for example, Figure 3 For example, for thread 1 shown in the figure, after obtaining the CPU usage data of the thread, the CPU load of the thread in the stuck stage can be determined based on the CPU usage data; then, based on the CPU load of the thread in the stuck stage, the time period in which the CPU load exceeds the preset screening threshold is extracted from the stuck stage (for example, Figure 3 Then, the time period in which the extracted CPU load exceeds the preset screening threshold is directly determined as the time period corresponding to the thread that meets the preset CPU usage condition, so that the time period can represent the high CPU load stage of the thread.
[0120] Step 1107: According to the time period corresponding to each thread that meets the preset CPU usage condition, the tracking data of each thread is screened and processed to obtain the tracking data of each thread in the corresponding time period.
[0121] The tracking data of a thread in a corresponding time period refers to the tracking data of the thread in a time period corresponding to the thread that meets the preset CPU usage condition.
[0122] Based on the relevant content of step 1107 above, it can be known that for any thread of the target application (for example, Figure 3 For thread 1 shown in the figure, after obtaining the time period corresponding to the thread that meets the preset CPU usage condition (for example, Figure 3 After the abnormal CPU load phase shown in the figure), the tracking data matching the time period can be screened out from the tracking data of the thread to determine the tracking data of the thread in the corresponding time period.
[0123] Step 1108: construct a stack tree for each thread according to the tracking data of each thread in the corresponding time period.
[0124] In the present application, for any thread of the target application, after obtaining the tracking data of the thread in the corresponding time period, the tracking data can be directly used to construct a stack tree of the thread, so that the stack tree can represent the running status of the thread in the time period corresponding to each thread that meets the preset CPU usage conditions (that is, the running status of the thread in the corresponding time period with higher CPU load).
[0125] Step 1109: Search the stack tree of each thread for a node that meets a preset time-consuming condition.
[0126] It should be noted that the relevant content of step 1109 is similar to the relevant content of step 1104 above.
[0127] Step 1110: Determine the CPU load analysis result corresponding to the target application according to the nodes that meet the preset time-consuming conditions above.
[0128] It should be noted that the relevant content of step 1110 is similar to the relevant content of step 1105 above.
[0129] Based on the relevant contents of steps 1106 to 1110 above, it can be known that for an application deployed on a terminal device, if it is determined that the application has an abnormal CPU load problem, the time period with high CPU load of each thread in the application can be analyzed first based on the running state of the application in the freeze stage; then the tracking data of each thread in the time period with high CPU load is analyzed to find out the functions with high CPU time called by each thread in the time period with high CPU load, so that the CPU load analysis result corresponding to the target application can be determined based on these functions with high CPU time consumption, so that the CPU load analysis result can indicate which functions called by each thread with high CPU load have high CPU load in the time period with high CPU load, which is conducive to improving the analysis speed.
[0130] Case 4, in some application scenarios, it may be necessary to analyze not only which threads of the target application have a high CPU load during the jam phase (that is, Figure 2 In addition to the rough attribution for the application shown in the figure, it may also be necessary to analyze in more detail which CPU-consuming functions the target application called during the stuck phase caused the target application to have abnormal CPU load (that is, Figure 2 Detailed attribution shown).
[0131] Based on the relevant content of Situation 4 above, the present application also provides a possible implementation method of the process of determining the above "CPU load analysis result corresponding to the target application". Under this implementation method, when the running status description information of the target application includes the tracking data and CPU usage data of at least one thread in the target application, the process of determining the "CPU load analysis result corresponding to the target application" can specifically include the following steps 1111-1112.
[0132] Step 1111: According to the running status description information of the target application, determine the threads that meet the preset thread CPU load condition and the nodes that meet the preset time consumption condition.
[0133] It should be noted that the determination process of "threads that meet the preset thread CPU load condition" in step 1111 can be found above. In addition, the determination process of "nodes that meet the preset time consumption condition" in step 1111 can be found above.
[0134] Step 1112: Determine the CPU load analysis result corresponding to the target application according to the threads that meet the preset thread CPU load condition and the nodes that meet the preset time consumption condition.
[0135] It should be noted that the present application does not limit the implementation method of step 1112. For example, it can specifically be: based on the thread that meets the preset thread CPU load condition and the node that meets the preset time consumption condition, determine the CPU load analysis result corresponding to the target application, so that the CPU load analysis result includes the thread that meets the preset thread CPU load condition and the function represented by the node that meets the preset time consumption condition.
[0136] Based on the relevant contents of steps 1111 to 1112 above, it can be known that for an application deployed on a terminal device, if it is determined that the application has an abnormal CPU load problem, the threads with high CPU load in the application and the functions with high CPU time called by the application in a certain stage (for example, a lag stage or a high CPU load stage) can be analyzed first based on the running state of the application in the lag stage, so that the CPU load analysis result corresponding to the target application can be determined based on these threads with high CPU load and these functions with high CPU time, so that the CPU load analysis result can more comprehensively represent the CPU load characteristics of the application in the lag stage.
[0137] Based on the relevant content of step 11 above, it can be known that for an application deployed on a terminal device, if the above jamming description information indicates that the CPU load of one or more threads of the application exceeds the second load threshold when the jamming occurs, it can be determined that the application has an abnormal CPU load problem. Therefore, the running status description information of the application can be used to determine the CPU load analysis result corresponding to the application, so that the CPU load analysis result can represent the characteristics of the target application in terms of CPU load during the jamming stage.
[0138] Step 12: According to the CPU load analysis result corresponding to the target application above, determine the CPU load analysis result of the application dimension.
[0139] It should be noted that the present application does not limit the implementation method of step 12 above. For example, it can specifically be: according to the CPU load analysis result corresponding to the target application above, determine the CPU load analysis result of the application dimension, so that the CPU load analysis result of the application dimension includes the CPU load analysis result corresponding to the target application.
[0140] Based on the relevant contents of steps 11 to 12 above, it can be known that for all applications deployed on the terminal device, the applications with abnormal CPU load problems (for example, the target applications mentioned above) can be screened out from these applications based on the above jamming description information; then these applications with abnormal CPU load problems are analyzed to obtain the CPU load analysis results corresponding to these applications; finally, based on the CPU load analysis results corresponding to these applications, the CPU load analysis results of the application dimension of the terminal device are determined, so that the CPU load analysis results can represent the CPU load characteristics of the terminal device in terms of applications.
[0141] The system dimension mentioned above refers to the dimension required for data analysis of the system process of the terminal device, so that the CPU load analysis of the system dimension can specifically refer to the CPU load analysis of some system processes of the terminal device (for example, Figure 2 The "System CPU Load Analysis" shown in the figure) enables the CPU load analysis result of this system dimension to show the characteristics of the CPU load of the system process of the terminal device during the freezing stage.
[0142] In addition, the present application does not limit the determination process of the above "CPU load analysis results in the system dimension". For example, when the above "status description information of the terminal device" includes the CPU usage data of at least one system process in the terminal device, the determination process of the "CPU load analysis results in the system dimension" may specifically include the following steps 21-22.
[0143] Step 21: If the above jamming description information indicates that the CPU load of the target process in at least one system process above exceeds the third load threshold when the jamming occurs, determine the CPU load analysis result of the target process based on the CPU usage data of the target process.
[0144] Among them, the target process refers to the system process with a higher CPU load that exists in the terminal device when the freeze occurs; and this application does not limit the number of target processes.
[0145] In addition, the present application does not limit the determination process of the target process above. For example, when the above jam description information includes M system process CPU load data, it is determined whether the m-th system process CPU load data is greater than a preset third load threshold (for example, Figure 2If the third load threshold is greater than 3), it can be determined that the system process described by the CPU load data of the mth system process has a relatively high CPU load when the freeze occurs, so the system process can be regarded as the target process. Among them, the third load threshold refers to the threshold required to identify the system process with a high CPU load; and the present application does not limit the third load threshold, for example, it can be Figure 2 Threshold 3 shown.
[0146] In fact, in order to better improve the recognition effect for system processes with higher CPU loads, different system processes may correspond to different thresholds (as shown in Table 3 above). Based on this, it can be seen that the present application also provides another possible implementation of the above target process determination process, which can be specifically: when the above jam description information includes M system process CPU load data, if the mth system process CPU load data is used to describe the CPU load of the mth system process (for example, the kswap system process in Table 1 above) when jam occurs, it can be determined whether the mth system process CPU load data is greater than the third load threshold corresponding to the mth system process (for example, the 5% threshold in Table 1 above). If it is greater, it can be determined that the mth system process has a higher CPU load when jam occurs, so the mth system process can be regarded as the target process.
[0147] The CPU usage data of the target process above is used to indicate the CPU usage of the target process during the stuck stage (eg, CPU load).
[0148] The CPU load analysis results of the target process above are used to represent the characteristics of the CPU load of the target process during the jamming stage.
[0149] In addition, the present application does not limit the process of determining the CPU load analysis result of the target process above. For example, it can specifically be: performing some statistical analysis on the CPU usage data of the target process (for example, drawing a line graph, determining the maximum value, determining the minimum value, etc.) to obtain the CPU load analysis result of the target process.
[0150] For another example, the process of determining the CPU load analysis result of the target process mentioned above may specifically be as follows: first, based on the CPU usage data of the target process, the CPU load abnormality stage of the target process is extracted from the stuck stage, so that the CPU load abnormality stage can indicate which time period of the target process has a higher CPU load during the stuck stage; and then, based on the CPU load abnormality stage of the target process, the CPU load analysis result of the target process is determined, so that the CPU load analysis result can indicate the characteristics of the CPU load of the target process during the stuck stage.
[0151] It should be noted that the present application does not limit the implementation method of "determining the CPU load analysis result of the target process based on the abnormal CPU load stage of the target process" in the above paragraph. For example, it can be specifically: first construct a correspondence between the CPU abnormal attribution label corresponding to the target process (for example, the string "system memory tension" shown in Table 1 above) and the abnormal CPU load stage of the target process; then determine the CPU load analysis result of the target process based on the corresponding relationship, so that the CPU load analysis result of the target process includes the corresponding relationship.
[0152] Based on the relevant content of step 21 above, it can be known that for a system process in the terminal device, if the above lag description information indicates that the CPU load of the system process exceeds the third load threshold when the lag occurs, it can be determined that the system process has an abnormal CPU load problem. Therefore, the CPU usage of the system process during the lag stage can be used to determine the CPU load analysis result of the target process, so that the CPU load analysis result can represent the characteristics of the target process in terms of CPU load during the lag stage.
[0153] Step 22: According to the CPU load analysis result of the target process, determine the CPU load analysis result of the system dimension.
[0154] It should be noted that the present application does not limit the implementation method of step 22 above. For example, it can specifically be: according to the CPU load analysis result of the target process above, determine the CPU load analysis result of the system dimension above, so that the CPU load analysis result of the system dimension includes the CPU load analysis result of the target process.
[0155] Based on the relevant contents of steps 21 to 22 above, it can be known that for some system processes involved in the terminal device (for example, the system processes shown in Table 1 above), it is possible to first determine whether these system processes have abnormal CPU load problems when the freeze occurs based on the above freeze description information; if it is determined that a certain system process has abnormal CPU load problems when the freeze occurs, the CPU load analysis results of the system process can be analyzed based on the CPU usage of the system process during the freeze stage; finally, based on the CPU load analysis results of the system process, the CPU load analysis results of the system dimension of the terminal device are determined, so that the CPU load analysis results can represent the CPU load characteristics of the terminal device in terms of the system process.
[0156] Based on the relevant content of S2 above, it can be known that for a terminal device that has experienced a freeze, after obtaining the freeze description information corresponding to the freeze, first determine whether the terminal device has an abnormal CPU load problem when the freeze occurs based on the freeze description information, so that when it is determined that the terminal device has an abnormal CPU load problem when the freeze occurs, perform a CPU load analysis in at least one dimension based on the freeze description information and the state description information of the terminal device during the freeze stage, and obtain the CPU load analysis result of the at least one dimension, so that the CPU load analysis result can represent the CPU load characteristics of the terminal device in at least one dimension (for example, system process + application), so that the CPU load analysis result of the at least one dimension can more comprehensively represent the CPU load characteristics of the terminal device, and then the subsequent freeze cause analysis result determined based on the CPU load analysis result of the at least one dimension can more comprehensively describe the cause of the freeze of the terminal device, which is conducive to improving the freeze attribution effect.
[0157] S3: Determine the cause of the jamming analysis result based on the CPU load analysis result of at least one dimension.
[0158] It should be noted that the present application does not limit the implementation of S3 above. For example, it can be specifically: directly determining the CPU load analysis result of at least one dimension above as the cause analysis result of the jam. For another example, S3 can also be: first displaying the CPU load analysis result of at least one dimension to the user, so that the user can input the cause analysis result of the jam based on these CPU load analysis results.
[0159] Based on the relevant contents of S1 to S3 above, it can be known that for the data analysis method provided in the embodiment of the present application, after a freeze occurs in the terminal device (for example, ANR), the freeze description information is first obtained so that the freeze description information can describe the state of the terminal device when the freeze occurs (for example, CPU load state, etc.), so that when it is determined that the freeze description information indicates that the load of the central processing unit (CPU) of the terminal device exceeds the first load threshold when the freeze occurs, the CPU load analysis is performed in at least one dimension based on the freeze description information and the state description information of the terminal device during the freeze stage (for example, tracking data, lock data, input / output data, CPU time consumption, etc.), and the CPU load analysis result in at least one dimension is obtained, so that these CPU load analysis results can represent the CPU load characteristics presented by the terminal device in different dimensions; then, based on the CPU load analysis result, the cause analysis result of the freeze is determined, so that the cause analysis result can represent the cause of the freeze of the terminal device, thereby achieving the purpose of automatic attribution of the freeze.
[0160] In addition, since at least one of the above dimensions includes the application dimension and / or the system dimension, the CPU load analysis result of the at least one dimension can represent the CPU load characteristics of the terminal device under the application dimension and / or the system dimension, so that the CPU load analysis result of the at least one dimension can more comprehensively represent the CPU load characteristics of the terminal device, so that the cause analysis result of the jamming determined based on the CPU load analysis result of the at least one dimension can more comprehensively describe the cause of the jamming of the terminal device, which is conducive to improving the jamming attribution effect.
[0161] In addition, the present application does not limit the execution subject of the data analysis method. For example, any implementation of the data analysis method provided in the embodiment of the present application can be applied to a device with data processing function such as a terminal device or a server. For example, any implementation of the data analysis method provided in the embodiment of the present application can also be implemented by means of a data communication process between different devices (for example, a terminal device and a server, two terminal devices, or two servers). Among them, the terminal device can be a smart phone, a computer, a personal digital assistant (PDA) or a tablet computer. The server can be a stand-alone server, a cluster server or a cloud server.
[0162] Through research, it was found that the phenomenon of lag may also be caused by calling a time-consuming function when an application is running (for example, the main thread, etc.). Therefore, in order to better improve the comprehensiveness of the attribution of lag, the present application also provides another possible implementation of the above data analysis method. Under this implementation, the data analysis method may include the following steps 31-35.
[0163] Step 31: After the terminal device freezes, obtain freeze description information.
[0164] It should be noted that for the relevant content of step 31 above, please refer to the relevant content of S1 above.
[0165] Step 32: If the jamming description information indicates that the CPU load of the terminal device exceeds the first load threshold when the jamming occurs, perform a CPU load analysis in at least one dimension based on the jamming description information and the status description information of the terminal device during the jamming stage to obtain the CPU load analysis result in the at least one dimension.
[0166] It should be noted that for the relevant content of step 32 above, please refer to the relevant content of S2 above.
[0167] Step 33: When the terminal device status description information includes the running status description information of at least one application deployed on the terminal device, a stack tree of each application is constructed according to the running status description information of each application.
[0168] Among them, a stack tree of an application is used to describe the running status of the application in the jamming stage according to the tree structure.
[0169] In addition, the present application does not limit the implementation of the above step 33. For example, it can be implemented by any existing or future method that can build a stack tree of an application. For ease of understanding, an example is provided below for explanation.
[0170] As an example, when the running status description information of the j-th application includes trace data, lock data, communication (Binder) data, input / output (IO) data, and CPU time consumption data, the running status description information of the j-th application is first integrated to obtain an initial stack tree, so that the initial stack tree can more comprehensively represent the status of the j-th application in terms of system function + non-system function calls; then the initial stack tree is merged to obtain a merged stack tree, so that different nodes in the same layer of the merged stack tree represent different functions, and the merged stack tree is regarded as the stack tree of the j-th application, so that abnormal function analysis can be performed based on the stack tree of the j-th application later. Wherein, j is a positive integer, and j≤the number of applications in the above "at least one application".
[0171] It should be noted that the present application does not limit the execution time of step 33, as long as the execution time of step 33 is ensured to be earlier than the execution time of step 34 below.
[0172] Step 34: Determine the abnormal function corresponding to each application and the abnormal representation data of the abnormal function according to the stack tree of each application.
[0173] Among them, an abnormal function refers to a function that meets a preset abnormal condition. The preset abnormal condition refers to the condition required to be based on when performing abnormal function identification and processing, and this application does not limit the preset abnormal condition. For example, the preset abnormal condition can specifically be: the time consumption of the abnormal function reaches a certain time consumption constraint condition. The time consumption constraint condition can be set in advance according to the application scenario. For ease of understanding, the following is explained with examples.
[0174] As an example, the determination process of the abnormal function above can be specifically as follows: first determine whether the time taken by the function represented by the root node in the stack tree of the jth application is greater than a preset time threshold (e.g., 5 seconds), so that when it is determined that the time taken by the function represented by the root node is greater than the preset time threshold, traverse each node in the stack tree layer by layer from top to bottom to determine whether there is a node that meets the preset disassembly condition. If so, the function represented by the node that meets the preset disassembly condition is determined as the abnormal function corresponding to the jth application; if not, the function represented by the root node is determined as the abnormal function corresponding to the jth application. Among them, the preset disassembly condition can be set in advance according to the application scenario. For example, the preset disassembly condition can be specifically as follows: the ratio between the time taken by a function represented by a node and the time taken by the function represented by the parent node of the node exceeds a preset ratio threshold (e.g., 40%). Among them, j is a positive integer, and j≤the number of applications in the above "at least one application".
[0175] The abnormal characterization data of the abnormal function is used to characterize the abnormal state of the abnormal function; and the present application does not limit the implementation method of the abnormal characterization data. For example, the abnormal characterization data may specifically include abnormal confidence and / or abnormal attribution rate.
[0176] The abnormal confidence is used to indicate the possibility that the abnormal function affects the above-mentioned jamming. Moreover, the present application does not limit the determination process of the abnormal confidence. For example, it can be implemented using the following formula (1).
[0177] Anomaly confidence = function time of the abnormal function / duration of the stuck phase (1)
[0178] The function time consumption of an abnormal function refers to the time consumed when an application program calls the abnormal function.
[0179] The abnormal attribution rate is used to indicate the possibility that an abnormal function affects the jamming in some aspects; and the present application does not limit the abnormal attribution rate. For example, the abnormal attribution rate may include the multi-dimensional time-consuming attribution rate of the function (for example, Figure 4 80% as shown), function CPU time attribution rate (for example, Figure 4 50% as shown) and the non-CPU time attribution of the function (for example, Figure 4 83.3% shown)).
[0180] The function multi-dimensional time consumption attribution rate is used to indicate the possibility that the abnormal function has an overall impact on the jamming in multiple dimensions. Moreover, the present application does not limit the determination process of the function multi-dimensional time consumption attribution rate. For example, it can be implemented using the following formula (2).
[0181] Function multi-dimensional time consumption attribution rate = (CPU object time consumption + non-CPU object time consumption) / abnormal function time consumption (2)
[0182] In the formula, the CPU object time consumption refers to the CPU time consumed by executing certain CPU objects (for example, using the Gson library, executing loops, etc.) when the above exception function is running (for example, Figure 4 The non-CPU object time consumption refers to the time consumed by the execution of certain non-CPU objects (for example, calling certain system functions) when the exception function is running (for example, Figure 4 2.5 seconds as shown). The CPU object refers to an object that needs to be executed with the help of the CPU. The non-CPU object refers to an object that does not need to be executed with the help of the CPU. It should be noted that the present application does not limit the implementation methods of the CPU object and the non-CPU object. For example, it can be implemented using Table 2 below.
[0183]
[0184] Table 2 A possible implementation of CPU objects and non-CPU objects
[0185] The function CPU time consumption attribution rate is used to indicate the possibility that an abnormal function affects the jamming in the CPU dimension. Moreover, the present application does not limit the determination process of the function CPU time consumption attribution rate. For example, it can be implemented using the following formula (3).
[0186] Function CPU time attribution rate = CPU object time / abnormal function CPU time (3)
[0187] In the formula, the CPU time consumed by an exception function refers to the CPU time consumed when an application calls the exception function (for example, Figure 4 3 seconds shown).
[0188] The function non-CPU time consumption attribution rate is used to indicate the possibility that an abnormal function affects the jamming in the non-CPU dimension. Moreover, the present application does not limit the determination process of the function non-CPU time consumption attribution rate. For example, it can be implemented using the following formula (4).
[0189] Function non-CPU time consumption attribution rate = non-CPU object time consumption / abnormal function non-CPU time consumption (4)
[0190] In the formula, the non-CPU time consumed by an exception function refers to the non-CPU time consumed when an application calls the exception function (for example, Figure 4 3 seconds as shown); and the non-CPU time consumed by the abnormal function = the time consumed by the abnormal function - the CPU time consumed by the abnormal function.
[0191] Based on the relevant content of step 34 above, it can be known that for an application deployed on a terminal device, after obtaining the stack tree of the application, an abnormal function attribution analysis can be performed based on the stack tree to obtain at least one abnormal function and abnormal characterization data of each abnormal function, so that the cause of the lag can be determined based on these abnormal functions and their abnormal characterization data.
[0192] It should be noted that the present application does not limit the execution time of step 34, as long as the execution time of step 34 is ensured to be earlier than the execution time of step 35 below.
[0193] Step 35: Determine the cause analysis result of the jamming according to the CPU load analysis result of at least one dimension above, the abnormal function of at least one application program above, and the abnormal characterization data of the abnormal function.
[0194] It should be noted that the present application does not limit the implementation method of the above step 35. For example, it can be specifically: directly determine the CPU load analysis result of at least one dimension above, the abnormal function of at least one application above, and the abnormal characterization data of the abnormal function as the cause analysis result of the jam. For another example, the step 35 can also be: first display the CPU load analysis result of at least one dimension, the abnormal function of at least one application above, and the abnormal characterization data of the abnormal function to the user, so that the user can input the cause analysis result of the jam based on this information.
[0195] Based on the relevant contents of steps 31 to 35 above, it can be known that for a terminal device, after the terminal device becomes stuck, not only the CPU load analysis results of the terminal device in at least one dimension can be analyzed, but also the abnormal functions involved in some applications deployed in the terminal device and the abnormal characterization data of the abnormal functions can be analyzed, so that the cause analysis results of the stuck can be determined based on these analysis results, which is conducive to improving the comprehensiveness of the attribution of the stuck.
[0196] In addition, in some application scenarios, for steps 31 to 35 above, steps 31-32 above can be used to analyze the causes of jamming related to child threads; and steps 33-34 above can be used to analyze the causes related to the main thread, thereby achieving the purpose of adopting different attribution analysis schemes for different types of threads, which is conducive to improving the attribution effect.
[0197] Based on the data analysis method provided in the embodiment of the present application, the embodiment of the present application also provides a data analysis device. Figure 5 Explain and illustrate. Figure 5This is a schematic diagram of the structure of a data analysis device provided in an embodiment of the present application. It should be noted that for the technical details of the data analysis device provided in an embodiment of the present application, please refer to the relevant content of the data analysis method above.
[0198] like Figure 5 As shown, the data analysis device 500 provided in the embodiment of the present application includes:
[0199] The information acquisition unit 501 is used to acquire freeze description information after freeze occurs in the terminal device;
[0200] The load analysis unit 502 is configured to perform CPU load analysis in at least one dimension based on the jam description information and the state description information of the terminal device during the jam stage, if the jam description information indicates that the CPU load of the central processing unit of the terminal device exceeds a first load threshold when the jam occurs, to obtain a CPU load analysis result in at least one dimension;
[0201] The result determination unit 503 is used to determine the cause analysis result of the jamming according to the CPU load analysis result.
[0202] In a possible implementation, the at least one dimension includes an application dimension and / or a system dimension.
[0203] In a possible implementation manner, the at least one dimension includes an application dimension; the state description information of the terminal device includes running state description information of at least one application deployed on the terminal device;
[0204] The load analysis unit 502 includes:
[0205] A first determining subunit is configured to determine a CPU load analysis result corresponding to the target application using the running state description information of the target application if the jam description information indicates that the CPU load of at least one thread of the target application in the at least one application exceeds a second load threshold when the jam occurs;
[0206] The second determining subunit is used to determine the CPU load analysis result of the application dimension according to the CPU load analysis result corresponding to the target application.
[0207] In a possible implementation manner, the running state description information of the target application includes CPU usage data of at least one thread in the target application;
[0208] The first determination subunit is specifically used to: determine a thread that meets a preset thread CPU load condition from the at least one thread according to the CPU usage data of the at least one thread; and determine a CPU load analysis result corresponding to the target application according to the thread that meets the preset thread CPU load condition.
[0209] In a possible implementation manner, the running state description information of the target application includes tracking data of at least one thread in the target application;
[0210] The first determination subunit is specifically used to: build a stack tree for each thread based on the tracking data of each thread; search for nodes that meet preset time-consuming conditions from the stack tree of each thread; and determine the CPU load analysis result corresponding to the target application based on the nodes that meet the preset time-consuming conditions.
[0211] In a possible implementation manner, the running state description information of the target application further includes CPU usage data of each of the threads;
[0212] The first determining subunit is further used to: determine the time period corresponding to each thread and meeting the preset CPU usage condition from the jamming stage by using the CPU usage data of each thread; and filter and process the tracking data of each thread according to the time period corresponding to each thread and meeting the preset CPU usage condition to obtain the tracking data of each thread in the corresponding time period;
[0213] The first determining subunit is specifically configured to construct a stack tree of each thread according to the tracking data of each thread in a corresponding time period.
[0214] In a possible implementation manner, the at least one dimension includes a system dimension; the state description information of the terminal device includes CPU usage data of at least one system process in the terminal device;
[0215] The load analysis unit 502 includes:
[0216] a third determining subunit, configured to determine a CPU load analysis result of the target process according to the CPU usage data of the target process if the jam description information indicates that the CPU load of the target process in the at least one system process exceeds a third load threshold when the jam occurs;
[0217] The fourth determining subunit is used to determine the CPU load analysis result of the system dimension according to the CPU load analysis result of the target process.
[0218] In a possible implementation manner, the status description information of the terminal device includes running status description information of at least one application deployed on the terminal device;
[0219] The data analysis device 500 further includes:
[0220] The function analysis unit is used to construct a stack tree of each application according to the running status description information of each application; determine the abnormal function corresponding to each application and the abnormal representation data of the abnormal function according to the stack tree of each application;
[0221] The result determination unit 503 is specifically used to determine the cause analysis result of the jamming according to the CPU load analysis result, the abnormal function and the abnormal characterization data of the abnormal function.
[0222] Based on the relevant content of the above-mentioned data analysis device 500, it can be known that for the data analysis device 500 provided in the embodiment of the present application, after determining that the terminal device has a freeze (for example, ANR), the freeze description information is first obtained so that the freeze description information can describe the state of the terminal device when the freeze occurs (for example, CPU load state, etc.), so that when it is determined that the freeze description information indicates that the central processing unit (CPU) load of the terminal device exceeds the first load threshold when the freeze occurs, based on the freeze description information and the state description information of the terminal device during the freeze stage (for example, tracking data, lock data, input / output data, CPU time consumption, etc.), perform at least one dimension of CPU load analysis to obtain at least one dimension of CPU load analysis results, so that these CPU load analysis results can represent the CPU load characteristics presented by the terminal device in different dimensions; then, based on the CPU load analysis result, determine the cause analysis result of the freeze, so that the cause analysis result can represent the cause of the freeze of the terminal device, thereby achieving the purpose of automatic attribution of the freeze.
[0223] In addition, since at least one of the above dimensions includes the application dimension and / or the system dimension, the CPU load analysis result of the at least one dimension can represent the CPU load characteristics of the terminal device under the application dimension and / or the system dimension, so that the CPU load analysis result of the at least one dimension can more comprehensively represent the CPU load characteristics of the terminal device, so that the cause analysis result of the jamming determined based on the CPU load analysis result of the at least one dimension can more comprehensively describe the cause of the jamming of the terminal device, which is conducive to improving the jamming attribution effect.
[0224] In addition, an embodiment of the present application also provides an electronic device, which includes a processor and a memory: the memory is used to store instructions or computer programs; the processor is used to execute the instructions or computer programs in the memory, so that the electronic device executes any implementation of the data analysis method provided in the embodiment of the present application.
[0225] See also Figure 6 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0226] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0227] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0228] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0229] The electronic device provided by the embodiment of the present disclosure and the method provided by the above embodiment belong to the same inventive concept, and the technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0230] The embodiment of the present application also provides a computer-readable medium, in which instructions or computer programs are stored. When the instructions or computer programs are executed on a device, the device executes any implementation of the data analysis method provided in the embodiment of the present application.
[0231] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0232] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0233] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0234] The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can execute the method.
[0235] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0236] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0237] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit / module does not, in some cases, constitute a limitation on the unit itself.
[0238] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0239] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0240] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0241] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0242] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0243] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0244] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data analysis method, characterized in that: The method comprises: After a freeze occurs on the terminal device, obtain freeze description information; If the jamming description information indicates that the CPU load of the central processing unit of the terminal device exceeds the first load threshold when the jamming occurs, then based on the jamming description information and the state description information of the terminal device in the jamming stage, perform at least one dimension of CPU load analysis to obtain at least one dimension of CPU load analysis results; According to the CPU load analysis result, the cause analysis result of the jam is determined.
2. The method according to claim 1, characterized in that The at least one dimension includes an application dimension and / or a system dimension.
3. The method according to claim 2, characterized in that The at least one dimension comprises an application dimension; The status description information of the terminal device includes running status description information of at least one application deployed on the terminal device; The process of determining the CPU load analysis result of the application dimension includes: If the jam description information indicates that the CPU load of at least one thread of the target application in the at least one application exceeds the second load threshold when the jam occurs, determining the CPU load analysis result corresponding to the target application using the running state description information of the target application; The CPU load analysis result of the application dimension is determined according to the CPU load analysis result corresponding to the target application.
4. The method according to claim 3, characterized in that The running state description information of the target application includes CPU usage data of at least one thread in the target application; The process of determining the CPU load analysis result corresponding to the target application includes: Determining, from the at least one thread, a thread that satisfies a preset thread CPU load condition according to the CPU usage data of the at least one thread; According to the threads that meet the preset thread CPU load condition, a CPU load analysis result corresponding to the target application is determined.
5. The method according to claim 3, characterized in that: The running state description information of the target application includes tracking data of at least one thread in the target application; The process of determining the CPU load analysis result corresponding to the target application includes: Build the stack tree of each thread based on the tracking data of each thread; Find the node that meets the preset time-consuming condition from the stack tree of each thread; According to the nodes that meet the preset time-consuming condition, a CPU load analysis result corresponding to the target application is determined.
6. The method according to claim 5, characterized in that The target application's running status description information also includes CPU usage data of each of the threads; Before constructing the stack tree of each thread according to the tracking data of each thread, the method further includes: Using the CPU usage data of each of the threads, determine the time period corresponding to each of the threads that meets the preset CPU usage condition from the jamming stage; According to the time period corresponding to each thread and satisfying the preset CPU usage condition, the tracking data of each thread is screened and processed to obtain the tracking data of each thread in the corresponding time period; The step of constructing a stack tree of each thread according to the tracking data of each thread includes: According to the tracking data of each thread in the corresponding time period, the stack tree of each thread is constructed.
7. The method according to claim 2, characterized in that The at least one dimension comprises a system dimension; The state description information of the terminal device includes CPU usage data of at least one system process in the terminal device; The process of determining the CPU load analysis result of the system dimension includes: If the jam description information indicates that the CPU load of the target process in the at least one system process exceeds a third load threshold when the jam occurs, determining a CPU load analysis result of the target process according to the CPU usage data of the target process; According to the CPU load analysis result of the target process, the CPU load analysis result of the system dimension is determined.
8. The method according to claim 1, characterized in that The status description information of the terminal device includes running status description information of at least one application deployed on the terminal device; Before determining the cause analysis result of the jamming according to the CPU load analysis result, the method further includes: According to the running status description information of each application, a stack tree of each application is constructed; Determine, according to the stack tree of each application, the abnormal function corresponding to each application and the abnormal representation data of the abnormal function; Determining the cause analysis result of the freeze according to the CPU load analysis result includes: The cause analysis result of the jam is determined according to the CPU load analysis result, the abnormal function and the abnormal characterization data of the abnormal function.
9. A data analysis device, characterized in that: include: An information acquisition unit, used to acquire freeze description information after freeze occurs in the terminal device; A load analysis unit, configured to perform CPU load analysis in at least one dimension based on the jam description information and the state description information of the terminal device during the jam stage, to obtain a CPU load analysis result in at least one dimension if the jam description information indicates that the CPU load of the central processing unit (CPU) of the terminal device exceeds a first load threshold when the jam occurs; A result determination unit is used to determine the cause analysis result of the jamming according to the CPU load analysis result.
10. An electronic device, characterized in that: The device comprises: a processor and a memory; The memory is used to store instructions or computer programs; The processor is used to execute the instructions or computer programs in the memory so that the electronic device executes the method according to any one of claims 1 to 8.
11. A computer readable medium, characterized in that The computer-readable medium stores instructions or computer programs, and when the instructions or computer programs are executed on a device, the device executes the method according to any one of claims 1 to 8.
