Lag detection method and device, computer program product and mobile terminal

By using a circular buffer and deep backtracking to obtain the top frame address and call stack of the main thread in stutter detection, the problem of insufficient continuity evidence in existing technologies is solved, achieving stutter detection with high accuracy and low performance loss.

CN121524006APending Publication Date: 2026-02-13SHANGHAI EHI CAR RENTAL CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511715057.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing stuttering detection methods lack continuity of evidence and have weak traceability capabilities, resulting in insufficient accuracy and reliability of stuttering detection.

Method used

By obtaining the top frame address of the main thread according to a preset sampling period and writing it into a circular buffer, when the main thread is unresponsive, all top frame addresses are extracted from the circular buffer to determine the longest resident segment and use it as evidence of lag; when the longest resident segment cannot be provided, deep backtracking is performed to obtain the call stack as evidence of lag.

Benefits of technology

It provides a continuous and complete chain of evidence for stuttering, significantly improving the accuracy and reliability of stuttering detection, reducing equipment performance loss, and ensuring the acquisition of detailed evidence in various scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121524006A_ABST
    Figure CN121524006A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of lagging detection, and further relates to a lagging detection method and device, a computer program product and a mobile terminal. The method comprises the following steps: acquiring a top frame address of a main thread according to a preset sampling period, and writing the top frame address into an annular buffer area; when the main thread does not respond within the preset time, all top frame addresses are extracted from the annular buffer area; and according to all the top frame addresses, determining the longest resident fragment, and taking the address set corresponding to the longest resident fragment as the lagging evidence. According to the method, the running state of the main thread can be monitored in real time, a continuous and complete evidence chain can be provided when jamming occurs, the problems that a traditional single-point frame interception method lacks continuous evidence and is weak in traceability are effectively solved, the accuracy and reliability of jamming detection are remarkably improved, and meanwhile performance loss of equipment can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of frame freezing detection, and further relates to a frame freezing detection method and device, a computer program product and a mobile terminal. BACKGROUND

[0002] Frame freezing detection of a mobile terminal is to determine whether the device has performance problems by monitoring system resource usage and running state of an application. When CPU usage is too high, memory is insufficient, storage read / write speed is too slow or the application has an exception, the device may freeze.

[0003] Existing frame freezing detection methods mostly use a single-point frame capturing method for detection, which lacks continuous evidence and has weak traceability. SUMMARY

[0004] To solve the above technical problems, the present application provides a frame freezing detection method and device, a computer program product and a mobile terminal, which effectively solve the problems of lacking continuous evidence and weak traceability.

[0005] In a first aspect, the present application provides a frame freezing detection method, which comprises: acquiring a top frame address of a main thread according to a preset sampling period, and writing the top frame address into a ring buffer; when the main thread does not respond within a preset time, extracting all top frame addresses from the ring buffer; determining a longest resident segment according to the all top frame addresses, and taking an address set corresponding to the longest resident segment as frame freezing evidence.

[0006] The above frame freezing detection method acquires a top frame address of a main thread according to a preset sampling period and writes it into a ring buffer, extracts all top frame addresses from the ring buffer when the main thread does not respond, and then determines a longest resident segment and takes an address set corresponding to the segment as frame freezing evidence. This method not only can monitor the running state of the main thread in real time, but also can provide a continuous and complete evidence chain when frame freezing occurs, effectively solving the problems of lacking continuous evidence and weak traceability of the traditional single-point frame capturing method, significantly improving the accuracy and reliability of frame freezing detection, and reducing the performance loss of the device.

[0007] In an implementation, the method further comprises: when the ring buffer cannot provide the longest resident segment, performing deep backtracking on the main thread to acquire a call stack of the main thread; and taking the call stack as frame freezing evidence.

[0008] In an implementation, the method further comprises: determining a frame freezing level according to a time length of the longest resident segment.

