A method, device, equipment and storage medium for collecting jam log information
By aggregating the call stack of the main thread on the mobile side and symbolizing and clustering the stuttering log files on the server side, the problem of low analysis efficiency caused by excessive stuttering log information in mobile applications is solved, and a more efficient analysis of the cause of stuttering is achieved.
Patent Information
- Application Number
- CN202110156794.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-04
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-02-04
AI Technical Summary
With the increase in mobile application users, more and more information on stutter logs has led to a decrease in efficiency when analyzing the causes of stuttering.
The call stack of the main thread is obtained at the mobile terminal according to the set acquisition time interval and aggregated it. Detect whether the main thread has a stuttering event according to the detection interval, and save the aggregate call stack as a stuttering log file and upload it to the server when the stuttering event occurs. The server symbolizes and clusters the received stutter log files.
The verboseness of the lagging log is reduced through aggregation processing, simplifies the reading and positioning of the log, reduces the time cost of lagging analysis, and improves the efficiency of lagging cause analysis. Symbolization and clustering processing further reduces the situation of repeated reading and improves analysis efficiency.
Smart Images

Figure CN112860469B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing technology, and in particular to a method, device, equipment and storage medium for collecting jamming log information. Background Art
[0002] The lag of mobile applications is an important factor that affects the user experience of the application. During the lag, the application cannot respond to the user's operations, causing the user's click operations to be kept waiting, affecting the user experience.
[0003] In order to locate the cause of the jam, it is necessary to record and upload jam log information when the jam occurs. The most important part of the jam log information is the stack information of the main thread. Developers can determine the cause of the jam based on the stack information. However, as the number of application users increases, the jam log information increases. If developers are asked to check the jam log information one by one, the efficiency of jam cause analysis will decrease. Summary of the invention
[0004] The embodiments of the present application provide a method, device, equipment and storage medium for collecting jam log information to improve the efficiency of jam cause analysis.
[0005] In a first aspect, an embodiment of the present application provides a method for collecting jam log information, which is applied to a mobile terminal and includes:
[0006] Acquire the call stack of the main thread according to the set collection time interval, and aggregate the call stack of the main thread to obtain an aggregated call stack;
[0007] According to a set detection time interval, detecting whether a jam event occurs in the main thread, and in response to a jam event occurring in the main thread, saving the aggregate call stack as a jam log file, wherein the detection time interval is greater than the collection time interval;
[0008] The jam log file is uploaded to a server, and the server performs symbolization and clustering processing on the jam log file.
[0009] In a second aspect, an embodiment of the present application provides a method for collecting jam log information, which is applied to a server and includes:
[0010] Determine an aggregate call stack in a plurality of jam log files uploaded by a mobile terminal, and symbolize the aggregate call stack, wherein the aggregate call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jam log file when a jam event occurs in the main thread, and the stack code recorded in the aggregate call stack includes a system library stack code and a software stack code;
[0011] Determine the system library stack code in the aggregate call stack, and filter out the system library stack code related to the jamming in the system library stack code;
[0012] Based on the filtered system library stack code and the software stack code, clustering processing is performed on the plurality of jam log files.
[0013] In a third aspect, an embodiment of the present application provides a device for collecting jam log information, which is applied to a mobile terminal and includes a stack collection module, a jam detection module, and a log upload module, wherein:
[0014] The stack acquisition module is used to obtain the call stack of the main thread according to the set acquisition time interval, and aggregate the call stack of the main thread to obtain an aggregated call stack;
[0015] The jam detection module is used to detect whether a jam event occurs in the main thread according to a set detection time interval, and in response to a jam event occurring in the main thread, save the aggregate call stack as a jam log file, wherein the detection time interval is greater than the collection time interval;
[0016] The log uploading module is used to upload the jam log file to the server, and the server performs symbolization and clustering processing on the jam log file.
[0017] In a fourth aspect, an embodiment of the present application provides a device for collecting jam log information, which is applied to a server and includes a symbolization processing module, a stack screening module, and a log clustering module, wherein:
[0018] The symbolization processing module is used to determine the aggregate call stack in the multiple jam log files uploaded by the mobile terminal, and symbolize the aggregate call stack, the aggregate call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jam log file when a jam event occurs in the main thread, and the stack code recorded by the aggregate call stack includes a system library stack code and a software stack code;
[0019] The stack screening module is used to determine the system library stack code in the aggregate call stack, and screen out the system library stack code related to the jamming in the system library stack code;
[0020] The log clustering module is used to cluster the plurality of jam log files based on the screened system library stack code and the software stack code.
[0021] In a fifth aspect, an embodiment of the present application provides a device for collecting jamming log information, including: a memory and one or more processors;
[0022] The memory is used to store one or more programs;
[0023] When the one or more programs are executed by the one or more processors, the one or more processors implement the jam log information collection method as described in the first aspect.
[0024] In a sixth aspect, an embodiment of the present application provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the jam log information collection method as described in the first aspect.
[0025] The embodiment of the present application obtains the aggregate call stack of the main thread at the mobile terminal according to the collection time interval, and aggregates the aggregate call stack. At the same time, it detects whether a jam event occurs in the main thread according to the detection time interval, and saves the aggregate call stack collected during this period as a jam log file when a jam event occurs, and uploads it to the server. The server symbolizes and clusters the received jam log file. In the jam log file collection stage, the same aggregate call stack is aggregated together through aggregation processing, which reduces the situation where the jam log finally generated is too lengthy, makes the jam log file easier to read, and facilitates the location of the jam cause. In addition, by symbolizing and clustering each jam log file, the situation of repeated reading of the jam log file is reduced, the time cost of jam analysis is reduced, and the efficiency of jam cause analysis is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flow chart of a method for collecting jamming log information applied to a mobile terminal provided in an embodiment of the present application;
[0027] Figure 2 It is a flow chart of a method for collecting jamming log information applied to a server provided in an embodiment of the present application;
[0028] Figure 3 It is a flowchart of another method for collecting jam log information applied to a server provided in an embodiment of the present application;
[0029] Figure 4 It is a structural schematic diagram of a jam log information collection device applied to a mobile terminal provided in an embodiment of the present application;
[0030] Figure 5 It is a structural schematic diagram of a jam log information collection device applied to a server provided in an embodiment of the present application;
[0031] Figure 6 It is a structural schematic diagram of a jam log information collection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0033] Figure 1 A flowchart of a method for collecting jamming log information applied to a mobile terminal provided in an embodiment of the present application is given. The method for collecting jamming log information provided in an embodiment of the present application can be executed by a jamming log information collection device applied to a mobile terminal. The jamming log information collection device can be implemented in hardware and software and integrated in the jamming log information collection device.
[0034] The following description is made by taking the jam log information collection device executing the jam log information collection method as an example. Figure 1 , the method for collecting the jam log information includes:
[0035] S101: acquiring a call stack of a main thread according to a set collection time interval, and performing aggregation processing on the call stack of the main thread to obtain an aggregated call stack.
[0036] Exemplarily, at every set collection time interval (eg, 0.3s), the call stack of the main thread of the software program is obtained, wherein the call stack of the main thread is recorded in the form of a memory address, which is the address corresponding to the function called by the main thread.
[0037] Furthermore, within a detection time interval, the call stacks of the main thread are aggregated to aggregate the call stacks with the same memory address of the main thread to obtain an aggregated call stack, thereby reducing the situation where the subsequently generated jam log is too lengthy and improving the readability of the jam log file.
[0038] Specifically, the method provided in this embodiment obtains the call stack of the main thread according to the set collection time interval, and aggregates the call stack of the main thread to obtain an aggregated call stack, including steps S1011-S1012:
[0039] S1011: According to the set collection time interval, the call stack of the main thread is obtained from the register by detecting the child thread.
[0040] Specifically, after the main thread of the application is started, a detection sub-thread that resides in the background is started at the same time. The detection sub-thread is used to obtain the call stack of the main thread from the register according to the set collection time interval, and to detect whether a freeze event occurs in the main thread according to the set detection time interval in step S102.
[0041] Furthermore, the detection child thread obtains the call stack of the main thread from the register according to the set collection time interval. More specifically, the call stack of the main thread is recursively obtained from the fp register, that is, the memory address in the call stack of the main thread is found in the fp register, the caller address is determined according to the memory address, the caller address corresponding to the main thread is determined, and then the remaining memory addresses are found one by one according to the caller address. These memory addresses are the memory addresses corresponding to the call stack of the main thread, so as to obtain the call stack corresponding to the main thread in the current collection time period.
[0042] S1012: Based on the memory address corresponding to the call stack of the main thread, aggregate the call stack of the main thread, and record the number of occurrences of the memory address to obtain an aggregated call stack.
[0043] Specifically, after obtaining the call stack of the main thread each time, the call stacks of the main threads currently collected are aggregated, that is, the same memory addresses in the call stacks of these main threads are integrated, and the number of occurrences of these memory addresses in the call stacks of these main threads is recorded, so as to obtain an aggregated call stack that records the memory addresses and the number of occurrences of each memory address in the detection period corresponding to the current detection time interval.
[0044] S102: Detect whether a jam event occurs in the main thread according to a set detection time interval, and save the aggregate call stack as a jam log file in response to a jam event occurring in the main thread, wherein the detection time interval is greater than the collection time interval.
[0045] The detection time interval provided in this embodiment is greater than the collection time interval. For example, the detection time interval is set to 3s and the collection time interval is set to 0.3s. Then, within the detection cycle corresponding to one detection time interval, a total of 10 call stacks of the main thread are collected, and 10 corresponding aggregated call stacks are obtained.
[0046] Exemplarily, according to the set detection time interval, it is detected whether a freeze event occurs in the main thread. If no freeze event occurs, the currently collected aggregate call stack is deleted, and the process returns to step S101 to continue collecting the call stack of the main thread.
[0047] Furthermore, if a freeze event is detected in the main thread, the currently collected aggregated call stack is saved as a freeze log file in response to the freeze event, and the freeze log file is saved, waiting to be uploaded to the server, and the next collection of the main thread's call stack and the detection of freeze events are continued.
[0048] It is understandable that the memory address recorded in each generated jam log file will only appear once, and the number of occurrences of each memory address is recorded. According to the number of occurrences, the number of occurrences of each memory address in the corresponding detection cycle can be determined, which effectively reduces the data redundancy of the jam log file and is conducive to the reading of the jam log file.
[0049] Specifically, the present embodiment provides the method of detecting whether a freeze event occurs in the main thread according to a set detection time interval, including steps S1021-S1022:
[0050] S1021: Sending a test data packet to the main thread through the detection sub-thread according to the set detection time interval.
[0051] S1022: Determine whether a freeze event occurs in the main thread according to whether the main thread responds based on the test data packet.
[0052] Specifically, the detection main thread sends a test data packet to the main thread according to the set detection time interval and waits for the main thread's reply. If the main thread does not experience a freeze event, the main thread will reply to the detection sub-thread after receiving the test data packet.
[0053] Furthermore, if a reply from the main thread is received within the set waiting time, it is determined that no jamming event has occurred in the main thread; if no reply from the main thread is received within the set waiting time, it is determined that a jamming event has occurred in the main thread.
[0054] The embodiment of the present application sends a test data packet to the main thread by detecting that the sub-thread pings the main thread. If the main thread cannot respond to the ping message within a detection time interval, it is considered that a freeze event occurs in the main thread.
[0055] In one possible embodiment, the detection of whether a freeze event has occurred in the main thread can also be performed based on monitoring the refresh rate of the mobile screen, that is, when the refresh rate is lower than the set refresh rate threshold, the main thread is considered to have a freeze event; it can also be performed by the thread management tool runloop, that is, when the runloop cannot respond to external operations to continuously set the detection time threshold, the main thread is considered to have a freeze event.
[0056] S103: Upload the jam log file to the server, and the server performs symbolization and clustering processing on the jam log file.
[0057] Exemplarily, the above-saved jam log files are uploaded to the server according to the set upload time or in response to the server's log acquisition notification. The server symbolizes and clusters these jam log files to improve the readability of the jam log files, and classifies the jam log files corresponding to the same type of jam together, which is conducive to quickly discovering the cause of the jam, marking the jam processing status, reducing repeated checks on the jam, and reducing the time cost of checking the jam.
[0058] Optionally, before uploading the jam log files to the server, the jam log files to be uploaded are packaged and compressed to reduce the consumption of traffic data.
[0059] In the above, the aggregate call stack of the main thread is obtained at the mobile terminal according to the collection time interval, and the aggregate call stack is aggregated, and at the same time, whether a jam event occurs in the main thread is detected according to the detection time interval, and when a jam event occurs, the aggregate call stack collected during this period is saved as a jam log file, and uploaded to the server, and the server symbolizes and clusters the received jam log file. In the jam log file collection stage, the same aggregate call stack is aggregated together through aggregation processing, which reduces the situation where the jam log finally generated is too lengthy, making the jam log file easier to read and facilitating the location of the jam cause. In addition, by symbolizing and clustering each jam log file, the repeated reading of the jam log file is reduced, the time cost of jam analysis is reduced, and the efficiency of jam cause analysis is effectively improved.
[0060] Figure 2 A flowchart of a method for collecting jamming log information applied to a server provided in an embodiment of the present application is given. The method for collecting jamming log information provided in an embodiment of the present application can be executed by a jamming log information collection device applied to the server. The jamming log information collection device can be implemented in hardware and software and integrated in the jamming log information collection device.
[0061] The following description is made by taking the jam log information collection device executing the jam log information collection method as an example. Figure 2 , the method for collecting the jam log information includes:
[0062] S201: Determine an aggregate call stack in a plurality of jam log files uploaded by a mobile terminal, and symbolize the aggregate call stack.
[0063] Among them, the aggregate call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jam log file when a jam event occurs in the main thread. The stack code recorded by the aggregate call stack includes system library stack code and software stack code.
[0064] The jam log file provided in this embodiment is obtained by uploading each mobile terminal. The mobile terminal collects and aggregates the call stack of the main thread to obtain an aggregated call stack, and saves it as a jam log file when a jam event occurs in the main thread. The mobile terminal can refer to the above embodiment for the collection of call stacks, the detection of jam events, and the uploading of jam log files, which will not be repeated in this embodiment.
[0065] The stack code of the aggregated call stack record provided in this embodiment includes a system library stack code and a software stack code. The system library stack code corresponds to the memory address corresponding to the function when the mobile terminal system itself calls the function, and the software stack code corresponds to the memory address corresponding to the function when the main thread of the software program calls the function.
[0066] Exemplarily, the aggregate call stack recorded by multiple jam log files uploaded by each mobile terminal is determined, each stack code recorded in each aggregate call stack is determined, and these stack codes are symbolized, so as to use function representation symbols to replace the memory address recorded in the aggregate call stack to achieve symbolization of the aggregate call stack. It can be understood that by symbolizing the aggregate call stack, the readability of the jam log file can be effectively improved, which is convenient for developers to quickly locate the cause of the jam and improve the efficiency of jam analysis.
[0067] S202: Determine the system library stack code in the aggregate call stack, and filter out the system library stack code related to the jamming in the system library stack code.
[0068] Exemplarily, after the aggregate call stack is symbolized, for each jam log file, the system library stack code and software stack code recorded in the aggregate call stack are determined, and the jam-related system library stack code is filtered out from the system library stack code. These filtered out system library stack codes will be used for subsequent clustering processing of the jam log files.
[0069] S203: Based on the screened system library stack code and the software stack code, cluster the plurality of jam log files.
[0070] Exemplarily, after determining the system library stack code filtered out by each jam log file, these jam log files are clustered based on these system library stack codes and software stack codes, so that the jam log files corresponding to the same type of jam cause are classified into the same cluster category.
[0071] After completing the clustering process of the jam log files, different cluster categories are obtained. One cluster category corresponds to one or more jam log files, and the jam causes corresponding to multiple jam log files under one cluster category are the same or similar.
[0072] Furthermore, the jam log files can be classified and saved or displayed according to different clustering categories of clustering processing. In response to the selection of a clustering category, all the jam log files under the corresponding clustering category can be displayed. Developers can analyze the causes of jams based on the jam logs.
[0073] It can be understood that when clustering the jam log files in this embodiment, since the non-jamming related system library stack codes are not the cause of the jam events, after excluding these system library stack codes, the accuracy of clustering the jam log files is effectively improved.
[0074] It needs to be explained that when filtering the system library stack code, the filtered non-stuttering related system library stack code is not deleted. It is just that the filtered system library stack code is not considered for clustering processing. When viewing the stuttering log file, the complete aggregated call stack can be viewed.
[0075] In a possible embodiment, after the developer completes the analysis of a type of jam log files, the jam log files of this type can be marked to reduce repeated analysis of the same type of jam log files.
[0076] In the above, the aggregate call stack of the main thread is obtained at the mobile terminal according to the collection time interval, and the aggregate call stack is aggregated, and at the same time, whether a jam event occurs in the main thread is detected according to the detection time interval, and when a jam event occurs, the aggregate call stack collected during this period is saved as a jam log file, and uploaded to the server, and the server symbolizes and clusters the received jam log file. In the jam log file collection stage, the same aggregate call stack is aggregated together through aggregation processing, which reduces the situation where the jam log finally generated is too lengthy, making the jam log file easier to read and facilitating the location of the jam cause. In addition, by symbolizing and clustering each jam log file, the repeated reading of the jam log file is reduced, the time cost of jam analysis is reduced, and the efficiency of jam cause analysis is effectively improved.
[0077] Based on the above embodiments, Figure 3 A flowchart of another method for collecting jam log information applied to a server provided in an embodiment of the present application is given. The method for collecting jam log information applied to a server is a specific implementation of the above method for collecting jam log information applied to a server. Figure 3 , the method for collecting the jam log information includes:
[0078] S301: Determine an aggregate call stack in a jam log file uploaded by a mobile terminal, wherein the aggregate call stack is represented in the form of a memory address, and the aggregate call stack records the number of occurrences of each memory address.
[0079] Among them, the aggregate call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jam log file when a jam event occurs in the main thread. The stack code recorded by the aggregate call stack includes system library stack code and software stack code.
[0080] Specifically, an aggregate call stack in the jam log file uploaded by each mobile terminal is determined, wherein the unsymbolized aggregate call stack is represented in the form of a memory address, and the aggregate call stack records the number of occurrences of each memory address.
[0081] S302: Symbolize the aggregate call stack according to the correspondence between the memory address and the function representation symbol recorded in the set symbol table, so as to represent the aggregate call stack in the form of the function representation symbol.
[0082] Among them, the symbol table records the correspondence between memory addresses and function representation symbols, such as the dSYM file provided by the iOS platform (generally called a symbol table or symbol file). According to the dSYM file, the memory address in the call stack can be converted into a function representation symbol, for example, the memory address can be converted into a symbol corresponding to the function, variable and the corresponding file name in the application.
[0083] Specifically, according to the correspondence between the memory address recorded in the set symbol table and the function representation symbol, the memory address recorded in each aggregate call stack is replaced with the corresponding function representation symbol, so as to symbolize each aggregate call stack, and represent the aggregate call stack in the form of function representation symbols, thereby improving the readability of the jam log file, and recording the corresponding number of occurrences of each function representation symbol in the symbolized aggregate call stack.
[0084] S303: Determine the system library stack code in the aggregate call stack according to the function representation symbol corresponding to the aggregate call stack, where the system library stack code includes a user interface system library stack code and a non-user interface system library stack code.
[0085] It should be explained that, in the symbolized aggregate call stack, a function representation symbol and its corresponding number of occurrences correspond to a line of stack code. The stack code includes system library stack code and software stack code, and the system library stack code provided in this embodiment includes user interface system library stack code and non-user interface system library stack code.
[0086] In a possible embodiment, the correspondence between the software stack code, the user interface system library stack code, the non-user interface system library stack code and the function representation symbol is pre-recorded in the server. For example, the system library stack code corresponding to the dispatch field can be determined as the user interface system library stack code, and the system library stack code corresponding to the fields such as libsystem_, libobjc.A.dylib, libsystem_malloc.dylib, etc. can be determined as the non-user interface system library stack code.
[0087] Specifically, after the aggregate call stack is symbolized, the system library stack code and the software stack code in each aggregate call stack are determined according to the function representation symbol corresponding to each line of stack code in the aggregate call stack.
[0088] S304: Filter out non-user interface system library stack codes from the system library stack codes.
[0089] In general, the non-user interface system library stack code that appears in the aggregate call stack is not related to the cause of the lag. For example, the non-user interface system library stack code corresponding to dispatch only performs related operations of task dispatch. If the non-user interface system library stack code is used as a clustering condition, it will not have a positive effect on locating the cause of the lag.
[0090] Specifically, after determining the user interface system library stack code and the non-user interface system library stack code in the system library stack code, the non-user interface system library stack code is screened out and is not included in the consideration of clustering processing.
[0091] S305: Filter out the user interface system library stack codes whose occurrence times reach a set threshold in the system library stack codes.
[0092] Specifically, determine the number of occurrences corresponding to each system library stack code, filter out the user interface system library stack codes whose occurrences reach a set threshold, add these user interface system library stack codes to the consideration of clustering processing, and filter out the user interface system library stack codes whose occurrences do not reach the set threshold.
[0093] For example, set the detection time interval to 3s, the collection time interval to 0.3s, and the number threshold to 5 times. Then, in the collection cycle corresponding to one collection time interval, the memory address corresponding to the user interface system library stack code will be included in the clustering processing consideration only if it appears 5 times. That is, the user interface system library stack code will be included in the clustering processing consideration only if the total time or number of occurrences reaches 50%.
[0094] This embodiment will filter out the user interface system library stack code whose number of occurrences does not reach the set threshold, increase the proportion of software stack code in clustering processing, emphasize the importance of the software program's own code in clustering, and be more conducive to analyzing the cause of the software program's own freeze.
[0095] S306: Determine a clustering key value of the jam log file based on the filtered system library stack code and the software stack code.
[0096] After the system library stack code is screened, the clustering key value of the jam log file is further determined based on the screened system library stack code and software stack code. Specifically, the determination of the clustering key value provided in this embodiment includes steps S3061-S3064:
[0097] S3061: For each of the jam log files, according to the set maximum number of acquisition lines, based on the screened system library stack code and the software stack code, stack code extraction is performed in the aggregate call stack.
[0098] Specifically, for each jam log file, according to the set maximum number of acquisition lines (for example, 5 lines), according to the order of each line of stack code in the corresponding aggregate call stack, based on the screened system library stack code and software stack code, stack code extraction is performed in the aggregate call stack. It can be understood that the extracted software stack code is the system library stack code and / or software stack code screened out by the jam log file, and the number of lines of the extracted stack code does not exceed the set maximum number of acquisition lines.
[0099] S3062: Determine whether the stack code is successfully extracted. If yes, jump to step S3063, otherwise jump to step S3064:
[0100] It can be understood that for each jam log file, when the jam log file records the user interface system library stack code or software stack code whose occurrence times reach the set threshold, the stack code can be successfully extracted and jump to step S3063.
[0101] When only non-user interface system library stack codes and / or user interface system library stack codes whose occurrence times do not reach the set threshold are recorded in the jam log file, stack code extraction fails and jumps to step S3064.
[0102] S3063: Use the extracted stack code as a clustering key value of the jam log file.
[0103] Specifically, for each jam log file, if the stack code is extracted successfully, the extracted stack code is directly used as the clustering key value of the jam log file.
[0104] S3064: Determine the clustering key value of the jam log file as the clustering key value corresponding to the environmental factor.
[0105] Specifically, for each jam log file, if the stack code extraction fails, a clustering key value corresponding to an environmental factor is assigned to the jam log file, wherein the environmental factor may be the temperature of the mobile terminal, the hardware performance of the mobile terminal, and the like.
[0106] S307: Clustering the plurality of the jam log files based on the clustering key value.
[0107] Specifically, after determining the clustering key value of each jam log file, clustering processing is performed on these jam log files based on the clustering key value, and jam log files with the same clustering key value are classified into the same cluster classification.
[0108] In a possible embodiment, when clustering the plurality of the jam log files based on the clustering key value, specifically: removing the number of occurrences corresponding to the aggregate call stack, and clustering the plurality of the jam log files based on the clustering key value.
[0109] It is understandable that for the same cause of lag, there may be a situation where the number of occurrences of the same memory address in different call stacks of the main thread is different due to system problems, or the number of occurrences of the same memory address in different call stacks of the collected main thread is inconsistent due to different collection starting time points of the call stacks of the main thread, but these call stacks of the main threads all correspond to the same type of lag.
[0110] When clustering the jam log files, this embodiment removes the number of occurrences corresponding to the aggregate call stack and does not include the number of occurrences in the clustering considerations, thereby reducing the situation where jam log files corresponding to the same jam cause are classified into different cluster categories.
[0111] In the above, the aggregate call stack of the main thread is obtained at the mobile terminal according to the collection time interval, and the aggregate call stack is aggregated, and at the same time, whether a jam event occurs in the main thread is detected according to the detection time interval, and when a jam event occurs, the aggregate call stack collected during this period is saved as a jam log file, and uploaded to the server, and the server symbolizes and clusters the received jam log file. In the jam log file collection stage, the same aggregate call stack is aggregated together through aggregation processing, which reduces the situation where the jam log finally generated is too lengthy, making the jam log file easier to read and facilitating the location of the jam cause. In addition, by symbolizing and clustering each jam log file, the repeated reading of the jam log file is reduced, the time cost of jam analysis is reduced, and the efficiency of jam cause analysis is effectively improved. At the same time, when clustering the jam log files, the non-user interface system library stack code, the user interface system library stack code whose occurrence times do not reach the set threshold, and the occurrence times of memory addresses are excluded from the consideration of clustering processing, reducing the impact of non-software program reasons on clustering processing, improving the accuracy of clustering processing, and effectively improving the efficiency of jam cause analysis. And through clustering key values, the jam log files corresponding to the same type of jam cause are clustered together, reducing the repeated analysis of the same jam cause and reducing the time cost of jam search and location.
[0112] In a possible embodiment, after clustering the plurality of the jam log files based on the clustering key value, the method further includes:
[0113] S308: Determine the hash value information corresponding to each of the jam log files in each cluster category after clustering processing.
[0114] S309: Clustering the jam log files corresponding to each clustering category based on the hash value information.
[0115] Specifically, for each clustering category after clustering processing, the hash value information corresponding to each jam log file under each clustering category is calculated. Further, based on the hash value information, the jam log files under each clustering category are clustered, and the jam log files with the same hash value information in each clustering category are classified together, thereby realizing the secondary clustering processing of the jam log files (where the clustering processing of the jam log files based on the clustering key value is the primary clustering processing).
[0116] Furthermore, the jam log files are stored and displayed in a hierarchical manner according to the secondary clustering categories corresponding to the secondary clustering processing. In response to the selection of the primary clustering category, each secondary clustering category under the corresponding primary clustering category can be displayed, and in response to the selection of the secondary clustering category, all jam log files under the secondary clustering category can be displayed, and developers can analyze the causes of jams based on the jam logs. The jam log files are further refined and classified through secondary clustering processing, further improving the efficiency of jam cause analysis.
[0117] Figure 4 A schematic diagram of the structure of a device for collecting jamming log information applied to a mobile terminal is provided in an embodiment of the present application. Figure 4 As shown, the jam log information collection device includes a stack collection module 41, a jam detection module 42 and a log upload module 43.
[0118] Among them, the stack acquisition module 41 is used to obtain the call stack of the main thread according to the set acquisition time interval, and aggregate the call stack of the main thread to obtain an aggregated call stack; the jam detection module 42 is used to detect whether a jam event occurs in the main thread according to the set detection time interval, and in response to a jam event occurring in the main thread, save the aggregated call stack as a jam log file, and the detection time interval is greater than the acquisition time interval; the log upload module 43 is used to upload the jam log file to the server, and the server performs symbolization and clustering processing on the jam log file.
[0119] In the above, the aggregate call stack of the main thread is obtained at the mobile terminal according to the collection time interval, and the aggregate call stack is aggregated, and at the same time, whether a jam event occurs in the main thread is detected according to the detection time interval, and when a jam event occurs, the aggregate call stack collected during this period is saved as a jam log file, and uploaded to the server, and the server symbolizes and clusters the received jam log file. In the jam log file collection stage, the same aggregate call stack is aggregated together through aggregation processing, which reduces the situation where the jam log finally generated is too lengthy, making the jam log file easier to read and facilitating the location of the jam cause. In addition, by symbolizing and clustering each jam log file, the repeated reading of the jam log file is reduced, the time cost of jam analysis is reduced, and the efficiency of jam cause analysis is effectively improved.
[0120] Figure 5 A schematic diagram of the structure of a device for collecting jamming log information applied to a server provided in an embodiment of the present application is given. Figure 5 As shown, the jam log information collection device includes a symbolization processing module 51, a stack screening module 52 and a log clustering module 53.
[0121] Among them, the symbolization processing module 51 is used to determine the aggregated call stack in the multiple jamming log files uploaded by the mobile terminal, and symbolize the aggregated call stack. The aggregated call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jamming log file when a jamming event occurs in the main thread. The stack code recorded by the aggregated call stack includes the system library stack code and the software stack code; the stack screening module 52 is used to determine the system library stack code in the aggregated call stack, and filter out the jamming-related system library stack code in the system library stack code; the log clustering module 53 is used to cluster the multiple jamming log files based on the filtered system library stack code and the software stack code.
[0122] In the above, the aggregate call stack of the main thread is obtained at the mobile terminal according to the collection time interval, and the aggregate call stack is aggregated, and at the same time, whether a jam event occurs in the main thread is detected according to the detection time interval, and when a jam event occurs, the aggregate call stack collected during this period is saved as a jam log file, and uploaded to the server, and the server symbolizes and clusters the received jam log file. In the jam log file collection stage, the same aggregate call stack is aggregated together through aggregation processing, which reduces the situation where the jam log finally generated is too lengthy, making the jam log file easier to read and facilitating the location of the jam cause. In addition, by symbolizing and clustering each jam log file, the repeated reading of the jam log file is reduced, the time cost of jam analysis is reduced, and the efficiency of jam cause analysis is effectively improved.
[0123] The embodiment of the present application also provides a jamming log information collection device, which can integrate the jamming log information collection device applied to the mobile terminal or the jamming log information collection device applied to the server provided in the embodiment of the present application. Figure 6 Schematic diagram of a device for collecting jamming log information provided by an embodiment of the present application. Figure 6 , the jam log information collection device includes: an input device 63, an output device 64, a memory 62 and one or more processors 61; the memory 62 is used to store one or more programs; when the one or more programs are executed by the one or more processors 61, the one or more processors 61 implement the jam log information collection method provided in the above embodiment. The jam log information collection device, equipment and computer provided above can be used to execute the jam log information collection method provided in any of the above embodiments, and have corresponding functions and beneficial effects.
[0124] An embodiment of the present application also provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to execute the jam log information collection method provided in any of the above embodiments. Of course, the computer executable instructions of a storage medium containing computer executable instructions provided in an embodiment of the present application are not limited to the jam log information collection method described above, and can also execute related operations in the jam log information collection method provided in any embodiment of the present application. The jam log information collection device, equipment, and storage medium provided in the above embodiments can execute the jam log information collection method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the jam log information collection method provided in any embodiment of the present application.
[0125] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A method for collecting jamming log information, applied to a mobile terminal, characterized in that: include: According to the set collection time interval, the call stack of the main thread is obtained, and the call stack of the main thread is aggregated to obtain an aggregated call stack; According to a set detection time interval, detecting whether a jam event occurs in the main thread, and in response to a jam event occurring in the main thread, saving the aggregate call stack as a jam log file, wherein the detection time interval is greater than the collection time interval; Uploading the jam log file to a server, and having the server perform symbolization and clustering processing on the jam log file; Among them, the server clusters the jam log files, including: determining the system library stack code in the aggregate call stack, and filtering out the jam-related system library stack code in the system library stack code; for each of the jam log files, according to the set maximum number of acquisition lines, based on the filtered system library stack code and software stack code, stack code extraction is performed in the aggregate call stack; if the stack code extraction is successful, the extracted stack code is used as the clustering key value of the jam log file; if the stack code extraction fails, the clustering key value of the jam log file is determined as the clustering key value corresponding to the environmental factor, wherein the environmental factor includes the mobile terminal temperature or the mobile terminal hardware performance; based on the clustering key value, a plurality of the jam log files are clustered.
2. The method for collecting jam log information according to claim 1, characterized in that: The method of acquiring the call stack of the main thread according to the set collection time interval, and aggregating the call stack of the main thread to obtain an aggregated call stack, includes: According to the set collection time interval, the call stack of the main thread is obtained from the register by detecting the child thread; Based on the memory address corresponding to the call stack of the main thread, the call stack of the main thread is aggregated, and the number of occurrences of the memory address is recorded to obtain an aggregated call stack.
3. The method for collecting jam log information according to claim 1, characterized in that: The detecting, according to a set detection time interval, whether a freeze event occurs in the main thread includes: According to the set detection time interval, the detection sub-thread sends a test data packet to the main thread; Whether a freeze event occurs in the main thread is determined according to whether the main thread responds based on the test data packet.
4. A method for collecting jam log information, applied to a server, characterized in that: include: Determine an aggregate call stack in a plurality of jam log files uploaded by a mobile terminal, and symbolize the aggregate call stack, wherein the aggregate call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jam log file when a jam event occurs in the main thread, and the stack code recorded in the aggregate call stack includes a system library stack code and a software stack code; Determine the system library stack code in the aggregate call stack, and filter out the system library stack code related to the jamming in the system library stack code; For each of the jam log files, according to the set maximum number of acquisition lines, based on the screened system library stack code and the software stack code, stack code extraction is performed in the aggregate call stack; If the stack code is extracted successfully, the extracted stack code is used as the clustering key value of the Caton log file; If the stack code extraction fails, the clustering key value of the jam log file is determined as the clustering key value corresponding to the environmental factor, wherein the environmental factor includes the temperature of the mobile terminal or the hardware performance of the mobile terminal; and the plurality of jam log files are clustered based on the clustering key value.
5. The method for collecting jam log information according to claim 4, characterized in that: The determining of the aggregate call stack in the jam log file uploaded by the mobile terminal and symbolizing the aggregate call stack includes: Determine an aggregate call stack in a jam log file uploaded by a mobile terminal, wherein the aggregate call stack is represented in the form of a memory address; The aggregate call stack is symbolized according to the correspondence between the memory address and the function representation symbol recorded in the set symbol table, so as to represent the aggregate call stack in the form of the function representation symbol.
6. The method for collecting jam log information according to claim 4, characterized in that: The determining of the system library stack code in the aggregate call stack and filtering out the system library stack code related to the jamming in the system library stack code includes: Determine the system library stack code in the aggregate call stack according to the function representation symbol corresponding to the aggregate call stack, wherein the system library stack code includes a user interface system library stack code and a non-user interface system library stack code; Screening out non-user interface system library stack codes from the system library stack codes; The user interface system library stack codes whose occurrence times reach a set threshold value are screened out from the system library stack codes.
7. The method for collecting jam log information according to claim 4, characterized in that: The aggregate call stack is represented in the form of memory addresses, and the aggregate call stack records the number of occurrences of each memory address; The clustering process of the plurality of the jam log files based on the clustering key value includes: The number of occurrences corresponding to the aggregate call stack is removed, and a plurality of the jam log files are clustered based on the clustering key value.
8. The method for collecting jam log information according to claim 4, characterized in that: After clustering the plurality of the Caton log files based on the clustering key value, the method further includes: Determine the hash value information corresponding to each of the jam log files in each cluster category after clustering processing; The jam log files corresponding to each clustering category are clustered based on the hash value information.
9. A device for collecting jamming log information, applied to a mobile terminal, characterized in that: It includes stack collection module, jam detection module and log upload module, among which: The stack acquisition module is used to obtain the call stack of the main thread according to the set acquisition time interval, and aggregate the call stack of the main thread to obtain an aggregated call stack; The jam detection module is used to detect whether a jam event occurs in the main thread according to a set detection time interval, and in response to a jam event occurring in the main thread, save the aggregate call stack as a jam log file, wherein the detection time interval is greater than the collection time interval; The log uploading module is used to upload the jam log file to the server, and the server performs symbolization and clustering processing on the jam log file; Among them, the server clusters the jam log files, including: determining the system library stack code in the aggregate call stack, and filtering out the jam-related system library stack code in the system library stack code; for each of the jam log files, according to the set maximum number of acquisition lines, based on the filtered system library stack code and software stack code, stack code extraction is performed in the aggregate call stack; if the stack code extraction is successful, the extracted stack code is used as the clustering key value of the jam log file; if the stack code extraction fails, the clustering key value of the jam log file is determined as the clustering key value corresponding to the environmental factor, wherein the environmental factor includes the mobile terminal temperature or the mobile terminal hardware performance; based on the clustering key value, a plurality of the jam log files are clustered.
10. A device for collecting jamming log information, applied to a server, characterized in that: It includes symbolic processing module, stack filtering module and log clustering module, among which: The symbolization processing module is used to determine the aggregate call stack in the multiple jam log files uploaded by the mobile terminal, and symbolize the aggregate call stack, the aggregate call stack is obtained by the mobile terminal collecting and aggregating the call stack of the main thread, and is saved by the mobile terminal as the jam log file when a jam event occurs in the main thread, and the stack code recorded by the aggregate call stack includes a system library stack code and a software stack code; The stack screening module is used to determine the system library stack code in the aggregate call stack, and screen out the system library stack code related to the jamming in the system library stack code; The log clustering module is used to perform clustering processing on the plurality of the jam log files based on the screened system library stack code and the software stack code; Among them, the server clusters the jam log files, including: determining the system library stack code in the aggregate call stack, and filtering out the jam-related system library stack code in the system library stack code; for each of the jam log files, according to the set maximum number of acquisition lines, based on the filtered system library stack code and the software stack code, stack code extraction is performed in the aggregate call stack; if the stack code extraction is successful, the extracted stack code is used as the clustering key value of the jam log file; if the stack code extraction fails, the clustering key value of the jam log file is determined as the clustering key value corresponding to the environmental factor, wherein the environmental factor includes the mobile terminal temperature or the mobile terminal hardware performance; based on the clustering key value, a plurality of the jam log files are clustered.
11. A device for collecting jamming log information, characterized in that: include: memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the jam log information collection method as described in any one of claims 1-8.
12. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions, when executed by a computer processor, are used to execute the jam log information collection method as described in any one of claims 1-8.
Citation Information
Patent Citations
Computer operation monitoring method, device and system
CN106445769A
Application program crash log processing method, system and apparatus and storage medium
CN109032909A
Data processing method and device
CN110955548A
Jamming monitoring method, device and system, storage medium and computer equipment
CN111382026A