Data processing method and device, electronic equipment and computer readable medium
By acquiring and integrating the stack tree and data to be added, a multi-dimensional state description is formed, which solves the problem of difficulty in obtaining and analyzing application state in the prior art, and improves the effect of data acquisition and performance analysis.
Patent Information
- Application Number
- CN202310693532.7
- 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
It is difficult to effectively obtain and analyze data related to applications on electronic devices, especially when the application is unresponsive (ANR) or startup status, and it is difficult to determine the cause.
By obtaining the stack tree of the target application and the data to be added, the data to be added to the stack tree is added using the timestamp alignment results, forming a multi-dimensional state description, including application function calls, system function calls and CPU usage dimensions.
Improves the relevant data acquisition effect of the target application, allowing the stack tree to more comprehensively represent the state of the application in multiple dimensions, helping to analyze ANR or startup performance issues.
Smart Images

Figure CN119127452A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, electronic device, and computer-readable medium. Background Art
[0002] For applications deployed on electronic devices, it is sometimes necessary to use the application's related data (e.g., stack data, etc.) to analyze the application's performance. For example, when the application is unresponsive (ANR), it may be necessary to use the application's related data to analyze the cause of the ANR. For another example, in some application scenarios, it may be necessary to analyze the application's startup status based on the application's related data.
[0003] However, how to obtain relevant data of an application 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 processing 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 processing method, the method comprising:
[0007] Obtain a stack tree of a target application and data to be added corresponding to the target application; the stack tree is used to describe the state of the target application in the application function call dimension within a target time period, and the stack tree carries timestamp information; the data to be added is used to describe the state of the target application in at least one dimension to be supplemented within the target time period, and each dimension to be supplemented is different from the application function call dimension; the data to be added carries timestamp information;
[0008] According to the timestamp alignment result between the data to be added and the stack tree, the data to be added is added to the stack tree to obtain the added stack tree; the added stack tree is used to describe the state of the target application in multiple dimensions, and the multiple dimensions include the application function call dimension and the at least one dimension to be supplemented.
[0009] In one possible implementation, the data to be added includes system-related data and / or central processing unit CPU usage characterization data, wherein the system-related data is used to describe the state of the target application in the system function call dimension within the target time period; and the CPU usage characterization data is used to describe the state of the target application in the CPU usage dimension within the target time period.
[0010] In a possible implementation manner, the data to be added includes the CPU usage characterization data; the CPU usage characterization data includes at least one function using a CPU timestamp and a function using a CPU duration corresponding to each function using a CPU timestamp;
[0011] The step of adding the data to be added to the stack tree comprises:
[0012] For any of the functions using the CPU timestamp, if the timestamp alignment result indicates that the function using the CPU timestamp matches the timestamp of the first node in the stack tree, the node attribute of the first node is updated using the function using CPU duration corresponding to the function using the CPU timestamp.
[0013] In a possible implementation manner, the data to be added includes the system-related data; the system-related data includes at least one system function call data;
[0014] The step of adding the data to be added to the stack tree comprises:
[0015] For any system function call data, if the timestamp alignment result indicates that the timestamp in the system function call data matches the timestamp of the second node in the stack tree, a new child node is created for the second node in the stack tree, and the node attributes of the child node are determined based on the system function call data.
[0016] In a possible implementation manner, the process of acquiring the stack tree of the target application includes:
[0017] Reading at least one first type of tracing data matching the target time period from a first storage space, wherein the first storage space is used to cross-record a state presented by at least one thread in the target application in an application function call dimension;
[0018] Determining, according to the thread identifier in each of the first-category tracing data, the first-category tracing data corresponding to each of the threads from the at least one first-category tracing data;
[0019] Constructing a stack tree corresponding to each of the threads according to the first type of tracking data corresponding to each of the threads;
[0020] The stack tree of the target application is determined according to the stack tree corresponding to the at least one thread.
[0021] In one possible implementation, the at least one thread includes a plurality of sub-threads;
[0022] Before determining the stack tree of the target application according to the stack tree corresponding to the at least one thread, the method further includes:
[0023] reading second-type tracing data matching the target time period from a second storage space, wherein a data format of the second-type tracing data is different from a data format of the first-type tracing data, and the second storage space is used to record a state presented by a main thread in the target application in an application function call dimension;
[0024] Constructing a stack tree corresponding to the main thread according to the second type of tracking data;
[0025] The determining the stack tree of the target application according to the stack tree corresponding to the at least one thread includes:
[0026] The stack tree of the target application is determined according to the stack tree corresponding to the main thread and the stack trees corresponding to the plurality of sub-threads.
[0027] In a possible implementation manner, the CPU uses a process of acquiring characterization data, including:
[0028] Reading at least one first type of CPU usage data matching the target time period from a third storage space, wherein the third storage space is used to cross-record a state presented by at least one thread in the target application under a CPU usage dimension;
[0029] Determining, from the at least one first-category CPU usage data, first-category CPU usage data corresponding to each of the threads according to the thread identifier in each of the first-category CPU usage data;
[0030] Determine CPU usage characterization data corresponding to each of the threads according to the first type of CPU usage data corresponding to each of the threads;
[0031] The CPU usage characterization data corresponding to the target application is determined according to the CPU usage characterization data corresponding to the at least one thread.
[0032] In one possible implementation, the at least one thread includes a plurality of sub-threads;
[0033] Before determining the CPU usage characterization data corresponding to the target application based on the CPU usage characterization data corresponding to the at least one thread, the method further includes:
[0034] reading second-category CPU usage data matching the target time period from a fourth storage space, wherein a data format of the second-category CPU usage data is different from a data format of the first-category CPU usage data, and the fourth storage space is used to record a state presented by the main thread of the target application in a CPU usage dimension;
[0035] Constructing CPU usage characterization data corresponding to the main thread according to the second type of CPU usage data;
[0036] The determining, based on the CPU usage characterization data corresponding to the at least one thread, the CPU usage characterization data corresponding to the target application includes:
[0037] The CPU usage characterization data corresponding to the target application is determined according to the CPU usage characterization data corresponding to the main thread and the CPU usage characterization data corresponding to the plurality of sub-threads.
[0038] In a possible implementation manner, after obtaining the added stack tree, the method further includes:
[0039] Based on the added stack tree, determine the abnormal function and the abnormal characterization data of the abnormal function, wherein the abnormal characterization data includes an abnormal confidence and / or an abnormal attribution rate; the abnormal attribution rate includes one or more of the function multi-dimensional time consumption attribution rate, the function CPU time consumption attribution rate and the function non-CPU time consumption attribution rate.
[0040] In a possible implementation, the target time period is determined according to the time when the application program is unresponsive (ANR) occurs;
[0041] or,
[0042] The target time period is determined according to a startup time period of the target application.
[0043] The present application provides a data processing device, comprising:
[0044] An acquisition unit is used to acquire a stack tree of a target application and data to be added corresponding to the target application; the stack tree is used to describe the state of the target application in the application function call dimension within a target time period, and the stack tree carries timestamp information; the data to be added is used to describe the state of the target application in at least one dimension to be supplemented within the target time period, and each dimension to be supplemented is different from the application function call dimension; the data to be added carries timestamp information;
[0045] An adding unit is used to add the data to be added to the stack tree according to the timestamp alignment result between the data to be added and the stack tree, so as to obtain the added stack tree; the added stack tree is used to describe the state presented by the target application in multiple dimensions, and the multiple dimensions include the application function call dimension and the at least one dimension to be supplemented.
[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 executes the data processing 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 processing 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 processing 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 a target application, a stack tree of the target application and data to be added corresponding to the target application are first obtained, so that the stack tree is used to describe the state of the target application in the application function call dimension within the target time period, and the data to be added is used to describe the state of the target application in at least one dimension to be supplemented (for example, the system function call dimension and / or the CPU usage dimension) within the target time period, and each dimension to be supplemented is different from the application function call dimension; then, based on the timestamp alignment result between the data to be added and the stack tree, the data to be added is added to the stack tree to obtain the added stack tree, so that the added stack tree can describe the state of the target application in multiple dimensions (for example, multiple dimensions such as the application function call dimension, the system function call dimension and the CPU usage dimension) within the target time period, so that the stack tree can better represent the state of the target application within the target time period, which is conducive to improving the acquisition effect of relevant data of the target application. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] 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.
[0054] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0055] Figure 2 A schematic diagram of two data formats of tracking data provided in an embodiment of the present application;
[0056] Figure 3 A schematic diagram of a storage method of tracking data provided in an embodiment of the present application;
[0057] Figure 4 A schematic diagram of an application scenario of a stack tree provided in an embodiment of the present application;
[0058] Figure 5 A schematic diagram of two data formats of CPU usage data provided in an embodiment of the present application;
[0059] Figure 6 An example diagram of timestamp alignment provided in an embodiment of the present application;
[0060] Figure 7 A schematic diagram of an abnormal function attribution analysis provided in an embodiment of the present application;
[0061] Figure 8 A schematic diagram of an abnormal function analysis provided in an embodiment of the present application;
[0062] Fig. 9 A schematic diagram of a stack tree merging process provided in an embodiment of the present application;
[0063] Fig.10 An example diagram of a function time-consuming attribution analysis provided in an embodiment of the present application;
[0064] Fig.11 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0065] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] To facilitate understanding, some technical terms involved in this application are explained below.
[0067] Tracing data, namely trace data, refers to the data (such as stack data) obtained by tracing the process of an application (Application, App), so that the tracing data records some status information involved in the process (such as function call information, etc.).
[0068] 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.).
[0069] An application function, also known as a business code, refers to a function compiled in advance for an App so that the application function assists in realizing a certain function of the App; and this application does not limit the application function.
[0070] A system function refers to a function that exists in the operating system and needs to be called when an APP is running; and this application does not limit the system function. For example, it may include a lock function, a communication (Binder) function, and an input / output (IO) function.
[0071] Based on the above technical terms, the technical solutions provided by this application are introduced below.
[0072] 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.
[0073] In order to better understand the technical solution provided by this application, the data processing method provided by this application is described below with reference to some drawings. Figure 1 As shown, the data processing method provided in the embodiment of the present application includes the following S1-S2. Figure 1 A flowchart of a data processing method provided in an embodiment of the present application.
[0074] S1: Obtain a stack tree of a target application and data to be added corresponding to the target application; the stack tree is used to describe the state of the target application in the application function call dimension within a target time period, and the stack tree carries timestamp information; the data to be added is used to describe the state of the target application in at least one dimension to be supplemented within the target time period, and each dimension to be supplemented is different from the application function call dimension; the data to be added carries timestamp information.
[0075] Among them, the target application refers to an application that needs to perform data processing (for example, building a stack tree for recording multi-dimensional information or performing performance evaluation); and this application does not limit the implementation method of the target application. For example, in some application scenarios, the target application may refer to an application that needs to perform performance evaluation processing when ANR occurs (for example, an application that causes ANR or an application that occupies more central processing units (CPU) when ANR occurs). For another example, in some application scenarios (for example, scenarios where performance evaluation processing needs to be performed on certain applications when the applications are started), the target application may refer to an application that is in the startup state.
[0076] The stack tree of the target application is used to describe the state of the target application in the application function call dimension during the target time period, so that the "stack tree of the target application" can represent the function call status of the target application for the application function during the target time period. The application function refers to a function pre-compiled for the target application, so that the application function assists in realizing a certain function of the target application.
[0077] The target time period refers to the time period required for reference when processing data for the target application; and the present application does not limit the target time period, for example, the target time period can be specified in advance by the user. For another example, in some application scenarios, the target time period can be determined according to the time when the ANR occurs (for example, the target time period can refer to the time period of [ANR occurrence time-ANR stage duration, ANR occurrence time]), so that the data required for analyzing the cause of the ANR can be obtained based on the target time period. Among them, the ANR stage duration can be set in advance according to the application scenario (for example, the ANR stage duration can be 10 seconds). For another example, in some application scenarios, the target time period can be determined according to the startup time period of the target application (for example, the target time period can refer to the time period of [the start time of the startup of the target application, the startup completion time of the target application]), so that the data required for analyzing the startup performance of the target application can be obtained based on the target time period. Among them, the startup time period is used to describe the time when the target application is in the startup phase; and this application does not limit the startup time period. For example, the startup time period can be the time period of [the startup start time of the target application, the startup completion time of the target application].
[0078] In addition, for the above-mentioned "stack tree of the target application", the stack tree of the target application carries timestamp information, so that the timestamp information can describe the application function call status presented by the target application at different times, so that it can be subsequently aligned with other data information (for example, the data to be added below) based on the timestamp information.
[0079] In addition, the present application does not limit the implementation method of the above "stack tree of the target application". For example, it can be implemented by any existing or future stack tree, so that the "stack tree of the target application" can represent the running state of the target application in the target time period. For another example, the "stack tree of the target application" can include multiple nodes, and one node can be used to record the tracking data collected for a certain application function, so that the node can represent the call status of the target application for the application function in the target time period.
[0080] In addition, the present application does not limit the acquisition process of the above-mentioned "stack tree of the target application". For example, it can be implemented by any existing or future method that can acquire the stack tree of an application within a certain time period.
[0081] In fact, in some application scenarios, in order to ensure the collection effect of tracing data (for example, real-time, etc.), the business code involved in the target application can be instrumented in advance, so that the trace data generated by each thread calling the application function can be collected and stored in real time during the operation of the target application, so that the stored trace data can be used to build the stack tree of the target application later.
[0082] In addition, in order to better reduce the memory consumption required for storing trace data, the present application also provides a data storage method for trace data, which can be specifically: storing the trace data involved in all threads in the target application in the same data format (for example, Figure 2 The data format shown 2) cross storage (similar to Figure 3 The storage method shown in the figure) is stored in the same storage space, so that the storage space is used to cross-record the states presented by all threads in the target application under the application function call dimension. It should be noted that the present application does not limit the implementation method of the storage space. For example, it can be implemented using any existing or future storage device with data storage function (for example, an unlocked ring buffer).
[0083] Based on the storage method shown in the previous paragraph, it can be known that in a possible implementation manner, the acquisition process of the above “stack tree of the target application” may include the following steps 11 to 14.
[0084] Step 11: Read at least one first type of tracing data matching the target time period from a first storage space, where the first storage space is used to cross-record the state of at least one thread in the target application in the application function call dimension.
[0085] The first storage space is used to cross-store trace data of different threads in a first data format.
[0086] The first data format refers to the data format required for cross-storage of trace data of different threads (for example, Figure 2 The data format shown in 2).
[0087] In addition, for the first data format described above, the first data format contains at least a thread identifier (eg, Figure 2 The present application does not limit the implementation of the first data format. For example, in some application scenarios, the first data format may include a function status identification bit (for example, Figure 2 The "Flag" flag shown), function flags (for example, Figure 2 The "Method ID" shown in the figure), thread ID (for example, Figure 2 The "Thread ID" shown in the figure) and the timestamp (for example, Figure 2 The timestamp "Diff Time" shown in the figure). The function state identification bit is used to indicate the state of the called application function. The function identification bit is used to uniquely identify the called application function. The thread identification bit is used to uniquely identify which thread called the application function. The timestamp is used to indicate the time when the application function was called.
[0088] It should be noted that the present application does not limit the implementation methods of "Flag", "Method ID", "Thread ID" and "Diff Time" in the above paragraph. For example, in some application scenarios (for example, only focusing on the start or end of the called function, etc.), the following Table 1 (that is, Figure 2 For example, in other application scenarios (for example, scenarios where attention needs to be paid to the start, end, and other states of the called function), the following Table 2 may be used for implementation.
[0089] The "first type of tracing data" mentioned above refers to the trace data stored in the first storage space mentioned above and matching the target time period; and the first type of tracing data at least carries the thread identifier corresponding to the trace data. In addition, this application does not limit the implementation method of the first type of tracing data. For example, the first type of tracing data can adopt the first data format mentioned above (for example, Figure 2 It can be seen that in a possible implementation, the data format of the first type of tracing data may include a function state identification bit, a function identification bit, a thread identification bit and a timestamp, so that the function state identification bit is used to indicate the state of the application function involved in the trace data, the function identification bit is used to indicate the application function involved in the trace data, the thread identification bit is used to indicate the thread involved in the trace data, and the timestamp is used to indicate the timestamp of the trace data (for example, the acquisition time or the occurrence time, etc.).
[0090] It should be noted that the present application does not limit the implementation method of "matching the target time period" in the above paragraph. For example, for a trace data stored in the first storage space above, if the time represented by the timestamp of the trace data is within the target time period, it can be determined that the trace data matches the target time period.
[0091]
[0092] Table 1 A possible implementation of two data formats of trace data
[0093]
[0094] Table 2 Another possible implementation of two data formats of trace data
[0095] Based on the relevant content of step 11 above, it can be known that in some application scenarios, when the first storage space above is used to cross-record the status of all threads in the target application (for example, the main thread + all child threads) in the application function call dimension, at least one first-category tracking data matching the target time period can be read from the first storage space, so that these first-category tracking data can represent the call status of the application function by one or more threads in the target application within the target time period.
[0096] Step 12: According to the thread identifier in each first-category tracing data, determine the first-category tracing data corresponding to each thread from the above at least one first-category tracing data.
[0097] In the present application, after reading at least one first-category tracing data matching the target time period from the first storage space, these first-category tracing data can be grouped according to the thread identifiers in these first-category tracing data to obtain the first-category tracing data corresponding to each thread, so that all first-category tracing data corresponding to any thread can represent the thread's call to the application function within the target time period.
[0098] Step 13: Construct a stack tree corresponding to each thread based on the first type of tracking data corresponding to each thread.
[0099] In the present application, for any thread, after obtaining the first type of tracing data corresponding to the thread, a stack tree corresponding to the thread can be constructed based on the first type of tracing data corresponding to the thread, so that the stack tree corresponding to the thread can represent the association relationship (e.g., parent-child relationship, etc.) between the application functions called by the thread within the target time period. For example, when the first type of tracing data corresponding to the thread includes information such as function A_begin, function B_begin, function C_begin, function C_end, function B_end, and function A_end, the stack tree corresponding to the thread can be represented as A->B->C.
[0100] Step 14: Determine a stack tree of the target application according to the stack tree corresponding to at least one thread.
[0101] It should be noted that the present application does not limit the implementation method of step 14. For example, it can be implemented by using any existing or future method that can build a stack tree of an application based on stack trees corresponding to multiple threads. For another example, step 14 can specifically be: determining the stack tree of the target application based on the stack tree corresponding to at least one thread, so that the stack tree of the target application can include the stack tree corresponding to the at least one thread.
[0102] Based on the relevant contents of steps 11 to 14 above, it can be known that in some application scenarios, the trace data of all threads of the target application can be pre-formatted according to a preset first data format (for example, Figure 2 The data format 2) shown is cross-stored in a first storage space (eg, an unlocked circular buffer) so that the stack tree of the target application can be constructed later using the trace data matching the target time period read from the first storage space.
[0103] In fact, for an application, in order to better ensure the running effect of the main thread of the application, the trace data of the main thread can be stored separately to avoid defects caused by cross-storing the trace data of the main thread and the trace data of all sub-threads in the same storage space. Based on this, the present application also provides another possible implementation of the acquisition process of the above "stack tree of the target application", which can specifically include the following steps 21-26.
[0104] Step 21: Read at least one first type of tracking data matching the target time period from a first storage space, where the first storage space is used to cross-record states of multiple sub-threads in the target application in the application function call dimension.
[0105] In this application, when the first storage space is used to cross-record all sub-threads in the target application (for example, Figure 3 When the states of sub-threads 1, 2 and 3 shown in the figure are presented under the application function call dimension, at least one first-category tracing data matching the target time period can be read from the first storage space, so that these first-category tracing data can represent the calling status of the application function by one or more sub-threads in the target application within the target time period.
[0106] Step 22: According to the thread identifier in each first-category tracing data, determine the first-category tracing data corresponding to each sub-thread from the above at least one first-category tracing data.
[0107] In the present application, after reading at least one first-category tracing data matching the target time period from the first storage space, these first-category tracing data can be grouped according to the thread identifiers in these first-category tracing data to obtain the first-category tracing data corresponding to each sub-thread, so that all first-category tracing data corresponding to any sub-thread can represent the calling status of the sub-thread for the application function within the target time period.
[0108] Step 23: Construct a stack tree corresponding to each sub-thread according to the first type of tracking data corresponding to each sub-thread.
[0109] In the present application, for any child thread, after obtaining the first type of tracing data corresponding to the child thread, a stack tree corresponding to the child thread can be constructed based on the first type of tracing data corresponding to the child thread, so that the stack tree corresponding to the child thread can represent the association relationship (for example, parent-child relationship, etc.) between the application functions called by the child thread within the target time period.
[0110] Step 24: Read the second type of tracing data matching the target time period from the second storage space. The data format of the second type of tracing data is different from the data format of the first type of tracing data mentioned above. The second storage space is used to record the state of the main thread in the target application in the application function call dimension.
[0111] The second storage space is used to store the trace data of the main thread in a second data format.
[0112] The second data format refers to the data format required to store the trace data of a thread separately (for example, Figure 2 The data format shown in 1).
[0113] In addition, for the second data format described above, there is no thread identifier in the second data format, so that the data format of the second type of tracing data described above is different from the data format of the first type of tracing data described above, which is conducive to better improving the storage space utilization effect; and the present application does not limit the implementation method of the second data format. For example, in some application scenarios, the second data format may include a function state identifier (for example, Figure 2 "Flag" as shown), function identifiers (for example, Figure 2 "Method ID" as shown) and timestamp (e.g. Figure 2 The function status flag is used to indicate the state of the called application function. The function identifier is used to uniquely identify the called application function. The timestamp is used to indicate the time when the application function is called.
[0114] It should be noted that the present application does not limit the implementation methods of “Flag”, “Method ID” and “Diff Time” in the above paragraph. For example, they can be implemented in the manner shown in Table 1 or Table 2 above.
[0115] The "second type of tracing data" mentioned above refers to the trace data stored in the second storage space mentioned above and matching the target time period; and the second type of tracing data does not carry the thread identifier corresponding to the trace data, which is conducive to better improving the storage space utilization effect. In addition, this application does not limit the implementation method of the second type of tracing data. For example, the second type of tracing data can adopt the second data format mentioned above (for example, Figure 2It can be seen that in a possible implementation, the data format of the second type of tracing data may include a function state identification bit, a function identification bit and a timestamp, so that the function state identification bit is used to indicate the state of the application function involved in the trace data, the function identification bit is used to indicate the application function involved in the trace data, and the timestamp is used to indicate the timestamp of the trace data (for example, the acquisition time or the occurrence time, etc.).
[0116] Based on the relevant content of step 24 above, it can be known that in some application scenarios, when the second storage space above is used to separately record the status of the main thread in the target application under the application function call dimension, at least one second type of tracking data matching the target time period can be read from the second storage space, so that these second type of tracking data can represent the calling status of the main thread in the target application for the application function within the target time period.
[0117] It should be noted that the present application does not limit the execution time of step 24, as long as the execution time of step 24 is ensured to be earlier than the execution time of step 25 below.
[0118] Step 25: Based on the second type of tracking data above, build the stack tree corresponding to the main thread.
[0119] In the present application, for the main thread in the target application described above, after reading the second type of tracking data matching the target time period from the second storage space, a stack tree corresponding to the main thread can be constructed directly based on the second type of tracking data, so that the stack tree corresponding to the main thread can represent the association relationship (for example, parent-child relationship, etc.) between the application functions called by the main thread within the target time period.
[0120] It should be noted that the present application does not limit the execution time of step 25, as long as the execution time of step 25 is ensured to be earlier than the execution time of step 26 below.
[0121] Step 26: Determine the stack tree of the target application according to the stack tree corresponding to the main thread and the stack trees corresponding to the plurality of sub-threads.
[0122] It should be noted that the present application does not limit the implementation method of step 26. For example, it can be implemented by using any existing or future method that can build a stack tree of an application based on stack trees corresponding to multiple threads. For another example, step 26 can specifically be: based on the stack tree corresponding to the main thread and the stack trees corresponding to the multiple child threads, determine the stack tree of the target application, so that the stack tree of the target application includes the stack tree corresponding to the main thread and the stack trees corresponding to the multiple child threads.
[0123] Based on the relevant contents of steps 21 to 26 above, it can be known that in some application scenarios, the trace data of the main thread of the target application can be pre-formatted according to a preset second data format (for example, Figure 2 The data format 1 shown in the figure is stored separately in the second storage space (for example, an unlocked circular buffer), and the trace data of all child threads of the target application are pre-set in the first data format (for example, Figure 2 The data format 2) shown is cross-stored in the first storage space (for example, another unlocked circular buffer) so that the stack tree of the target application can be constructed using the trace data matching the target time period read from the first storage space and the second storage space. This saves memory space without affecting the execution effect of the main thread.
[0124] Based on the above relevant content of "Stack Tree of Target Application", it can be known that in one possible implementation, the "Stack Tree of Target Application" can be constructed based on the trace data cross-stored for all threads in a storage space, so that the "Stack Tree of Target Application" can represent the application function call status presented by all threads in the target application during the target time period. In another possible implementation, the "Stack Tree of Target Application" can be constructed based on the trace data stored separately for the main thread in a storage space and the trace data cross-stored for all sub-threads in another storage space, so that the "Stack Tree of Target Application" can represent the application function call status presented by all threads in the target application during the target time period.
[0125] It should be noted that, for the target application mentioned above, the method for obtaining the trace data of each thread in the target application can be specifically: during compilation, the business code involved in the target application can be instrumented, so that the trace data of each thread in the target application can be collected in real time during the subsequent operation of the target application, and the collected trace data can be stored in a corresponding storage space in a certain data format.
[0126] The data to be added is used to describe the state of the target application in at least one dimension to be supplemented during the target time period, so that the data to be added can represent some other data (such as lock data, Binder data, IO data, CPU time consumption, etc.) that need to be referenced when processing data for the target application. Among them, the dimension to be supplemented refers to the dimension that needs to be referenced when completing information processing for the stack tree of the target application, and because each dimension to be supplemented is different from the above application function call dimension, the data to be added can describe the state of the target application in some dimensions other than the application function call dimension during the target time period.
[0127] In addition, the present application does not limit the at least one dimension to be supplemented above. For example, the at least one dimension to be supplemented may refer to some dimensions that are pre-set based on actual application scenarios. For example, in some application scenarios, the at least one dimension to be supplemented may include a system function call dimension and / or a CPU usage dimension. Among them, the system function call dimension is used to describe the call of an application to certain system functions. The CPU usage dimension is used to describe the use of the CPU by an application (for example, usage time, usage duration, etc.).
[0128] In addition, for the data to be added above, the data to be added carries timestamp information so that the timestamp information can represent the state of the target application in at least one dimension to be supplemented in different time periods, so that the data to be added can be aligned with other data (for example, the stack tree above) based on the timestamp information.
[0129] In addition, the present application does not limit the implementation method of the above data to be added. For example, in some application scenarios, the above data to be added may include system-related data (for example, Figure 4 system-related data) and / or CPU usage characterization data (e.g., Figure 4 CPU usage characterization data shown).
[0130] The system-related data is used to describe the state of the target application in the system function call dimension within the target time period; and the present application does not limit the system-related data, for example, it may include at least one system function call data. Among them, the system function call data is used to describe the call status of the target application for a certain system function within the target time period. It should be noted that the present application does not limit the implementation method of the "at least one system function call data", for example, the "at least one system function call data" may include one or more of lock data, Binder data and IO data. Among them, the lock data is used to describe the call status of the target application for the lock function within the target time period; the Binder data is used to describe the call status of the target application for the Binder function within the target time period; the IO data is used to describe the call status of the target application for the IO function within the target time period. It should be noted that the present application does not limit the method for obtaining the system-related data.
[0131] The CPU usage characterization data is used to describe the state of the target application in the CPU usage dimension within the target time period; and the present application does not limit the implementation method of the CPU usage characterization data, for example, it may include at least one function using CPU timestamp and the function using CPU duration corresponding to each function using CPU timestamp. Figure 5 The "Diff Time" shown in the figure is used to indicate the time the called function uses the CPU. The function uses the CPU time corresponding to the CPU timestamp (for example, Figure 5 The “CPU Time” shown is used to indicate the length of time that the called function occupied the CPU during the time represented by the CPU timestamp used by the function.
[0132] In addition, the present application does not limit the method for obtaining the above CPU usage characterization data. For example, it can be implemented by using any existing or future method that can obtain the CPU usage of a function within a certain time period.
[0133] In fact, in some application scenarios, in order to ensure the detection effect of CPU usage data (for example, real-time), some functions that need to be called when the target application is running (for example, Looper message distribution start / end function, function that implements the Runnable interface run method and other application functions) can be pre-inserted so that the CPU usage data of these functions can be collected and stored in real time during the operation of the target application, so that the stored CPU usage data can be used to complete the information of the stack tree of the target application. Among them, the CPU usage data is used to describe the usage of the CPU (for example, usage time and usage duration, etc.). It should be noted that the present application does not limit the implementation method of the function that needs to be processed by CPU usage data detection. For example, it may include some pre-specified application functions (for example, Looper message distribution start / end function, function that implements the Runnable interface run method, etc.).
[0134] In addition, in order to better reduce the memory consumption required for storing CPU usage data, the present application also provides a data storage method, which can be specifically: storing the CPU usage data of all threads in the target application in the same data format (for example, Figure 5 The data format shown in 4) is cross-stored (similar to Figure 6 The storage method shown in the figure) is put into the same storage space, so that the storage space is used to cross-record the states presented by these threads in the CPU usage dimension.
[0135] Based on the storage method shown in the previous paragraph, it can be known that in a possible implementation manner, the acquisition process of the above “CPU usage characterization data” may include the following steps 31 to 34.
[0136] Step 31: read at least one first type of CPU usage data matching the target time period from a third storage space, where the third storage space is used to cross-record the state of at least one thread in the target application in the CPU usage dimension.
[0137] The third storage space is used to cross-store CPU usage data of different threads in a third data format.
[0138] The third data format refers to the data format required to be used when cross-storing CPU usage data for different threads (for example, Figure 5 The data format shown in 4).
[0139] In addition, for the third data format above, the third data format contains at least a thread identifier (eg, Figure 5The present application does not limit the implementation of the third data format. For example, in some application scenarios, the third data format may include a timestamp (for example, Figure 5 "Diff Time" shown), thread identifier (for example, Figure 5 The "Thread ID" shown) and CPU time (for example, Figure 5 The timestamp is used to indicate the CPU time used when a thread calls a function. The thread ID is used to uniquely identify which thread called the function. The CPU duration is used to indicate the CPU time consumed when the thread called the function.
[0140] It should be noted that the present application does not limit the implementation methods of “Diff Time”, “Thread ID” and “CPU Time” in the above paragraph. For example, they can be implemented using Table 3 below.
[0141]
[0142] Table 3 Figure 5 A possible implementation of the data format shown
[0143] The "first type of CPU usage data" mentioned above refers to the CPU usage data that has been stored in the third storage space mentioned above and matches the target time period; and the first type of CPU usage data at least carries the thread identifier corresponding to the CPU usage data. In addition, the present application does not limit the implementation method of the first type of CPU usage data. For example, the first type of CPU usage data can adopt the third data format mentioned above (for example, Figure 5 It can be seen that in a possible implementation, the data format of the first type of CPU usage data may include a timestamp, a thread identifier, and a CPU duration, so that the timestamp is used to indicate the time a certain thread uses the CPU when calling a certain function, the thread identifier is used to uniquely identify which thread has called the function, and the CPU duration is used to indicate the CPU time consumed when the thread calls the function.
[0144] It should be noted that the present application does not limit the implementation method of "matching the target time period" in the above paragraph. For example, for a CPU usage data stored in the third storage space above, if the time represented by the timestamp in the CPU usage data is within the target time period, it can be determined that the CPU usage data matches the target time period.
[0145] Based on the relevant content of step 31 above, it can be known that in some application scenarios, when the third storage space above is used to cross-record the status of all threads (for example, main thread + all sub-threads) in the target application under the CPU usage dimension, at least one first-category CPU usage data matching the target time period can be read from the third storage space, so that these first-category CPU usage data can represent the CPU usage of one or more threads in the target application within the target time period.
[0146] Step 32: According to the thread identifier in each first-category CPU usage data, determine the first-category CPU usage data corresponding to each thread from the above at least one first-category CPU usage data.
[0147] In the present application, after reading at least one first-category CPU usage data matching the target time period from the third storage space, these first-category CPU usage data can be grouped according to the thread identifiers in these first-category CPU usage data to obtain the first-category CPU usage data corresponding to each thread, so that all first-category CPU usage data corresponding to any thread can represent the CPU usage of the thread within the target time period.
[0148] Step 33: Determine CPU usage characterization data corresponding to each thread according to the first type of CPU usage data corresponding to each thread.
[0149] It should be noted that the present application does not limit the implementation method of step 33. For example, it can be specifically as follows: for any thread, after obtaining the first-category CPU usage data corresponding to the thread, all the first-category CPU usage data corresponding to the thread can be aggregated (or arranged in chronological order according to timestamps) to obtain the CPU usage characterization data corresponding to the thread, so that the CPU usage characterization data corresponding to the thread can represent the CPU usage of the thread within the target time period.
[0150] Step 34: Determine the CPU usage characterization data corresponding to the target application according to the CPU usage characterization data corresponding to at least one thread.
[0151] It should be noted that the present application does not limit the implementation method of step 34. For example, it can be implemented by any existing or future method that can construct CPU usage characterization data corresponding to an application based on CPU usage characterization data corresponding to multiple threads. For another example, step 34 can specifically be: based on the CPU usage characterization data corresponding to at least one thread, determine the CPU usage characterization data corresponding to the target application, so that the CPU usage characterization data corresponding to the target application includes the CPU usage characterization data corresponding to the at least one thread.
[0152] Based on the relevant contents of steps 31 to 34 above, it can be known that in some application scenarios, the CPU usage data of all threads of the target application can be pre-formatted according to a preset third data format (for example, Figure 5 The data format 4) shown is cross-stored in a third storage space (e.g., an unlocked circular buffer) so that the CPU usage data matching the target time period read from the third storage space can be used to construct the CPU usage characterization data corresponding to the target application.
[0153] In fact, for an application, in order to better ensure the running effect of the main thread of the application, the CPU usage data of the main thread can be stored independently to avoid the defects caused by cross-storing the CPU usage data of the main thread and the CPU usage data of all sub-threads in the same storage space. Based on this, the present application also provides another possible implementation of the acquisition process of the above "CPU usage characterization data corresponding to the target application", which can specifically include the following steps 41 to 46.
[0154] Step 41: read at least one first type of CPU usage data matching the target time period from a third storage space, where the third storage space is used to cross-record states of multiple sub-threads in the target application in a CPU usage dimension.
[0155] In the present application, when the third storage space above is used to cross-record the status of all sub-threads in the target application in the CPU usage dimension, at least one first-category CPU usage data matching the target time period can be read from the third storage space, so that these first-category CPU usage data can represent the CPU usage of all sub-threads in the target application within the target time period.
[0156] Step 42: According to the thread identifier in each first-category CPU usage data, determine the first-category CPU usage data corresponding to each sub-thread from the above at least one first-category CPU usage data.
[0157] In the present application, after reading at least one first-category CPU usage data matching the target time period from the third storage space, these first-category CPU usage data can be grouped according to the thread identifiers in these first-category CPU usage data to obtain the first-category CPU usage data corresponding to each sub-thread, so that all the first-category CPU usage data corresponding to any sub-thread can represent the CPU usage of the sub-thread within the target time period.
[0158] Step 43: Determine the CPU usage characterization data corresponding to each sub-thread according to the first type of CPU usage data corresponding to each sub-thread.
[0159] It should be noted that the present application does not limit the implementation method of step 43. For example, it can be specifically as follows: for any child thread, after obtaining the first-category CPU usage data corresponding to the child thread, all the first-category CPU usage data corresponding to the child thread can be aggregated (or arranged in chronological order according to timestamps) to obtain the CPU usage characterization data corresponding to the child thread, so that the CPU usage characterization data corresponding to the child thread can represent the CPU usage of the child thread within the target time period.
[0160] Step 44: Read the second type of CPU usage data matching the target time period from the fourth storage space, wherein the data format of the second type of CPU usage data is different from the data format of the first type of CPU usage data described above, and the fourth storage space is used to record the status of the main thread in the target application in the CPU usage dimension.
[0161] The fourth storage space is used to separately store the CPU usage data of the main thread in a fourth data format.
[0162] The fourth data format refers to the data format required to be used when the CPU usage data of the main thread is stored separately (for example, Figure 5 The data format shown in 3).
[0163] In addition, for the fourth data format described above, there is no thread identifier in the fourth data format, so that the data format of the second type of CPU usage data described above is different from the data format of the first type of CPU usage data described above, which is conducive to better improving the storage space utilization effect; and the present application does not limit the implementation method of the fourth data format. For example, in some application scenarios, the fourth data format may include a timestamp (for example, Figure 5 The "Diff Time" shown) and CPU time (for example, Figure 5 The timestamp is used to indicate the time a thread occupies the CPU when calling a function. The CPU duration is used to indicate the CPU time consumed when a thread calls the function.
[0164] It should be noted that the present application does not limit the implementation methods of “Diff Time” and “CPU Time” in the above paragraph. For example, they can be implemented using Table 3 above.
[0165] The above "second type of CPU usage data" refers to the CPU usage data that has been stored in the fourth storage space and matches the target time period; and the second type of CPU usage data does not carry the thread identifier corresponding to the CPU usage data, which is conducive to better improving the storage space utilization effect. In addition, this application does not limit the implementation method of the second type of CPU usage data. For example, the second type of CPU usage data can adopt the fourth data format above (for example, Figure 5 It can be seen that in one possible implementation, the second type of CPU uses the data format of the data (for example, Figure 5 The data format 3) shown may include a timestamp and a CPU duration, so that the timestamp is used to indicate the CPU time occupied when a certain thread calls a certain function, and the CPU duration is used to indicate the CPU time consumed when a certain thread calls the function.
[0166] Based on the relevant content of step 44 above, it can be known that in some application scenarios, when the fourth storage space above is used to separately record the status of the main thread in the target application under the CPU usage dimension, the second type of CPU usage data matching the target time period can be read from the fourth storage space, so that the second type of CPU usage data can represent the CPU usage of the main thread in the target application within the target time period.
[0167] It should be noted that the present application does not limit the execution time of step 44 , as long as the execution time of step 44 is ensured to be earlier than the execution time of step 45 below.
[0168] Step 45: Determine the CPU usage characterization data corresponding to the main thread according to the second type of CPU usage data.
[0169] It should be noted that the present application does not limit the implementation method of step 43. For example, it can be specifically as follows: after reading all the second-category CPU usage data that matches the target time period from the fourth storage space, all the second-category CPU usage data can be aggregated (or arranged in chronological order according to timestamps) to obtain the CPU usage characterization data corresponding to the main thread, so that the CPU usage characterization data corresponding to the main thread can represent the CPU usage of the main thread within the target time period.
[0170] It should also be noted that the present application does not limit the execution time of step 45 , as long as the execution time of step 45 is ensured to be earlier than the execution time of step 46 below.
[0171] Step 46: Determine the CPU usage characterization data corresponding to the target application according to the CPU usage characterization data corresponding to the main thread and the CPU usage characterization data corresponding to the plurality of sub-threads.
[0172] It should be noted that the present application does not limit the implementation method of step 46. For example, it can be implemented by any existing or future method that can construct CPU usage characterization data corresponding to an application based on CPU usage characterization data corresponding to multiple threads. For another example, step 46 can specifically be: based on the CPU usage characterization data corresponding to the main thread and the CPU usage characterization data corresponding to multiple sub-threads, determine the CPU usage characterization data corresponding to the target application, so that the CPU usage characterization data corresponding to the target application includes the CPU usage characterization data corresponding to the main thread and the CPU usage characterization data corresponding to the multiple sub-threads.
[0173] Based on the above steps 41 to 46, it can be known that in some application scenarios, the CPU usage data of the main thread of the target application can be pre-formatted according to a preset fourth data format (for example, Figure 5 The data format 3 shown in the figure is stored separately in a fourth storage space (for example, an unlocked circular buffer), and the CPU usage data of all sub-threads of the target application are stored in advance according to a preset third data format (for example, Figure 5 The data format 4) shown is cross-stored in a third storage space (for example, another unlocked circular buffer) so that the CPU usage data matching the target time period read from the third storage space and the fourth storage space can be used to determine the CPU usage characterization data corresponding to the target application. This saves memory space without affecting the execution effect of the main thread.
[0174] It should be noted that, for the target application mentioned above, the CPU usage data of each thread in the target application (for example, timestamp and its corresponding CPU time) can be obtained specifically as follows: during compilation, certain key functions in the business code involved in the target application (for example, Looper message distribution start / end function, function that implements the run method of the Runnable interface, etc.) can be instrumented so that the CPU usage data of each thread in the target application can be collected in real time during the subsequent running of the target application, and the collected CPU usage data can be stored in a corresponding storage space in a certain data format.
[0175] Based on the relevant content of S1 above, it can be known that in some application scenarios (for example, ANR occurrence scenarios or application startup scenarios), if you want to perform performance evaluation on a certain application, you can first use pre-stored data to determine the stack tree of the application and the data to be added corresponding to the application, so that you can then use the data to be added to complete the information on the stack tree, so that the completed stack tree can more comprehensively describe the running status of the application.
[0176] S2: adding the data to be added to the stack tree according to the timestamp alignment result between the data to be added and the stack tree to obtain the added stack tree; the added stack tree is used to describe the state presented by the target application in multiple dimensions, wherein the multiple dimensions include an application function call dimension and at least one dimension to be supplemented.
[0177] The timestamp alignment result is used to indicate which node in the "stack tree of the target application" corresponds to each item in the data to be added. For example, when the data to be added includes CPU usage characterization data, and the CPU usage characterization data is based on Figure 6 When the stored data in the circular buffer is determined, the timestamp alignment result between the data to be added and the stack tree may include Figure 6 The alignment result is shown.
[0178] In addition, the present application does not limit the process of determining the above timestamp alignment result.
[0179] In addition, the present application does not limit the implementation method of S2 above. For example, in a multi-threaded application scenario, S2 may specifically be: adding the data to be added to the stack tree according to the timestamp alignment result between the data to be added and the stack tree and the thread alignment result.
[0180] Based on the above content, it can be known that in a possible implementation mode, for any function in the data to be added above, a CPU timestamp (for example, Figure 2For example, if the thread corresponding to the CPU timestamp used by the function is the same as the thread corresponding to a node in the stack tree of the target application above (for example, the thread identifier corresponding to the CPU timestamp used by the function is the same as the thread identifier in a node in the stack tree of the target application), and the CPU timestamp used by the function matches the timestamp of the node (for example, the time described by the CPU timestamp used by the function is within the function execution time period described by the timestamp of the node), it can be determined that the function described by the CPU timestamp used by the function is the same function as the function represented by the node, so the CPU usage data including the CPU timestamp used by the function can be aligned with the node, so that the CPU usage data including the CPU timestamp used by the function can be used later. Use data to update the relevant content of the node (for example, node attributes); similarly, for any system function call data present in the data to be added, if the thread corresponding to the system function call data is the same as the thread corresponding to a node in the stack tree of the target application (for example, the thread identifier in the system function call data is the same as the thread identifier in a node in the stack tree of the target application), and the timestamp in the system function call data matches the timestamp of the node (for example, the time described by the timestamp in the system function call data is within the function execution time period described by the timestamp of the node), then the system function call data can be aligned with the node so that the system function call data can be used to update the relevant content of the node (for example, child nodes) subsequently.
[0181] In addition, the present application does not limit the implementation method of "adding the data to be added to the stack tree" in S2 above.
[0182] In fact, since a CPU usage data is used to describe the CPU usage presented when a thread calls a function (for example, an application function), so that the CPU usage data can be used to represent the state presented when a function is called, the CPU usage data can be regarded as a certain attribute of the function and added to the above stack tree. Based on this, the present application also provides an implementation method of a completion processing process of the above stack tree. Under this implementation method, when the above data to be added includes CPU usage characterization data, and the CPU usage characterization data includes at least one function using CPU timestamp and the function using CPU duration corresponding to each function using CPU timestamp, the completion processing process of the stack tree (that is, the determination process of the stack tree after the above addition) can at least include the following step 51.
[0183] Step 51: For any function using the CPU timestamp, if the timestamp alignment result above indicates that the CPU timestamp used by the function matches the timestamp of the first node in the stack tree above, then the node attributes of the first node are updated using the CPU usage duration of the function corresponding to the CPU timestamp used by the function, so that the stack tree added above includes the node attributes of the updated first node.
[0184] The first node refers to a node existing in the stack tree above, whose timestamp matches the CPU timestamp used by the function above.
[0185] The node attributes of the first node are used to describe the state of the application function represented by the first node; and the node attributes of the first node may at least include trace data of the application function.
[0186] Based on the relevant content of step 51 above, it can be known that in some application scenarios (for example, multi-threading), when the data to be added above includes CPU usage characterization data, and the CPU usage characterization data includes at least one function using CPU timestamp and the function using CPU duration corresponding to each function using CPU timestamp, for any function using CPU timestamp, if the thread identifier corresponding to the function using CPU timestamp is the same as the thread identifier of the first node in the stack tree above, and the function using CPU timestamp matches the timestamp of the first node, it can be determined that the function described by the function using CPU timestamp is the same function as the function described by the first node. Therefore, the function using CPU duration corresponding to the function using CPU timestamp can be directly used to update the node attributes of the first node, so that the node attributes after the update are newly added with the attribute of "function using CPU duration", so that the first node after the attribute update can not only describe the calling situation of the function, but also describe the CPU time consumed when the function is executed, which is conducive to improving the comprehensiveness of the information of the stack tree.
[0187] In fact, since a system function call data can usually be used to indicate which system function is needed to implement a function during a thread calling an application function, so that the system function described by the system function call data can be regarded as a sub-function that can be called by an application function, so that there is a parent-child relationship between the system function described by the system function call data and the application function, the system function call data can be added as a new node to the above stack tree. Based on this, the present application also provides an implementation method of a completion processing process of the above stack tree. Under this implementation method, when the above data to be added includes system-related data, and the system-related data includes at least one system function call data, the completion processing process of the stack tree (that is, the determination process of the stack tree after the above addition) can at least include the following step 61.
[0188] Step 61: For any system function call data, if the above timestamp alignment result indicates that the timestamp in the system function call data matches the timestamp of the second node in the above stack tree, then a new child node is created for the second node in the stack tree so that the stack tree added above includes the new child node, and the node attributes of the child node are determined according to the system function call data.
[0189] The second node refers to a node existing in the stack tree above, whose timestamp matches the timestamp in the system function call data above.
[0190] Based on the relevant content of step 61 above, it can be known that in some application scenarios (for example, multi-threading), when the data to be added above includes system-related data, and the system-related data includes at least one system function call data, for any system function call data, if the thread identifier in the system function call data is the same as the thread identifier of the second node in the stack tree above, and the timestamp in the system function call data matches the timestamp of the second node, it can be determined that the system function described by the system function call data was called during the execution of the application function represented by the second node, and thus it can be determined that the system function described by the system function call data can be regarded as a sub-function of the application function represented by the second node, so a new child node can be directly created for the second node in the stack tree, and the node attributes of the new child node can be determined using the system function call data, so that the new child node can represent the system function described by the system function call data, so that the stack tree after the addition including the new child node can not only describe the calling relationship between different application functions, but also describe the calling relationship between these application functions and system functions, which is conducive to improving the comprehensiveness of the information of the stack tree.
[0191] Based on the relevant contents of S1 to S2 above, it can be known that for the data processing method provided in the embodiment of the present application, the stack tree of the target application and the data to be added corresponding to the target application are first obtained, so that the stack tree is used to describe the state of the target application in the application function call dimension during the target time period, and the data to be added is used to describe the state of the target application in at least one dimension to be supplemented (for example, the system function call dimension and / or the CPU usage dimension) during the target time period, and each dimension to be supplemented is different from the application function call dimension; then, based on the timestamp alignment result between the data to be added and the stack tree, the data to be added is added to the stack tree to obtain the added stack tree, so that the added stack tree can describe the state of the target application in multiple dimensions (for example, multiple dimensions such as the application function call dimension, the system function call dimension and the CPU usage dimension) during the target time period, so that the stack tree can better represent the state of the target application in the target time period, which is conducive to improving the acquisition effect of the relevant data of the target application.
[0192] In addition, the present application does not limit the execution subject of the data processing method. For example, any implementation of the data processing method provided in the embodiment of the present application can be applied to a device with a data processing function such as a terminal device or a server. For another example, any implementation of the data processing 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, etc. The server can be a stand-alone server, a cluster server or a cloud server.
[0193] In fact, in some application scenarios, after obtaining the stack tree with complete information, you can continue to use the stack tree to analyze some performance of the target application (for example, Figure 4 Based on this, the present application also provides another possible implementation of the above data processing method, in which the data processing method not only includes the above S1-S2, but also includes the following step 71. The execution time of step 71 is later than the execution time of S2.
[0194] Step 71: Determine the abnormal function and the abnormal characterization data of the abnormal function according to the stack tree added above.
[0195] Among them, an abnormal function refers to a function that meets a preset abnormal condition; and this application does not limit the preset abnormal condition. For example, the preset abnormal condition can be specifically: 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.
[0196] As an example, the above abnormal function determination process may be specifically as follows: firstly, the stack tree added above is merged (for example, Figure 7-Figure 9 The merged stack tree is obtained by performing the merging process shown in the figure, so that the functions represented by different nodes in the same layer of the merged stack tree are different; then, it is determined whether the time consumption of the function represented by the root node in the merged stack tree is greater than the preset time consumption threshold (for example, 5 seconds), so that when it is determined that the time consumption of the function represented by the root node is greater than the preset time consumption threshold, each node in the merged stack tree is traversed 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 an abnormal function; if not, the function represented by the root node is determined as an abnormal function. 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: the ratio between the time consumption of the function represented by a node and the time consumption of the function represented by the parent node of the node exceeds the preset ratio threshold (for example, 40%).
[0197] It should be noted that the present application does not limit the implementation method of the "merging process" in the above paragraph. For example, it can specifically be: merging all nodes representing the same function in the same layer into one node (such as Fig. 9 shown).
[0198] 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.
[0199] The abnormality confidence is used to indicate the possibility that the abnormal function affects the performance of the target application mentioned above. Moreover, the present application does not limit the determination process of the abnormality confidence. For example, it can be implemented using the following formula (1).
[0200] Anomaly confidence = function duration of the abnormal function / duration of the target time period (1)
[0201] The function time consumption of an exception function refers to the time consumed when a thread calls the exception function.
[0202] It should be noted that for the above formula (1), for the ANR attribution scenario (for example, Fig.10In the scenario shown in FIG. 1 , the duration of the target time period mentioned above may refer to the duration of the ANR phase mentioned above (for example, Fig.10 For the application startup performance scenario, the duration of the target time period may refer to the duration of the startup time period described above.
[0203] The abnormal attribution rate is used to indicate the possibility that the abnormal function affects the performance of the target application 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, Fig.10 80% as shown), function CPU time attribution rate (for example, Fig.10 50% as shown) and the non-CPU time attribution of the function (for example, Fig.10 83.3% shown)).
[0204] The function multi-dimensional time consumption attribution rate is used to indicate the possibility that the abnormal function has an overall impact on the performance of the target application 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).
[0205] Function multi-dimensional time consumption attribution rate = (CPU object time consumption + non-CPU object time consumption) / abnormal function time consumption (2)
[0206] 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, Fig.10 The non-CPU object time consumption refers to the time consumed by executing certain non-CPU objects (for example, calling system functions) when the above exception function is running (for example, Fig.10 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 4 below.
[0207]
[0208] Table 4 A possible implementation of CPU objects and non-CPU objects
[0209] The function CPU time consumption attribution rate is used to indicate the possibility that the abnormal function affects the performance of the target application in the CPU dimension; and 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).
[0210] Function CPU time attribution rate = CPU object time / abnormal function CPU time (3)
[0211] In the formula, the CPU time consumed by an exception function refers to the CPU time consumed when a thread calls the exception function (for example, Fig.10 3 seconds shown).
[0212] The function non-CPU time consumption attribution rate is used to indicate the possibility that the abnormal function affects the performance of the target application 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).
[0213] Function non-CPU time consumption attribution rate = non-CPU object time consumption / abnormal function non-CPU time consumption (4)
[0214] In the formula, the non-CPU time consumed by an exception function refers to the non-CPU time consumed when a thread calls the exception function (for example, Fig.10 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.
[0215] Based on the relevant content of step 71 above, it can be known that in some application scenarios (for example, ANR attribution scenarios), for the target application, after obtaining the stack tree with information completion for the target application (that is, the "stack tree after addition" above), the 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 performance of the target application (for example, which functions caused the ANR) can be determined based on these abnormal functions and their abnormal characterization data. Among them, because the stack tree records not only trace data, but also system function calls and CPU usage, the stack tree can more comprehensively describe the running status of the target application, so that the content obtained based on the stack tree analysis (for example, abnormal functions and abnormal characterization data of the abnormal functions) is more accurate, which is conducive to improving the performance analysis effect for the target application.
[0216] Based on the data processing method provided in the embodiment of the present application, the embodiment of the present application also provides a data processing device. Fig.11 Explain and illustrate. Fig.11 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. It should be noted that for the technical details of the data processing device provided in an embodiment of the present application, please refer to the relevant content of the data processing method above.
[0217] like Fig.11As shown, the data processing device 1100 provided in the embodiment of the present application includes:
[0218] The acquisition unit 1101 is used to acquire a stack tree of a target application and data to be added corresponding to the target application; the stack tree is used to describe the state of the target application in the application function call dimension within a target time period, and the stack tree carries timestamp information; the data to be added is used to describe the state of the target application in at least one dimension to be supplemented within the target time period, and each dimension to be supplemented is different from the application function call dimension; the data to be added carries timestamp information;
[0219] The adding unit 1102 is used to add the data to be added to the stack tree according to the timestamp alignment result between the data to be added and the stack tree, so as to obtain the added stack tree; the added stack tree is used to describe the state presented by the target application in multiple dimensions, and the multiple dimensions include the application function call dimension and the at least one dimension to be supplemented.
[0220] In one possible implementation, the data to be added includes system-related data and / or central processing unit CPU usage characterization data, wherein the system-related data is used to describe the state of the target application in the system function call dimension within the target time period; and the CPU usage characterization data is used to describe the state of the target application in the CPU usage dimension within the target time period.
[0221] In a possible implementation manner, the data to be added includes the CPU usage characterization data; the CPU usage characterization data includes at least one function using a CPU timestamp and a function using a CPU duration corresponding to each function using a CPU timestamp;
[0222] The adding unit 1102 includes:
[0223] The first adding sub-unit is used to use the CPU timestamp of any of the functions. If the timestamp alignment result indicates that the CPU timestamp used by the function matches the timestamp of the first node in the stack tree, the node attribute of the first node is updated by using the CPU usage time of the function corresponding to the CPU timestamp used by the function.
[0224] In a possible implementation manner, the data to be added includes the system-related data; the system-related data includes at least one system function call data;
[0225] The adding unit 1102 includes:
[0226] The second adding sub-unit is used to create a new child node for any system function call data if the timestamp alignment result indicates that the timestamp in the system function call data matches the timestamp of the second node in the stack tree, and the node attributes of the child node are determined according to the system function call data.
[0227] In a possible implementation manner, the acquiring unit 1101 includes:
[0228] A first reading subunit is used to read at least one first type of tracing data matching the target time period from a first storage space, wherein the first storage space is used to cross-record a state presented by at least one thread in the target application in an application function call dimension;
[0229] A first determining subunit, configured to determine, according to the thread identifier in each of the first-type tracing data, the first-type tracing data corresponding to each of the threads from the at least one first-type tracing data;
[0230] A first construction subunit is used to construct a stack tree corresponding to each of the threads according to the first type of tracking data corresponding to each of the threads;
[0231] The second determining subunit is configured to determine the stack tree of the target application according to the stack tree corresponding to the at least one thread.
[0232] In one possible implementation, the at least one thread includes a plurality of sub-threads;
[0233] The acquisition unit 1101 further includes:
[0234] a second reading subunit, configured to read second-type tracing data matching the target time period from a second storage space, wherein a data format of the second-type tracing data is different from a data format of the first-type tracing data, and the second storage space is configured to record a state presented by a main thread in the target application in an application function call dimension;
[0235] A second construction subunit is used to construct a stack tree corresponding to the main thread according to the second type of tracking data;
[0236] The second determining subunit is specifically configured to determine the stack tree of the target application according to the stack tree corresponding to the main thread and the stack trees corresponding to the plurality of sub-threads.
[0237] In a possible implementation manner, the acquiring unit 1101 includes:
[0238] a third reading subunit, configured to read at least one first type of CPU usage data matching the target time period from a third storage space, wherein the third storage space is used to cross-record a state presented by at least one thread in the target application under a CPU usage dimension;
[0239] a third determining subunit, configured to determine, according to the thread identifier in each of the first-category CPU usage data, the first-category CPU usage data corresponding to each of the threads from the at least one first-category CPU usage data;
[0240] A fourth determining subunit, configured to determine the CPU usage characterization data corresponding to each of the threads according to the first type of CPU usage data corresponding to each of the threads;
[0241] The fifth determining subunit is configured to determine the CPU usage characterization data corresponding to the target application according to the CPU usage characterization data corresponding to the at least one thread.
[0242] In one possible implementation, the at least one thread includes a plurality of sub-threads;
[0243] The acquisition unit 1101 further includes:
[0244] a fourth reading subunit, configured to read second-category CPU usage data matching the target time period from a fourth storage space, wherein a data format of the second-category CPU usage data is different from a data format of the first-category CPU usage data, and the fourth storage space is configured to record a state presented by a main thread in the target application in a CPU usage dimension;
[0245] a sixth determining subunit, configured to determine CPU usage characterization data corresponding to the main thread according to the second type of CPU usage data;
[0246] The fifth determining subunit is specifically configured to determine the CPU usage characterization data corresponding to the target application according to the CPU usage characterization data corresponding to the main thread and the CPU usage characterization data corresponding to the plurality of sub-threads.
[0247] In a possible implementation manner, the data processing device 1100 further includes:
[0248] A determination unit is used to determine the abnormal function and the abnormal characterization data of the abnormal function according to the added stack tree, wherein the abnormal characterization data includes an abnormal confidence and / or an abnormal attribution rate; the abnormal attribution rate includes one or more of the function multi-dimensional time consumption attribution rate, the function CPU time consumption attribution rate and the function non-CPU time consumption attribution rate.
[0249] In a possible implementation, the target time period is determined according to the time when the application program is unresponsive (ANR) occurs;
[0250] or,
[0251] The target time period is determined according to a startup time period of the target application.
[0252] Based on the relevant content of the above-mentioned data processing device 1100, it can be known that for the data processing device 1100 provided in the present application, the stack tree of the target application and the data to be added corresponding to the target application are first obtained, so that the stack tree is used to describe the state of the target application in the application function call dimension during the target time period, and the data to be added is used to describe the state of the target application in at least one dimension to be supplemented (for example, the system function call dimension and / or the CPU usage dimension) during the target time period, and each dimension to be supplemented is different from the application function call dimension; then, based on the timestamp alignment result between the data to be added and the stack tree, the data to be added is added to the stack tree to obtain the added stack tree, so that the added stack tree can describe the state of the target application in multiple dimensions (for example, multiple dimensions such as the application function call dimension, the system function call dimension and the CPU usage dimension) during the target time period, so that the stack tree can better represent the state of the target application in the target time period, which is conducive to improving the acquisition effect of the relevant data of the target application.
[0253] 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 processing method provided in the embodiment of the present application.
[0254] See also Fig.12 , which shows a schematic diagram of the structure of an electronic device 1200 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. Fig.12 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.
[0255] like Fig.12As shown, the electronic device 1200 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage device 1208 to a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the electronic device 1200 are also stored. The processing device 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0256] Typically, the following devices may be connected to the I / O interface 1205: an input device 1206 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 1207 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209. The communication device 1209 may allow the electronic device 1200 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.12 The electronic device 1200 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.
[0257] 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 1209, or installed from the storage device 1208, or installed from the ROM 1202. When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0258] 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.
[0259] 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 processing method provided in the embodiment of the present application.
[0260] 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.
[0261] 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.
[0262] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0263] 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.
[0264] 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).
[0265] 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.
[0266] 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.
[0267] 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.
[0268] 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.
[0269] 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.
[0270] 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.
[0271] 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.
[0272] 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.
[0273] 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 processing method, It is characterized in that The method comprises: Obtain a stack tree of a target application and data to be added corresponding to the target application; the stack tree is used to describe the state of the target application in the application function call dimension within a target time period, and the stack tree carries timestamp information; the data to be added is used to describe the state of the target application in at least one dimension to be supplemented within the target time period, and each dimension to be supplemented is different from the application function call dimension; the data to be added carries timestamp information; According to the timestamp alignment result between the data to be added and the stack tree, the data to be added is added to the stack tree to obtain the added stack tree; the added stack tree is used to describe the state of the target application in multiple dimensions, and the multiple dimensions include the application function call dimension and the at least one dimension to be supplemented.
2. The method according to claim 1, It is characterized in that The data to be added includes system-related data and / or central processing unit CPU usage characterization data, wherein the system-related data is used to describe the state of the target application in the system function call dimension within the target time period; the CPU usage characterization data is used to describe the state of the target application in the CPU usage dimension within the target time period.
3. The method according to claim 2, It is characterized in that The data to be added includes the CPU usage characterization data; the CPU usage characterization data includes at least one function using CPU timestamp and the function using CPU duration corresponding to each function using CPU timestamp; The step of adding the data to be added to the stack tree comprises: For any of the functions using the CPU timestamp, if the timestamp alignment result indicates that the function using the CPU timestamp matches the timestamp of the first node in the stack tree, the node attribute of the first node is updated using the function using CPU duration corresponding to the function using the CPU timestamp.
4. The method according to claim 2, It is characterized in that The data to be added includes the system-related data; the system-related data includes at least one system function call data; The step of adding the data to be added to the stack tree comprises: For any system function call data, if the timestamp alignment result indicates that the timestamp in the system function call data matches the timestamp of the second node in the stack tree, a new child node is created for the second node in the stack tree, and the node attributes of the child node are determined based on the system function call data.
5. The method according to claim 1, It is characterized in that The process of acquiring the stack tree of the target application includes: Reading at least one first type of tracing data matching the target time period from a first storage space, wherein the first storage space is used to cross-record a state presented by at least one thread in the target application in an application function call dimension; Determining, according to the thread identifier in each of the first-category tracing data, the first-category tracing data corresponding to each of the threads from the at least one first-category tracing data; Constructing a stack tree corresponding to each of the threads according to the first type of tracking data corresponding to each of the threads; The stack tree of the target application is determined according to the stack tree corresponding to the at least one thread.
6. The method according to claim 5, It is characterized in that The at least one thread includes a plurality of sub-threads; Before determining the stack tree of the target application according to the stack tree corresponding to the at least one thread, the method further includes: reading second-type tracing data matching the target time period from a second storage space, wherein a data format of the second-type tracing data is different from a data format of the first-type tracing data, and the second storage space is used to record a state presented by a main thread in the target application in an application function call dimension; Constructing a stack tree corresponding to the main thread according to the second type of tracking data; The determining the stack tree of the target application according to the stack tree corresponding to the at least one thread includes: The stack tree of the target application is determined according to the stack tree corresponding to the main thread and the stack trees corresponding to the plurality of sub-threads.
7. The method according to claim 2, It is characterized in that The CPU uses a process of acquiring characterization data, including: Reading at least one first type of CPU usage data matching the target time period from a third storage space, wherein the third storage space is used to cross-record a state presented by at least one thread in the target application under a CPU usage dimension; Determining, from the at least one first-category CPU usage data, first-category CPU usage data corresponding to each of the threads according to the thread identifier in each of the first-category CPU usage data; Determine CPU usage characterization data corresponding to each of the threads according to the first type of CPU usage data corresponding to each of the threads; The CPU usage characterization data corresponding to the target application is determined according to the CPU usage characterization data corresponding to the at least one thread.
8. The method according to claim 7, It is characterized in that The at least one thread includes a plurality of sub-threads; Before determining the CPU usage characterization data corresponding to the target application based on the CPU usage characterization data corresponding to the at least one thread, the method further includes: reading second-category CPU usage data matching the target time period from a fourth storage space, wherein a data format of the second-category CPU usage data is different from a data format of the first-category CPU usage data, and the fourth storage space is used to record a state presented by the main thread of the target application in a CPU usage dimension; Determine CPU usage characterization data corresponding to the main thread according to the second type of CPU usage data; The determining, based on the CPU usage characterization data corresponding to the at least one thread, the CPU usage characterization data corresponding to the target application includes: The CPU usage characterization data corresponding to the target application is determined according to the CPU usage characterization data corresponding to the main thread and the CPU usage characterization data corresponding to the plurality of sub-threads.
9. The method according to claim 1, It is characterized in that After obtaining the added stack tree, the method further includes: Based on the added stack tree, determine the abnormal function and the abnormal characterization data of the abnormal function, wherein the abnormal characterization data includes an abnormal confidence and / or an abnormal attribution rate; the abnormal attribution rate includes one or more of the function multi-dimensional time consumption attribution rate, the function CPU time consumption attribution rate and the function non-CPU time consumption attribution rate.
10. The method according to claim 1, It is characterized in that The target time period is determined according to the time when the application program is unresponsive (ANR) occurs; or, The target time period is determined according to a startup time period of the target application.
11. A data processing device, It is characterized in that include: An acquisition unit, used for acquiring a stack tree of a target application and data to be added corresponding to the target application; The stack tree is used to describe the state of the target application in the application function call dimension within the target time period, and the stack tree carries timestamp information; the data to be added is used to describe the state of the target application in at least one to-be-supplemented dimension within the target time period, and each to-be-supplemented dimension is different from the application function call dimension; The data to be added carries timestamp information; an adding unit, configured to add the data to be added to the stack tree according to a result of alignment of timestamps between the data to be added and the stack tree, to obtain the stack tree after addition; The added stack tree is used to describe the state of the target application in multiple dimensions, where the multiple dimensions include the application function call dimension and the at least one dimension to be supplemented.
12. An electronic device, It is 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 10.
13. A computer readable medium, It is 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 10.