[0009] In an implementation, the method further comprises: symbolizing the frame freezing evidence; performing uniform fingerprinting and annealing deduplication processing on the symbolized frame freezing evidence, and reporting the processed result.

[0010] The above card detection method further traces the main thread in depth to obtain a call stack and takes the call stack as card evidence when the ring buffer cannot provide the longest resident segment. This multi-level evidence obtaining mechanism ensures that detailed and reliable card evidence can be provided in various scenarios, further improving the comprehensiveness and compatibility of card detection.

[0011] In an implementation, the preset sampling period is a light sampling period.

[0012] In a second aspect, the application provides a card detection device, comprising: a sampling module configured to obtain a top frame address of a main thread according to a preset sampling period; a storage module configured to write the top frame address into a ring buffer; and a processing module configured to: extract all top frame addresses from the ring buffer when the main thread does not respond within a preset time; determine a longest resident segment according to the all top frame addresses; and take an address set corresponding to the longest resident segment as card evidence.

[0013] In an implementation, the processing module is configured to trace the main thread in depth to obtain a call stack of the main thread when the ring buffer cannot provide the longest resident segment; and take the call stack as card evidence.

[0014] In an implementation, the processing module is configured to determine a card level according to a length of the longest resident segment.

[0015] In a third aspect, the application further provides a mobile terminal, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the card detection method of any of the above implementations.

[0016] In a fourth aspect, the application further provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the card detection method of any of the above implementations.

[0017] In a fifth aspect, the application further provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the steps of the card detection method of any of the above implementations.

[0018] Compared with the prior art, the application has at least one of the following beneficial effects: 1. By acquiring the top frame address of the main thread at a preset sampling period and writing it into a ring buffer, when the main thread is not responsive, all top frame addresses are extracted from the ring buffer, and then the longest resident segment is determined, and the address set corresponding to the segment is taken as the stall evidence. This method not only can monitor the running state of the main thread in real time, but also can provide continuous and complete evidence chain when the stall occurs, effectively solving the problem of lack of continuous evidence and weak traceability of traditional single-point frame capturing method, significantly improving the accuracy and reliability of stall detection, and also can reduce the performance loss of the device.

[0019] 2. When the ring buffer cannot provide the longest resident segment, further backtracking of the main thread is performed to obtain the call stack, which is taken as the stall evidence. This multi-level evidence acquisition mechanism ensures that detailed and reliable stall evidence can be provided in various scenarios, further improving the comprehensiveness and compatibility of stall detection. BRIEF DESCRIPTION OF DRAWINGS

[0020] The above-mentioned features, technical characteristics, advantages and implementation methods of the present application will be further described in a clear and understandable manner in combination with the preferred embodiments and the accompanying drawings.

[0021] Figure 1 A flowchart of a stall detection method provided by an embodiment of the present application is shown; Figure 2 A flowchart of determining stall evidence provided by an embodiment of the present application is shown; Figure 3 A structural block diagram of a stall detection device provided by an embodiment of the present application is shown; Figure 4 A structural schematic diagram of a mobile terminal provided by an embodiment of the present application is shown. DETAILED DESCRIPTION

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the specific embodiments of the present application will be described below with reference to the accompanying drawings. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings and other embodiments from these drawings without creative labor.

[0023] In order to make the drawing simple, only the parts related to the invention are shown in each drawing, which does not represent the actual structure of the product. In addition, in order to make the drawing simple and easy to understand, in some drawings, only one of the parts with the same structure or function is shown, or only one of them is marked. In this paper, "one" not only means "only one", but also means "more than one".

[0024] It should be further understood that the term "and / or" used in the description and claims of the application herein is used to mean any one and / or any combination of the associated listed items and includes all possible combinations.

