Methods, apparatus, electronic devices and computer-readable storage media for cascading analysis
By recording the time nodes of target messages and analyzing function call relationships in the message queue, the problem of the inability to fully analyze the causes of lag in existing technologies is solved, achieving efficient lag analysis and rapid lag resolution.
Patent Information
- Application Number
- CN202010963250.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-14
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2041-06-03
AI Technical Summary
Existing technologies cannot fully analyze the reasons for application interface lag, especially the time-consuming functions in the entire message processing process and the initiation point of time-consuming messages in the business code.
By recording the sending time, start time, and completion time of the target message in the message queue, the lag phenomenon is analyzed in segments. The Handler tool is used to record and obtain function call relationships to determine the time period and cause of the lag.
It improves the efficiency and accuracy of stuttering analysis, enabling comprehensive analysis of stuttering causes, providing time-consuming messages and specific function names, and helping to quickly resolve stuttering issues.
Smart Images

Figure CN114185753B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of terminal technology, and more specifically, to a stuttering analysis method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Lag refers to the phenomenon where the interface freezes or becomes unresponsive while using an application. This is generally caused by the main thread's processing time exceeding a lag threshold, resulting in the interface failing to refresh. Users will experience a noticeable pause while using the application, significantly impacting the user experience.
[0003] Current technology uses Looper's Printer to detect the time spent on Looper messages in the main thread. If the time exceeds a stuttering threshold, it triggers the capture of the main thread's call stack, allowing analysis of function execution time during the stutter. However, current technology can only capture the instantaneous call stack when the stuttering threshold is exceeded. It cannot clearly identify which functions are still taking time during the entire message processing process, nor can it easily pinpoint the origin of time-consuming messages actively sent by the business logic. Summary of the Invention
[0004] This disclosure provides a method, apparatus, electronic device, and computer-readable storage medium for stuttering analysis, which can analyze the causes of stuttering during the entire message processing process. The technical solution is as follows:
[0005] Firstly, a method for cascading analysis is provided, which includes:
[0006] Send the target message to the message queue and record the sending time, processing start time, and processing completion time of the target message;
[0007] If the target message experiences a delay, determine the time period during which the delay occurs. The time period during which the target message experiences a delay includes either a message waiting period or a message processing period. The message waiting period is the time between the sending time and the start time of processing, and the message processing period is the time between the start time of processing and the completion time of processing.
[0008] Based on the time period during which the target message experienced lag, the lag analysis results for the target message are determined.
[0009] Secondly, an apparatus for cascading analysis is provided, the apparatus comprising:
[0010] The recording module is used to send the target message to the message queue and record the sending time, the start time of processing, and the completion time of the target message;
[0011] The first determining module is used to determine the time period during which the target message is stuck if the target message is stuck. The time period during which the target message is stuck includes a message waiting period or a message processing period. The message waiting period is the period between the sending time and the start time of processing, and the message processing period is the period between the start time of processing and the completion time of processing.
[0012] The second determination module is used to determine the lag analysis results of the target message based on the time period during which the lag phenomenon occurs.
[0013] Thirdly, an electronic device is provided, the electronic device comprising:
[0014] One or more processors;
[0015] Memory;
[0016] One or more applications, wherein the applications are stored in memory and configured to be executed by one or more processors, the applications being configured to perform operations corresponding to the lag analysis method as shown in the first aspect of this disclosure.
[0017] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method for stuttering analysis shown in the first aspect of this disclosure.
[0018] The beneficial effects of the technical solution provided in this disclosure are:
[0019] This disclosure records the sending time, start time, and completion time of the target message when sending it to the message queue. This allows for segmentation of the overall processing of the target message, facilitating statistical analysis of each time period. When a delay occurs in the target message, the delay time period is first identified, and then the delay analysis result is determined based on the delay time period. This improves the efficiency of analyzing the causes of delays in the target message. Furthermore, by analyzing the causes of delays in different time periods, the obtained delay analysis results are more comprehensive. Attached Figure Description
[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0021] Figure 1 A flowchart illustrating a stuttering analysis method provided in this embodiment of the disclosure;
[0022] Figure 2A flowchart illustrating a method for creating a message processing tool according to an embodiment of this disclosure;
[0023] Figure 3 This is a schematic diagram of the structure of a stuttering analysis device provided in an embodiment of the present disclosure;
[0024] Figure 4 This is a schematic diagram of the module structure for creating a message processing tool according to an embodiment of the present disclosure;
[0025] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0026] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0027] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0028] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0029] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish between devices, modules or units, and are not intended to limit these devices, modules or units to necessarily be different devices, modules or units, nor are they intended to limit the order or interdependence of the functions performed by these devices, modules or units.
[0030] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0031] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0032] To make the objectives, technical solutions, and advantages of this disclosure clearer, the embodiments of this disclosure will be described in further detail below with reference to the accompanying drawings.
[0033] The stuttering analysis methods, apparatus, electronic devices, and computer storage media disclosed herein are intended to solve the aforementioned technical problems of the prior art.
[0034] The technical solutions of this disclosure and how they solve the aforementioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this disclosure will now be described with reference to the accompanying drawings.
[0035] This disclosure provides a method for lag analysis, such as... Figure 1 As shown, the method includes:
[0036] Step S101: Send the target message to the message queue and record the sending time, processing start time, and processing completion time of the target message.
[0037] The target message can be a message about UI updates sent from a child thread to the main thread. It is understandable that since the main thread cannot perform long-running and complex tasks, some tasks need to be processed in a child thread. However, UI updates cannot be performed in a child thread, so it is necessary to send a message from the child thread to the main thread to complete the update. However, since the main thread and child thread generally perform different tasks at different times, the message can be sent to a message queue first, and then the main thread can process the messages in the message queue according to the sending order of the messages.
[0038] Since the target message may not be processed immediately after being sent, the sending time, the start time of processing, and the completion time of processing of the target message can be recorded to statistically analyze the entire process of the target message being fully processed.
[0039] In one embodiment of this disclosure, step S101 includes steps S101a to S101d.
[0040] Step S101a: Send the target message to the message queue using a preset message processing tool.
[0041] It is understood that sending the target message to the message queue can be done using a preset message processing tool. In one embodiment of this disclosure, the message processing tool can be a created Handler tool. The created Handler tool can not only send the target message from the child thread to the main thread, but also record the various time nodes of the target message in the entire processing process.
[0042] Step S101b: Record the sending time of the target message using the first preset function of the message processing tool.
[0043] Specifically, during the process of sending a message from a child thread to the main thread, the sending time of the message can be recorded. Specifically, the first preset function of the created Handler utility can be used to record the sending time of the target message, and this first preset function can be the sendMessageAtTime function.
[0044] Step S101c: When a processing request for the target message is received, record the start time of the target message processing.
[0045] When the main thread processes messages in the message queue sequentially, it can record the time when the target message begins processing. In one embodiment of this disclosure, a message identifier can be added to the target message. When the main thread processes the target message, the start time of the target message is recorded based on the message identifier.
[0046] Step S101d: Use the second preset function of the message processing tool to record the completion time of the target message processing.
[0047] Specifically, when a message is processed in the main thread, the completion time of the message processing can be recorded. This can be achieved using the second preset function of the created Handler utility, where the first preset function can be the dispatchMessage function.
[0048] In one embodiment of this disclosure, the message processing tool is constructed as follows:
[0049] Step S201: Create a message processing class that includes a first preset function and a second preset function.
[0050] Specifically, when recording the target message at various points in time throughout the processing, the pre-defined functions of the created Handler tool can be used. Therefore, when creating the Handler tool, a message processing class, namely the Handler class, can be created first, which includes a first pre-defined function and a second pre-defined function. The first and second pre-defined functions in this Handler class can implement the function of recording the target message at various points in time throughout the processing.
[0051] Step S202: Using the created message processing class, determine the parent class of message processing in the message processing tool.
[0052] The created Handler class can be used as the parent class for message processing in the created Handler tool, i.e., the Handler parent class, to achieve uniformity of global variables.
[0053] In one embodiment of this disclosure, step S202, "using the created message processing class to determine the message processing parent class in the message processing tool," includes steps S202a to S202b.
[0054] Step S202a: Determine the first message processing parent class. The first message processing parent class is the message processing parent class of the code points in the source code of the original message processing tool that directly use message processing.
[0055] Understandably, it is possible to detect code points that directly use message processing in the source code of the original message processing tool, i.e., the original Handler tool. These code points can be the first message processing parent class, i.e., the first Handler parent class, and their subclasses will inherit the functionality of their parent class through class inheritance.
[0056] Step S202b: Replace the first message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool.
[0057] Then, the created Handler class replaces the first Handler parent class in the original Handler tool (that is, the class that directly uses the Handler code point in the source code of the original Handler tool), thus obtaining the created Handler tool. Furthermore, the created Handler class is the parent class in the created Handler tool.
[0058] In one embodiment of this disclosure, the replacement tool that replaces the first Handler parent class in the original Handler tool with the created Handler class can be the bytecode manipulation framework ASM. ASM can directly modify class files through bytecode. Therefore, the first Handler parent class in the original Handler tool can be replaced with the created Handler class.
[0059] Alternatively, step S202, "using the created message processing class to determine the message processing parent class in the message processing tool," may also include steps S202c to S202d.
[0060] Step S202c: Determine the second message processing parent class. The second message processing parent class is the message processing parent class corresponding to the message processing subclass in the source code of the original message processing tool.
[0061] In determining the second message processing parent class, i.e. the second Handler parent class, we can first detect the message processing subclass in the source code of the original Handler tool, i.e., the Handler subclass. It should be noted that since the Handler subclass information in the source code of the original Handler tool is the class file information, it can be obtained using a self-developed bytecode tool. Furthermore, when the Handler subclass is detected, we can directly find the parent class of the Handler subclass and then determine the parent class of the Handler subclass as the second Handler parent class.
[0062] Step S202d: Replace the second message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool.
[0063] Then, the created Handler class can be used to replace the second Handler parent class in the original Handler tool. That is, the Handler in the source code of the original Handler tool uses the corresponding Handler parent class of the subclass, thus obtaining the created Handler tool. And the created Handler class is the parent class in the created Handler tool.
[0064] In one embodiment of this disclosure, the replacement tool that replaces the second Handler parent class in the original Handler tool with the created Handler class can also be the bytecode manipulation framework ASM. ASM can directly modify class files through bytecode. Therefore, the second Handler parent class in the original Handler tool can be replaced with the created Handler class.
[0065] Step S203: Override the first preset function and the second preset function through class inheritance to obtain the message processing subclass in the message processing tool.
[0066] Understandably, once the created Handler class is determined to be the parent class of the Handler class in the created Handler utility, the message processing subclasses (i.e., Handler subclasses) in the entire created Handler utility will override the first and second preset functions from the parent class through class inheritance. In other words, all classes in the created Handler utility possess the functionality of the created Handler class.
[0067] Step S102: If the target message is stuck, determine the time period during which the target message is stuck. The time period during which the target message is stuck includes a message waiting period or a message processing period. The message waiting period is the period between the sending time and the start time of processing, and the message processing period is the period between the start time of processing and the completion time of processing.
[0068] Understandably, since the target message is sent to the message queue, the main thread will process the messages in the order they were sent, so the target message usually has a waiting period.
[0069] In one embodiment of this disclosure, the entire execution process of the target message may include two time periods: a waiting period for the target message and a processing period for the target message. The waiting period for the target message may start from the moment the target message is sent to the message queue and end at the moment when the target message is started to be processed. The processing period for the target message may start from the moment when the target message is started to be processed and end at the moment when the target message is completed.
[0070] When a user experiences a frozen interface while using an application, a lag or stuttering phenomenon occurs. Lag can occur during the waiting period for a target message, such as when the message queue is too full and the main thread cannot process it in time, causing a stutter. Additionally, lag can also occur during message processing; for example, problems with function parameters during message processing can also lead to lag.
[0071] In one embodiment of this disclosure, when a lag occurs, the time period during which the lag occurs can be determined first, which facilitates the analysis of the cause of the lag.
[0072] In one embodiment of this disclosure, step S102, "If the target message experiences a pause, determine the time period during which the target message experiences a pause," includes:
[0073] Step S1021: Obtain the function call relationship of the target message during the message waiting period and message processing period, and determine the period when the target message is stuck based on the function call relationship.
[0074] It is understandable that the function call relationship of the target message during the message waiting period and the message processing period is a method snapshot of the target message. The method snapshot of the target message can reflect various detailed information of the target message throughout the entire execution process, such as the specific information of each time node during the execution process.
[0075] In one embodiment of this disclosure, a method snapshot of the target message can be obtained when the target message is processed. It is understood that, compared with the prior art which calls the instantaneous call stack when the lag occurs, obtaining a method snapshot of the target message when the target message is processed can obtain complete execution information of the target message throughout the entire execution process, and can more comprehensively analyze the cause of the lag.
[0076] In one embodiment of this disclosure, step S1021, "determining the time period during which the target message experiences lag based on function call relationships," includes:
[0077] Step S1021a: If the time difference between the sending time and the start processing time is greater than the first preset time threshold, it is determined that the target message is stuck during the message waiting period;
[0078] The first preset time threshold can be a UI lag threshold, which is generally determined by the performance indicators of the terminal device's central processing unit and memory; that is, different terminal devices may have different UI lag thresholds. In one embodiment of this disclosure, the average threshold of the UI lag thresholds of several terminal devices can be selected as the preset time threshold.
[0079] When the time difference between the sending time of the target message and the starting time of processing the target message is greater than a preset time threshold, it can also be determined that the target message has experienced a pause during the message waiting period.
[0080] Step S1021b: If the time difference between the start time and the end time of processing is greater than the second preset time threshold, it is determined that the target message is experiencing a pause during the message processing period.
[0081] The second preset time threshold can be the expected processing time threshold. For each message, the expected processing time threshold can be set for the target message based on historical experience. When the actual processing time is greater than the preset expected processing time, that is, when the time difference between the time the target message is sent and the time the target message starts processing is greater than the expected processing time, it can be determined that the target message has experienced a lag during the message processing period.
[0082] Step S103: Determine the stuttering analysis results of the target message based on the time period during which the stuttering phenomenon occurs.
[0083] Understandably, the reasons for the lag in the target message vary at different times. Therefore, by first obtaining the lag time periods of the target message, we can not only comprehensively analyze the reasons for the lag, but also improve the efficiency of analyzing the reasons for the lag.
[0084] This disclosure records the sending time, start time, and completion time of the target message when sending it to the message queue. This allows for segmentation of the overall processing of the target message, facilitating statistical analysis of each time period. When a delay occurs in the target message, the delay time period is first identified, and then the delay analysis result is determined based on the delay time period. This improves the efficiency of analyzing the causes of delays in the target message. Furthermore, by analyzing the causes of delays in different time periods, the obtained delay analysis results are more comprehensive.
[0085] In one embodiment of this disclosure, step S103, "determining the stuttering analysis result of the target message based on the time period during which the stuttering phenomenon occurs," includes:
[0086] Step S103a: If the target message experiences a pause during the message waiting period, determine the message source of the target message based on the first preset function.
[0087] The source of the target message can be understood as which sub-thread sent the target message. In one embodiment of this disclosure, the stack of the target message at that time can be obtained by using the first preset function in the created Handler tool when the sending time of the target message is obtained, and then the target message can be viewed in the stack as to which sub-thread sent the target message.
[0088] Step S103b: Analyze the message source and determine the name of the time-consuming message causing the lag.
[0089] After obtaining the child thread that sent the target message, it can further obtain other messages sent to the message queue by that child thread. It is understandable that each message has its expected processing time. When the main thread is processing messages in the message queue, if the actual processing time of a certain message exceeds its expected processing time, it will cause the waiting time of subsequent messages to be too long, which may lead to stuttering problems for subsequent messages.
[0090] Therefore, we can obtain the source of each message and analyze the actual processing time and expected processing time of each message to determine the cause of the lag in the target message. For example, when messages B and C are consecutive messages following message A, if the actual processing time of message A is longer than its expected processing time, we can obtain the specific message name of the time-consuming message A as the cause of the lag in messages B and C.
[0091] Analyzing the sources of information provides a more comprehensive analysis of the lag issues, making it easier to resolve them.
[0092] In one embodiment of this disclosure, step S103, "determining the stuttering analysis result of the target message based on the time period during which the stuttering phenomenon occurs," includes:
[0093] Step S103c: If the target message experiences a pause during the message processing period, determine the name of the time-consuming function that caused the pause based on the function call relationship.
[0094] Understandably, function call relationships can be seen as a snapshot of the target message's methods, reflecting specific execution information throughout the entire process, such as the names of the called functions and the times they were called. Inspectors can use the function relationships in the method snapshot to identify the time-consuming functions causing the stuttering, and then determine the name of these time-consuming functions as the cause of the stuttering.
[0095] In addition, method snapshots can be directly uploaded to the server, which can then detect time-consuming functions in the method snapshot and obtain the names of the time-consuming functions that cause the target message to lag.
[0096] In one embodiment of this disclosure, the stuttering analysis method further includes:
[0097] The stuttering analysis results are displayed, including the names of the time-consuming messages or functions that caused the stuttering.
[0098] Understandably, after determining the cause of the lag, the system can also display the cause, namely the name of the time-consuming message and the name of the time-consuming function that caused the lag, so that maintenance personnel can handle the lag problem comprehensively and quickly, thereby improving the efficiency of lag repair.
[0099] This disclosure provides a stuttering analysis device, such as... Figure 3 As shown, the stuttering analysis device 30 may include: a recording module 301, a first determining module 302, and a second determining module 303, wherein,
[0100] The recording module 301 is used to send the target message to the message queue and record the sending time, the start time of processing, and the completion time of the target message.
[0101] The target message can be a message about UI updates sent from a child thread to the main thread. It is understandable that since the main thread cannot perform long-running and complex tasks, some tasks need to be processed in a child thread. However, UI updates cannot be performed in a child thread, so it is necessary to send a message from the child thread to the main thread to complete the update. However, since the main thread and child thread generally perform different tasks at different times, the message can be sent to a message queue first, and then the main thread can process the messages in the message queue according to the sending order of the messages.
[0102] Since the target message may not be processed immediately after being sent, the sending time, the start time of processing, and the completion time of processing of the target message can be recorded to statistically analyze the entire process of the target message being fully processed.
[0103] In one embodiment of this disclosure, the recording module includes:
[0104] The sending submodule is used to send target messages to the message queue using a preset message processing tool.
[0105] It is understood that sending the target message to the message queue can be done using a preset message processing tool. In one embodiment of this disclosure, the message processing tool can be a created Handler tool. The created Handler tool can not only send the target message from the child thread to the main thread, but also record the various time nodes of the target message in the entire processing process.
[0106] The first recording submodule is used to record the sending time of the target message using the first preset function of the message processing tool.
[0107] Specifically, during the process of sending a message from a child thread to the main thread, the sending time of the message can be recorded. Specifically, the first preset function of the created Handler utility can be used to record the sending time of the target message, and this first preset function can be the sendMessageAtTime function.
[0108] The second recording submodule is used to record the start time of processing the target message when a processing request for the target message is received.
[0109] When the main thread processes messages in the message queue sequentially, it can record the time when the target message begins processing. In one embodiment of this disclosure, a message identifier can be added to the target message. When the main thread processes the target message, the start time of the target message is recorded based on the message identifier.
[0110] The third recording submodule is used to record the completion time of the target message processing using the second preset function of the message processing tool.
[0111] Specifically, when a message is processed in the main thread, the completion time of the message processing can be recorded. This can be achieved using the second preset function of the created Handler utility, where the first preset function can be the dispatchMessage function.
[0112] In one embodiment of this disclosure, the construction module 40 of the message processing tool includes a creation submodule 401, a first determination submodule 402, and a second determination submodule 403.
[0113] Create submodule 401 to create a message processing class that includes a first preset function and a second preset function.
[0114] Specifically, when recording the target message at various points in time throughout the processing, the pre-defined functions of the created Handler tool can be used. Therefore, when creating the Handler tool, a message processing class, namely the Handler class, can be created first, which includes a first pre-defined function and a second pre-defined function. The first and second pre-defined functions in this Handler class can implement the function of recording the target message at various points in time throughout the processing.
[0115] The first determining submodule 402 is used to determine the parent class of message processing in the created message processing tool using the created message processing class.
[0116] The created Handler class can be used as the parent class for message processing in the created Handler tool, thus unifying global variables.
[0117] In one embodiment of this disclosure, the first determining submodule 402 includes:
[0118] The first determining unit is used to determine the first message processing parent class, which is the message processing parent class of the code points in the source code of the original message processing tool that directly use message processing.
[0119] It is understandable that code points that directly use message processing can be detected in the source code of the original message processing tool, i.e., the original Handler tool. These code points that directly use Handler can be the first message processing parent class, i.e., the Handle parent class r, whose subclasses will inherit the functionality of their parent class through class inheritance.
[0120] The first replacement unit is used to replace the first message processing parent class with the created message processing class to obtain the message processing parent class in the created message processing tool.
[0121] Then, the created Handler class replaces the first Handler parent class in the original Handler tool (that is, the class that directly uses the Handler code point in the source code of the original Handler tool), thus obtaining the created Handler tool. Furthermore, the created Handler class is the parent class in the created Handler tool.
[0122] In one embodiment of this disclosure, the replacement tool that replaces the first Handler parent class in the original Handler tool with the created Handler class can be the bytecode manipulation framework ASM. ASM can directly modify class files through bytecode. Therefore, the first Handler parent class in the original Handler tool can be replaced with the created Handler class.
[0123] Alternatively, the first determining submodule 402 may also include:
[0124] The second determining unit is used to determine the second message processing parent class, which is the message processing parent class corresponding to the message processing subclass in the source code of the original message processing tool.
[0125] In determining the second message processing parent class, i.e. the second Handler parent class, we can first detect the message processing subclass in the source code of the original Handler tool, i.e. the Handler subclass. It should be noted that since the Handler subclass information in the source code of the original Handler tool is the class file information, it can be obtained using a self-developed bytecode tool. Furthermore, when the message processing subclass is detected, we can directly find the parent class of the message processing subclass and then determine the parent class of the message processing subclass as the second message processing parent class.
[0126] The second replacement unit is used to replace the second message processing parent class with the created message processing class to obtain the message processing parent class in the created message processing tool.
[0127] Then, the created Handler class can be used to replace the second Handler parent class in the original Handler tool. That is, the Handler in the source code of the original Handler tool uses the corresponding Handler parent class of the subclass, thus obtaining the created Handler tool. And the created Handler class is the parent class in the created Handler tool.
[0128] In one embodiment of this disclosure, the replacement tool that replaces the second Handler parent class in the original Handler tool with the created Handler class can also be the bytecode manipulation framework ASM. ASM can directly modify class files through bytecode. Therefore, the second Handler parent class in the original Handler tool can be replaced with the created Handler class.
[0129] The second determining submodule 403 is used to override the first preset function and the second preset function through class inheritance to obtain the message processing subclass in the created message processing tool.
[0130] Understandably, once the created Handler class is determined to be the parent class of the Handler class in the created Handler utility, the message processing subclasses (i.e., subclasses of Handler) in the entire created Handler utility will override the first and second preset functions from the parent class of Handler through class inheritance. In other words, all classes in the entire created Handler utility possess the functionality of the created Handler class.
[0131] The first determining module 302 is used to determine the time period during which the target message is stuck if the target message is stuck. The time period during which the target message is stuck includes a message waiting period or a message processing period. The message waiting period is the period between the sending time and the start time of processing, and the message processing period is the period between the start time of processing and the completion time of processing.
[0132] Understandably, since the target message is sent to the message queue, the main thread will process the messages in the order they were sent, so the target message usually has a waiting period.
[0133] In one embodiment of this disclosure, the entire execution process of the target message may include two time periods: a waiting period for the target message and a processing period for the target message. The waiting period for the target message may start from the moment the target message is sent to the message queue and end at the moment when the target message is started to be processed. The processing period for the target message may start from the moment when the target message is started to be processed and end at the moment when the target message is completed.
[0134] When a user experiences a frozen interface while using an application, a lag phenomenon occurs. Generally, lag can occur during the waiting period for target messages. For example, when there are too many messages in the message queue and the main thread cannot process them in time, it may cause the interface to lag. In addition, lag can also occur during message processing. For example, if there is a problem with the parameters used in the function during message processing, it can also lead to lag.
[0135] When a lag occurs, the function call relationship of the target message during the message waiting period and the message processing period can be obtained, that is, the method snapshot of the target message. The method snapshot of the target message can reflect the information of the target message during the execution process.
[0136] In one embodiment of this disclosure, when a lag occurs, the time period during which the lag occurs can be determined first, which facilitates the analysis of the cause of the lag.
[0137] In one embodiment of this disclosure, the first determining module 302 includes:
[0138] The third determination submodule is used to obtain the function call relationship of the target message during the message waiting period and message processing period, and to determine the period during which the target message is stuck based on the function call relationship.
[0139] It is understandable that the function call relationship of the target message during the message waiting period and the message processing period is a method snapshot of the target message. The method snapshot of the target message can reflect various detailed information of the target message throughout the entire execution process, such as the specific information of each time node during the execution process.
[0140] In one embodiment of this disclosure, a method snapshot of the target message can be obtained when the target message is processed. It is understood that, compared with the instantaneous call stack when the lag occurs in the prior art, obtaining a method snapshot of the target message when the target message is processed can obtain complete execution information of the target message throughout the entire execution process, and can more comprehensively analyze the cause of the lag.
[0141] In one embodiment of this disclosure, the third determining submodule includes:
[0142] The first determining unit is used to determine that the target message is stuck during the message waiting period if the time difference between the sending time and the start processing time is greater than a first preset time threshold.
[0143] The first preset time threshold can be a UI lag threshold, which is generally determined by the performance indicators of the terminal device's central processing unit and memory; that is, different terminal devices may have different UI lag thresholds. In one embodiment of this disclosure, the average threshold of the UI lag thresholds of several terminal devices can be selected as the preset time threshold.
[0144] When the time difference between the sending time of the target message and the start time of processing the target message is greater than a preset time threshold, it is determined that the target message has experienced a delay, and it can also be determined that the target message experienced a delay during the message waiting period.
[0145] The second determining unit is used to determine that the target message is experiencing a pause during the message processing period if the time difference between the start processing time and the processing completion time is greater than a second preset time threshold.
[0146] The second preset time threshold can be the expected processing time threshold. For each message, the expected processing time threshold can be set for the target message based on historical experience. When the actual processing time is greater than the preset expected processing time, that is, when the time difference between the time the target message is sent and the time the target message starts processing is greater than the expected processing time, it can be determined that the target message has experienced a lag during the message processing period.
[0147] The second determining module 303 is used to determine the lag analysis results of the target message based on the time period during which the lag phenomenon occurs.
[0148] Understandably, the reasons for the lag in the target message vary at different times. Therefore, by first obtaining the lag time periods of the target message, we can not only comprehensively analyze the reasons for the lag, but also improve the efficiency of analyzing the reasons for the lag.
[0149] This disclosure records the sending time, start time, and completion time of the target message when sending it to the message queue. This allows for segmentation of the overall processing of the target message, facilitating statistical analysis of each time period. When a delay occurs in the target message, the delay time period is first identified, and then the delay analysis result is determined based on the delay time period. This improves the efficiency of analyzing the causes of delays in the target message. Furthermore, by analyzing the causes of delays in different time periods, the obtained delay analysis results are more comprehensive.
[0150] In one embodiment of this disclosure, the second determining module 303 includes:
[0151] The fourth determination submodule is used to determine the message source of the target message based on the first preset function if the target message experiences a pause during the message waiting period.
[0152] The source of the target message can be understood as which sub-thread sent the target message. In one embodiment of this disclosure, the stack of the target message at that time can be obtained by using the first preset function in the created Handler tool when the sending time of the target message is obtained, and then the target message can be viewed in the stack as to which sub-thread sent the target message.
[0153] The analysis submodule is used to analyze the source of messages and determine the names of time-consuming messages that are causing the lag.
[0154] After obtaining the child thread that sent the target message, it can further obtain other messages sent to the message queue by that child thread. It is understandable that each message has its expected processing time. When the main thread is processing messages in the message queue, if the actual processing time of a certain message exceeds its expected processing time, it will cause the waiting time of subsequent messages to be too long, which may lead to stuttering problems for subsequent messages.
[0155] Therefore, we can obtain the source of each message and analyze the actual processing time and expected processing time of each message to determine the cause of the lag in the target message. For example, when messages B and C are consecutive messages following message A, if the actual processing time of message A is longer than its expected processing time, we can obtain the specific message name of the time-consuming message A as the cause of the lag in messages B and C.
[0156] By analyzing the source of the message, the analysis results of the lag phenomenon are more comprehensive, making it easier to solve the lag problem.
[0157] In one embodiment of this disclosure, the second determining module 303 includes:
[0158] The fifth submodule is used to determine the name of the time-consuming function that caused the lag if the target message experiences a pause during message processing, based on the function call relationship.
[0159] Understandably, function call relationships can be seen as a snapshot of the target message's methods, reflecting specific execution information throughout the entire process, such as the names of the called functions and the times they were called. Inspectors can use the function relationships in the method snapshot to identify the time-consuming functions causing the stuttering, and then determine the name of these time-consuming functions as the cause of the stuttering.
[0160] In addition, method snapshots can be directly uploaded to the server, which can then detect time-consuming functions in the method snapshot and obtain the names of the time-consuming functions that cause the target message to lag.
[0161] In one embodiment of this disclosure, the stuttering analysis device 30 further includes:
[0162] The display module is used to display the stuttering analysis results, which include the names of the time-consuming messages or functions that caused the stuttering.
[0163] Understandably, after determining the cause of the lag, the system can also display the cause, namely the name of the time-consuming message and the name of the time-consuming function that caused the lag, so that maintenance personnel can handle the lag problem comprehensively and quickly, thereby improving the efficiency of lag repair.
[0164] The following is for reference. Figure 5 The diagram illustrates a structural schematic of an electronic device 500 suitable for implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0165] The electronic device includes a memory and a processor, wherein the processor may be referred to as processing device 501 as described below, and the memory may include at least one of read-only memory (ROM) 502, random access memory (RAM) 503, and storage device 508 as described below, as follows:
[0166] like Figure 5 As shown, the electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0167] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0168] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.
[0169] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0170] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0171] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0172] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to:
[0173] Send the target message to the message queue and record the sending time, processing start time, and processing completion time of the target message;
[0174] If the target message experiences a delay, determine the time period during which the delay occurs. The time period during which the target message experiences a delay includes either a message waiting period or a message processing period. The message waiting period is the time between the sending time and the start time of processing, and the message processing period is the time between the start time of processing and the completion time of processing.
[0175] Based on the time period during which the target message experienced lag, the lag analysis results for the target message are determined.
[0176] Computer program code for performing the operations of this disclosure can 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, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone 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 remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0177] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0178] The modules or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules or units do not necessarily limit the specific unit itself.
[0179] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0180] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0181] According to one or more embodiments of this disclosure, a lag analysis method is provided, comprising:
[0182] Send the target message to the message queue and record the sending time, processing start time, and processing completion time of the target message;
[0183] If the target message experiences a delay, determine the time period during which the delay occurs. The time period during which the target message experiences a delay includes either a message waiting period or a message processing period. The message waiting period is the time between the sending time and the start time of processing, and the message processing period is the time between the start time of processing and the completion time of processing.
[0184] Based on the time period during which the target message experienced lag, the lag analysis results for the target message are determined.
[0185] In one embodiment of this disclosure, a target message is sent to a message queue, and the sending time, start processing time, and processing completion time of the target message are recorded, including:
[0186] Send the target message to the message queue using the preset message processing tool;
[0187] The first preset function of the message processing tool is used to record the sending time of the target message;
[0188] When a processing request for a target message is received, record the start time of processing the target message;
[0189] The second preset function of the message processing tool is used to record the completion time of the target message processing.
[0190] In one embodiment of this disclosure, the message processing tool is constructed as follows:
[0191] Create a message handling class that includes a first preset function and a second preset function;
[0192] Use the created message processing class to determine the parent class of message processing in the message processing tool;
[0193] By overriding the first and second preset functions through class inheritance, the message processing subclass in the message processing tool is determined.
[0194] In one embodiment of this disclosure, determining the parent class of message processing in the message processing tool using the created message processing class includes:
[0195] The first message processing parent class is determined. The first message processing parent class is the message processing parent class of the code points in the source code of the original message processing tool that directly use message processing.
[0196] Replace the first message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool;
[0197] or,
[0198] Determine the second message processing parent class, which is the message processing parent class corresponding to the message processing subclass in the source code of the original message processing tool;
[0199] Replace the second message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool.
[0200] In one embodiment of this disclosure, if a target message experiences a pause, determining the time period during which the target message experiences a pause includes:
[0201] Obtain the function call relationships of the target message during the message waiting period and message processing period, and determine the time period during which the target message is stuck based on the function call relationships.
[0202] In one embodiment of this disclosure, determining the time period during which the target message experiences a pause based on function call relationships includes:
[0203] If the time difference between the sending time and the start processing time is greater than the first preset time threshold, it is determined that the target message is experiencing a pause during the message waiting period.
[0204] If the time difference between the start time and the completion time is greater than the second preset time threshold, it is determined that the target message is experiencing a pause during the message processing period.
[0205] In one embodiment of this disclosure, determining the stuttering analysis result of the target message based on the time period during which the stuttering occurs includes:
[0206] If the target message experiences a delay during the message waiting period, the message source of the target message is determined based on the first preset function;
[0207] Analyze the source of the messages to determine the name of the time-consuming message causing the lag.
[0208] In one embodiment of this disclosure, determining the stuttering analysis result of the target message based on the time period during which the stuttering occurs includes:
[0209] If the target message experiences a pause during message processing, the name of the time-consuming function causing the pause is determined based on the function call relationship.
[0210] In one embodiment of this disclosure, the stuttering analysis method further includes:
[0211] The stuttering analysis results are displayed, including the names of the time-consuming messages or functions that caused the stuttering.
[0212] According to one or more embodiments of this disclosure, a stuttering analysis apparatus is provided, comprising:
[0213] The recording module is used to send the target message to the message queue and record the sending time, the start time of processing, and the completion time of the target message;
[0214] The first determining module is used to determine the time period during which the target message is stuck if the target message is stuck. The time period during which the target message is stuck includes a message waiting period or a message processing period. The message waiting period is the period between the sending time and the start time of processing, and the message processing period is the period between the start time of processing and the completion time of processing.
[0215] The second determination module is used to determine the lag analysis results of the target message based on the time period during which the lag phenomenon occurs.
[0216] In one embodiment of this disclosure, the recording module includes:
[0217] The sending submodule is used to send target messages to the message queue using a preset message processing tool;
[0218] The first recording submodule is used to record the sending time of the target message using the first preset function of the message processing tool;
[0219] The second recording submodule is used to record the start time of processing the target message when a processing request for the target message is received;
[0220] The third recording submodule is used to record the completion time of the target message processing using the second preset function of the message processing tool.
[0221] In one embodiment of this disclosure, the building block of the message processing tool may include:
[0222] Create a submodule to create a message processing class that includes a first preset function and a second preset function;
[0223] The first determination submodule is used to determine the parent class of message processing in the message processing tool by utilizing the created message processing class;
[0224] The second submodule determines the message processing subclass in the message processing tool by overriding the first and second preset functions through class inheritance.
[0225] In one embodiment of this disclosure, the first determining submodule includes:
[0226] The first determining unit is used to determine the first message processing parent class, which is the message processing parent class of the code point in the source code of the original message processing tool that directly uses message processing.
[0227] The first replacement unit is used to replace the first message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool.
[0228] Or include:
[0229] The second determining unit is used to determine the second message processing parent class, which is the message processing parent class corresponding to the message processing subclass in the source code of the original message processing tool.
[0230] The second replacement unit is used to replace the second message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool.
[0231] In one embodiment of this disclosure, the first determining module includes:
[0232] The third determination submodule is used to obtain the function call relationship of the target message during the message waiting period and message processing period, and to determine the period when the target message is stuck based on the function call relationship.
[0233] In one embodiment of this disclosure, the third determining submodule includes:
[0234] The first determining unit is used to determine that the target message is stuck during the message waiting period if the time difference between the sending time and the start processing time is greater than a first preset time threshold.
[0235] The second determining unit is used to determine that the target message is experiencing a pause during the message processing period if the time difference between the start processing time and the processing completion time is greater than a second preset time threshold.
[0236] In one embodiment of this disclosure, the second determining module includes:
[0237] The fourth determination submodule is used to determine the message source of the target message based on the first preset function if the target message experiences a pause during the message waiting period.
[0238] The analysis submodule is used to analyze the source of messages and determine the names of time-consuming messages that are causing the lag.
[0239] In one embodiment of this disclosure, the second determining module includes:
[0240] The fifth submodule is used to determine the name of the time-consuming function that caused the lag if the target message experiences a pause during message processing, based on the function call relationship.
[0241] In one embodiment of this disclosure, the stuttering analysis device further includes:
[0242] The display module is used to display the stuttering analysis results, which include the names of the time-consuming messages or functions that caused the stuttering.
[0243] According to one or more embodiments of this disclosure, an electronic device is provided, comprising:
[0244] One or more processors;
[0245] Memory;
[0246] One or more applications, wherein the applications are stored in memory and configured to be executed by one or more processors, and the applications are configured to: perform operations corresponding to the method based on the stuttering analysis.
[0247] According to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, comprising:
[0248] It stores a computer program that, when executed by the processor, implements a stuttering analysis method.
[0249] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0250] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0251] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A cascading failure analysis method, characterized in that, include: A target message is sent to a message queue, and the sending time, start processing time, and processing completion time of the target message are recorded using a first preset function and a second preset function in a preset message processing tool. The message processing tool is constructed as follows: a message processing class including the first preset function and the second preset function is created; the parent class of message processing in the message processing tool is determined using the created message processing class; and the message processing subclass in the message processing tool is obtained by overriding the first preset function and the second preset function through class inheritance. If the target message experiences a delay, the time period during which the delay occurs is determined. The time period during which the delay occurs includes a message waiting period or a message processing period. The message waiting period is the period between the sending time and the start processing time, and the message processing period is the period between the start processing time and the processing completion time. Based on the time period during which the target message experiences lag, the lag analysis results for the target message are determined, including: If the target message experiences a pause during the message waiting period, the message source of the target message is determined based on the first preset function; the message source is analyzed to determine the time-consuming message name that caused the pause. If the target message experiences a pause during the message processing period, the time-consuming function name causing the pause is determined based on the function call relationship of the target message during the message waiting period and the message processing period.
2. The method according to claim 1, characterized in that, The process of sending the target message to the message queue and recording the sending time, start processing time, and processing completion time of the target message includes: The target message is sent to the message queue using a preset message processing tool; The sending time of the target message is recorded using the first preset function of the message processing tool; When a processing request for the target message is received, the start time of processing the target message is recorded; The second preset function of the message processing tool is used to record the time when the processing of the target message is completed.
3. The method according to claim 1, characterized in that, The step of determining the parent class for message processing in the message processing tool using the created message processing class includes: Determine the first message processing parent class, which is the message processing parent class of the code points in the source code of the original message processing tool that directly use message processing; Replace the first message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool; or, Determine the second message processing parent class, which is the message processing parent class corresponding to the message processing subclass in the source code of the original message processing tool; Replace the second message processing parent class with the created message processing class to obtain the message processing parent class in the message processing tool.
4. The method according to any one of claims 1-3, characterized in that, If the target message experiences a delay, determining the time period during which the delay occurs includes: The time period during which the target message is paused is determined based on the function call relationship.
5. The method according to claim 4, characterized in that, The determination of the time period during which the target message experiences lag based on the function call relationship includes: If the time difference between the sending time and the start processing time is greater than a first preset time threshold, it is determined that the target message is experiencing a pause during the message waiting period. If the time difference between the start time and the completion time is greater than the second preset time threshold, it is determined that the target message is experiencing a pause during the message processing period.
6. The method according to claim 1, characterized in that, The method further includes: The stuttering analysis results are displayed, including the name of the time-consuming message that caused the stuttering or the name of the time-consuming function that caused the stuttering.
7. A stuttering analysis device, characterized in that, include: A recording module is used to send a target message to a message queue and record the sending time, start processing time, and processing completion time of the target message using a first preset function and a second preset function in a preset message processing tool. The message processing tool is constructed as follows: a message processing class is created, including the first preset function and the second preset function; the created message processing class is used to determine the parent class of message processing in the message processing tool; and the first preset function and the second preset function are overridden through class inheritance to obtain the message processing subclasses in the message processing tool. The first determining module is used to determine the time period during which the target message experiences a delay if the target message experiences a delay. The time period during which the target message experiences a delay includes a message waiting period or a message processing period. The message waiting period is the period between the sending time and the start processing time, and the message processing period is the period between the start processing time and the processing completion time. The second determining module is used to determine the stuttering analysis result of the target message based on the time period during which the stuttering phenomenon occurs, including: If the target message experiences a pause during the message waiting period, the message source of the target message is determined based on the first preset function; the message source is analyzed to determine the time-consuming message name that caused the pause. If the target message experiences a pause during the message processing period, the time-consuming function name causing the pause is determined based on the function call relationship of the target message during the message waiting period and the message processing period.
8. An electronic device, characterized in that, It includes: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to: perform the stuttering analysis method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the stuttering analysis method according to any one of claims 1-6.
Citation Information
Patent Citations
Application program lag problem data obtaining method and device
CN105589783A
Method and device for monitoring interface jamming
CN106776253A
Jamming positioning method and device
CN111625456A