[0025] In this document, unless otherwise indicated and limited, the terms "mount", "connect", "connection" should be understood broadly, for example, can be fixed connection, can also be detachable connection, or integral connection; can be mechanical connection, can also be electrical connection; can be directly connected, can also be indirectly connected through an intermediate medium, can be internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0026] In addition, in the description of the present application, the terms "first", "second" and the like are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0027] It should be noted that the above embodiments can be freely combined as needed. The above is only the preferred embodiment of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should be considered as the protection scope of the present application.

[0028] The card detection of the mobile terminal is to judge whether the device has performance problems by monitoring the system resource usage of the device (such as CPU, memory, storage, etc.) and the running state of the application. When the CPU usage is too high, the memory is insufficient, the storage read-write speed is too slow, or the application program is abnormal, the device may appear to be stuck. The card detection can be realized by the performance monitoring tool of the system.

[0029] For example, in one implementation, the card detection can be performed by single-point frame capturing, that is, the call stack is captured once immediately when the timeout occurs. For another example, in another implementation, the card detection can be performed by continuously capturing the call stack in a fixed time window. However, the former single-point frame capturing scheme lacks continuity evidence and has weak traceability. The latter continuously capturing the call stack scheme will cause performance loss and is not suitable for long-term running of the mobile terminal.

[0030] Therefore, the present application provides a card detection method to solve the problems in the prior art.

[0031] The following will be described with reference to the accompanying drawings: Reference to the accompanying drawings Figure 1 It shows a flowchart of a card detection method provided by an embodiment of the present application. As shown in FIG. 1, it includes: S100, acquire the top frame address of the main thread according to a preset sampling period, and write the top frame address into a ring buffer.

[0032] S110, extract all top frame addresses from the ring buffer when the main thread does not respond within a preset time.

[0033] S120, determine the longest resident segment according to all top frame addresses, and take the address set corresponding to the longest resident segment as the stall evidence.

[0034] The top frame address of the main thread is periodically acquired according to a preset sampling period (the preset sampling period can be a light sampling period, for example, 33 ms), and the top frame address of the main thread is written into a ring buffer. Only the top frame address of the main thread is saved, without symbolization, and the main thread is not suspended. Moreover, the main thread is monitored in real time by a RunLoop observation signal and / or a heartbeat thread (combined with RunLoop Observer and heartbeat detection, two signal sources, complementary in triggering logic, to improve the accuracy of stall determination). When it is monitored that the main thread does not respond within a preset time, it is determined that the main thread stalls. At this time, all stored top frame addresses can be extracted from the main thread.

[0035] When the main thread stalls, the top frame remains unchanged for a long time, that is, the top frame addresses obtained at consecutive sampling points are the same. These consecutive same top frame addresses form a continuous sequence, and this sequence is a segment. Therefore, the longest segment can be calculated according to all stored top frame addresses, that is, the longest resident segment is obtained. At the same time, the set of top frame addresses corresponding to the longest resident segment can be taken as the stall evidence. Then, the stall evidence can be symbolized, and the exception report generated after symbolizing the stall evidence can be reported.

[0036] The embodiment of the present application acquires the top frame address of the main thread according to a preset sampling period and writes it into a ring buffer, extracts all top frame addresses from the ring buffer when the main thread does not respond, and then determines the longest resident segment and takes the address set corresponding to the segment as the stall evidence. This method not only can monitor the running state of the main thread in real time, but also can provide a continuous and complete evidence chain when the stall occurs, effectively solves the problem that the traditional single-point frame capturing method lacks continuous evidence and weak traceability, significantly improves the accuracy and reliability of stall detection, and can also reduce the performance loss of the device.

[0037] Reference is made to the accompanying drawings Figure 2 which shows a flowchart for determining stall evidence provided by an embodiment of the present application. As shown in Figure 2 , it includes: S200, when the ring buffer cannot provide the longest resident fragment, performing a deep backtracking on the main thread to obtain the call stack of the main thread; S210, taking the call stack as the stall evidence.

[0038] If the ring buffer cannot provide the longest resident fragment (at this time, the ring buffer cannot directly provide the longest resident fragment, but the time length corresponding to the longest resident fragment can be provided), a deep backtracking is performed on the main thread to obtain the complete call stack of the main thread as the stall evidence. Then, the stall evidence can be symbolized, and an exception report is generated based on the symbolized stall evidence and is reported.

[0039] The embodiment of the present application further performs a deep backtracking on the main thread to obtain the call stack when the ring buffer cannot provide the longest resident fragment, and takes the call stack as the stall evidence. This multi-level evidence obtaining mechanism ensures that detailed and reliable stall evidence can be provided in various scenarios, and further improves the comprehensiveness and compatibility of the stall detection.

[0040] In some embodiments of the present application, further comprising: determining a stall level according to the time length of the longest resident fragment; symbolizing the stall evidence; performing uniform fingerprinting and annealing deduplication processing on the symbolized stall evidence, and reporting the processed result.

[0041] After obtaining the longest resident fragment, a stall level can be determined according to the time length of the longest resident fragment. For example, the stall level (such as the time length of the longest resident fragment exceeding 0.5s is recorded as warning, exceeding 1s is recorded as severity, and exceeding 2s is recorded as critical). At the same time, the stall evidence is symbolized, and uniform fingerprinting and annealing deduplication processing are performed on the symbolized stall evidence, and an exception report is generated based on the processed result and is reported.

[0042] The embodiment of the present application adopts the way of saving only addresses during the sampling period and symbolizing before reporting, to balance the normal low cost and the complete evidence chain at the triggering time, and the uniform fingerprinting and annealing deduplication processing can avoid the stall event being repeatedly reported in a short time.

[0043] Reference is made to the accompanying drawings Figure 3 which shows a structural block diagram of a stall detection device provided by an embodiment of the present application. As shown in FIG. 1, the stall detection device comprises a sampling module 100, a backtracking module 200, a symbolization module 300, a uniform fingerprinting module 400, an annealing deduplication module 500, and a reporting module 600. Figure 3As shown, the card jam detection apparatus 300 comprises: a sampling module 310 configured to acquire a top frame address of a main thread according to a preset sampling period; a storage module 320 configured to write the top frame address into a ring buffer; and a processing module 330 configured to: extract all top frame addresses from the ring buffer when the main thread does not respond within a preset time; determine a longest resident segment according to the all top frame addresses; and take an address set corresponding to the longest resident segment as card jam evidence.

[0044] The embodiments of the present application acquire the top frame address of the main thread according to the preset sampling period and write it into the ring buffer, extract all top frame addresses from the ring buffer when the main thread does not respond, and then determine the longest resident segment and take the address set corresponding to the segment as card jam evidence. This method can not only monitor the running state of the main thread in real time, but also provide a continuous and complete evidence chain when card jam occurs, effectively solving the problem of lack of continuous evidence and weak traceability of the traditional single-point frame capturing method, significantly improving the accuracy and reliability of card jam detection, and reducing the performance loss of the device.

[0045] In some embodiments of the present application, the processing module is configured to perform deep backtracking on the main thread to acquire a call stack of the main thread when the ring buffer cannot provide the longest resident segment; and take the call stack as card jam evidence.

[0046] In some embodiments of the present application, the processing module is configured to determine a card jam level according to the length of the longest resident segment.

[0047] Reference is made to the accompanying drawings Figure 4 The embodiments of the present application also provide a mobile terminal, which comprises a memory 410, a processor 420 and a computer program stored in the memory 410, and the processor 420 executes the computer program to implement the steps of the card jam detection method of any one of the above embodiments.

[0048] The memory 410 can be a non-volatile memory (NVM), such as including but not limited to: a semiconductor non-volatile memory, a magnetic disk memory, or an optical memory, etc. The semiconductor non-volatile memory includes, for example, but is not limited to: a read-only memory (ROM), or a flash memory, such as: a mask ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read only memory (EEPROM), a NAND flash, or a NOR flash, etc.

[0049] The memory 410 can also be a volatile memory, such as including a random access memory (RAM). The RAM includes, for example, a static random-access memory (SRAM), or a dynamic random-access memory (DRAM), etc. The DRAM includes, for example, a synchronous dynamic RAM (SDRAM), or a double data rate SDRAM (DDR), etc. The DDR includes, for example, but is not limited to: DDR1, DDR2, DDR3,..., DDR5, etc., and can also include future DDR6, etc.

[0050] The processor 420 is a circuit with signal processing capability. In an example, the processor can be a circuit with instruction reading and running capability, such as a central processing unit (CPU), a microcontroller unit (MCU), a micro processor unit (MPU), a graphics processing unit (GPU), or a digital signal processor (DSP), etc. In another example, the processor can realize its processing capability through a logic relationship of hardware circuit, which is fixed or can be reconfigured, such as a special-purpose processor, for example, a processor realized through an application specific integrated circuit (ASIC), a processor realized through a programmable logic device (PLD), or a processor realized through a field programmable gate array (FPGA). In yet another example, the processor can be a hardware circuit designed for artificial intelligence, which can be understood as a kind of ASIC, such as a neural network processing unit (NPU), a tensor processing unit (TPU), a deep learning processing unit (DPU), etc. The present application is not limited by the type of processor.

[0051] A mobile terminal using an embodiment of the present application is basically similar to the method embodiment, so the description is relatively simple, and the relevant parts are described in the method embodiment.

[0052] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps of the stuttering detection method in any of the above embodiments.

[0053] The embodiments of the present application further provide a computer program product, which includes a computer program. The computer program is executed by a processor to implement the steps of the stuttering detection method in any of the above embodiments.

[0054] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.

Claims

1. A method of detecting a clogging, characterized by, The method comprises: acquiring a top frame address of a main thread according to a preset sampling period, and writing the top frame address into a ring buffer; when the main thread does not respond within a preset time, extracting all the top frame addresses from the ring buffer; determining a longest resident segment according to all the top frame addresses, and taking an address set corresponding to the longest resident segment as a stall evidence.

2. The card toner detection method of claim 1, wherein, The method further comprises: when the ring buffer cannot provide the longest resident segment, performing a deep backtracking on the main thread to acquire a call stack of the main thread; taking the call stack as the stall evidence.

3. The card toner detection method of claim 1, wherein, The method further comprises: determining a stall level according to a time length of the longest resident segment.

4. The card toner detection method according to any one of claims 1 to 3, characterized in that, The method further comprises: symbolizing the stall evidence; performing uniform fingerprinting and annealing deduplication processing on the symbolized stall evidence, and reporting a processed result.

5. The card toner detection method according to any one of claims 1 to 3, characterized in that, The preset sampling period is a light sampling period.

6. A clumping detection device, characterized in that The method comprises: a sampling module configured to acquire a top frame address of a main thread according to a preset sampling period; a storage module configured to write the top frame address into a ring buffer; a processing module configured to, when the main thread does not respond within a preset time, extract all the top frame addresses from the ring buffer, determine a longest resident segment according to all the top frame addresses, and take an address set corresponding to the longest resident segment as a stall evidence.

7. The card toner detection device of claim 6, wherein, The processing module is configured to, when the ring buffer cannot provide the longest resident segment, perform a deep backtracking on the main thread to acquire a call stack of the main thread, and take the call stack as the stall evidence.

8. The card toner detection device of claim 6, wherein, The processing module is configured to determine a stall level according to a time length of the longest resident segment.

9. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the steps of the stall detection method of any one of claims 1-5.

10. A mobile terminal comprising a memory, a processor and a computer program stored on the memory, characterized in that The processor executes the computer program to implement the steps of the stall detection method of any one of claims 1-5.