CN113568801B - Frozen screen detection method and device, terminal equipment and computer storage medium - Google Patents
Frozen screen detection method and device, terminal equipment and computer storage medium Download PDFInfo
- Publication number
- CN113568801B CN113568801B CN202010354202.1A CN202010354202A CN113568801B CN 113568801 B CN113568801 B CN 113568801B CN 202010354202 A CN202010354202 A CN 202010354202A CN 113568801 B CN113568801 B CN 113568801B
- Authority
- CN
- China
- Prior art keywords
- message
- main thread
- processed
- input event
- execution
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 56
- 238000012545 processing Methods 0.000 claims abstract description 84
- 230000001360 synchronised effect Effects 0.000 claims abstract description 10
- 238000000034 method Methods 0.000 claims description 37
- 238000012544 monitoring process Methods 0.000 claims description 31
- 238000004590 computer program Methods 0.000 claims description 23
- 238000011084 recovery Methods 0.000 claims description 16
- 230000001960 triggered effect Effects 0.000 claims description 4
- 230000000903 blocking effect Effects 0.000 abstract description 25
- 230000008569 process Effects 0.000 description 18
- 230000006870 function Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 5
- 238000009877 rendering Methods 0.000 description 5
- 230000004044 response Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000005457 optimization Methods 0.000 description 3
- 230000003190 augmentative effect Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000002411 adverse Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3051—Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3089—Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
- G06F11/3093—Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- User Interface Of Digital Computer (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application is suitable for the technical field of data processing, and provides a frozen screen detection method, a frozen screen detection device, terminal equipment and a computer storage medium. In the freeze screen fault detection method provided by the application, the processing time length of the message to be processed in the main thread is monitored, and when the processing time length of the message to be processed is monitored to be greater than or equal to a preset time length threshold value, an input event pipeline connected with the main thread and a message queue of the main thread are checked. If a user input event exists in the input event pipeline or a vertical synchronous signal exists in the message queue, the user perceivable freeze screen fault is indicated to occur, and a freeze screen fault log is recorded. The frozen screen fault log provided by the application can judge whether the message blocking fault of the current main thread is perceptible by a user according to the user input event and the vertical synchronous signal, so that the frozen screen fault can be accurately identified, and the problems that the existing frozen screen detection scheme has low accuracy and is easy to influence the use experience of the user are solved.
Description
Technical Field
The application belongs to the technical field of data processing, and particularly relates to a frozen screen detection method, a frozen screen detection device, terminal equipment and a computer storage medium.
Background
The frozen screen means that the terminal equipment cannot respond to the control operation of the user within a certain time. At present, the reasons for the failure of the frozen screen mainly comprise two kinds of problems, namely a system problem and a problem of an application program.
When there is a message congestion and blocking failure in the main thread of the application, there may be a freeze screen failure. At this point, the entire system is normal, with only the interface of the failed application stuck.
When the terminal equipment has a frozen screen fault, the use experience of a user can be greatly influenced. Therefore, some schemes for detecting the main thread state of the application program currently exist, when the terminal equipment detects that the main thread of the application program is blocked by the messages through the schemes, the frozen screen fault is judged to occur, and the terminal equipment is instructed to execute corresponding application recovery operation.
However, the accuracy of the frozen screen detection scheme is low, and the non-frozen screen fault is easily and mistakenly identified as the frozen screen fault, so that the terminal equipment mistakenly executes the application recovery operation, and the use experience of a user is affected.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a method, an apparatus, a terminal device, and a computer storage medium for detecting a frozen screen, so as to solve the problem that the existing frozen screen detection scheme has low accuracy and is easy to affect the use experience of a user.
A first aspect of an embodiment of the present application provides a frozen screen detection method, including:
monitoring the processing time of a message to be processed in a main thread;
if the processing time length of the message to be processed is greater than or equal to a preset time length threshold value, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, and recording a frozen screen fault log.
When the processing time length of the message to be processed is greater than or equal to the preset time length threshold, the message blocking fault is indicated to occur to the main thread. However, a main thread occurrence of a message blocking failure does not necessarily indicate the occurrence of a freeze screen failure.
The terminal device may thus also detect an event input pipe connected to the main thread. User input events in the input event pipeline need to be processed and responded to by the main thread.
When the main thread generates a message blocking fault, if the terminal equipment detects that a user input event exists in an input event pipeline connected with the main thread, the main thread cannot timely process the user input event, so that an application program corresponding to the main thread cannot timely respond to the operation of a user, the user can perceive that the application program is blocked, and at the moment, the terminal equipment can judge that a frozen screen fault occurs and record a frozen screen fault log.
In a possible implementation manner of the first aspect, the processing duration includes a residence duration;
the monitoring of the processing time of the message to be processed in the main thread comprises the following steps:
acquiring a first time when the message to be processed enters a message queue of the main thread and a second time when the message to be processed leaves the message queue;
calculating the residence time of the message to be processed according to the first time and the second time;
if the processing time length of the message to be processed is greater than or equal to a preset time length threshold, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, determining that a frozen screen fault occurs, and recording a frozen screen fault log includes:
If the residence time of the message to be processed is greater than or equal to a preset residence threshold value, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, grabbing stack information of the main thread, and recording the grabbed stack information as a first frozen screen fault log.
It should be noted that, the processing duration of the message to be processed may include the residence duration. When the residence time of the message to be processed is greater than or equal to a preset residence threshold value, the main thread is indicated to block the message because too many messages to be processed are backlogged.
At this time, if the terminal device detects that a user input event exists in an input event pipeline connected with the main thread, the main thread cannot timely process the user input event, so that an application program corresponding to the main thread cannot timely respond to user operation, the user can perceive that the application program is blocked, at this time, the terminal device can determine that a frozen screen fault occurs, and record a first frozen screen fault log.
In a possible implementation manner of the first aspect, the processing duration includes an execution duration;
The monitoring of the processing time of the message to be processed in the main thread comprises the following steps:
when the message to be processed leaves the message queue, timing the execution duration of the message to be processed;
if the processing time length of the message to be processed is greater than or equal to a preset time length threshold, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, determining that a frozen screen fault occurs, and recording a frozen screen fault log includes:
when the execution time length of the message to be processed is greater than or equal to a preset execution threshold value, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, grabbing stack information of the main thread, and recording the grabbed stack information as a second frozen screen fault log.
It should be noted that, the processing duration of the message to be processed may include an execution duration. When the execution duration of the message to be processed is greater than or equal to the preset duration threshold, the main thread is indicated to cause message blocking faults because the execution duration of the message to be processed is too long.
At this time, if the terminal device detects that a user input event exists in an input event pipeline connected with the main thread, the main thread cannot timely process the user input event, so that an application program corresponding to the main thread cannot timely respond to the operation of a user, the user can perceive that the application program is blocked, and at this time, the terminal device can determine that a frozen screen fault occurs and record a second frozen screen fault log.
In a possible implementation manner of the first aspect, when the execution time of the message to be processed is greater than or equal to a preset execution threshold, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected to the main thread or a vertical synchronization signal exists in a message queue of the main thread, determining that a freeze screen fault occurs, capturing stack information of the main thread, and recording the captured information as a second freeze screen fault log includes:
when the execution duration of the message to be processed is greater than or equal to a first preset execution threshold, if the execution completion signal of the message to be processed is not detected, grabbing stack information of the main thread, and storing the grabbed stack information;
When the execution duration of the message to be processed is greater than or equal to a second preset execution threshold, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, and recording the grabbed stack information as a second frozen screen fault log, wherein the first preset execution threshold is smaller than the second preset execution threshold.
After the first preset execution threshold value and the second execution threshold value are set, the terminal device can grasp the stack information of the main thread in advance when the execution duration of the message to be processed is greater than or equal to the first preset execution threshold value, and can ensure that the stack information is the stack information of the frozen screen fault site in advance, so that the accuracy of the generated second frozen screen fault log is ensured.
In a possible implementation manner of the first aspect, the method further includes:
and if the execution duration of the message to be processed is greater than or equal to the first preset execution threshold and less than the second preset execution threshold when the execution completion signal of the message to be processed is received, recording the captured stack information as a katon fault log.
It should be noted that, if the execution duration of a certain message to be processed is greater than or equal to the first preset execution threshold and less than the second preset execution threshold, the execution duration of the message to be processed is longer, and although the frozen screen fault is not caused, the message to be processed needs to be alerted. At this time, the terminal device may record the stack information captured in advance as a katon fault log, so that a developer performs optimization adjustment according to the katon fault log.
In a possible implementation manner of the first aspect, the monitoring a processing duration of a message to be processed in the main thread includes:
and monitoring the processing time of the message to be processed in the main thread through a first thread independent of the main thread.
It should be noted that, the terminal device may monitor, by using the first thread, a processing duration of each message to be processed in the main thread. The main thread and the first thread are mutually independent, so that the monitoring result of the first thread is not influenced when the main thread has a message blocking fault.
In a possible implementation manner of the first aspect, after the determining that the freeze screen fault occurs, the method further includes:
and executing preset application recovery operation on the application program corresponding to the main thread.
When the preset application recovery operation is set in the terminal device, the terminal device may execute the preset application recovery operation on the application program with the frozen screen fault after detecting the frozen screen fault.
For example, the terminal device may restart an application program when the terminal device finds that a freeze screen failure occurs in the application program.
A second aspect of an embodiment of the present application provides a frozen screen detection apparatus, including:
the time length monitoring module is used for monitoring the processing time length of the message to be processed in the main thread;
and the frozen screen detection module is used for judging that a frozen screen fault occurs and recording a frozen screen fault log if the processing time length of the message to be processed is greater than or equal to a preset time length threshold value and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronous signal exists in a message queue of the main thread.
In a possible implementation manner of the second aspect, the processing duration includes a residence duration;
the duration monitoring module comprises:
a time obtaining sub-module, configured to obtain a first time when the message to be processed enters the message queue of the main thread and a second time when the message to be processed leaves the message queue;
A residence time length sub-module, configured to calculate a residence time length of the message to be processed according to the first time and the second time;
the frozen screen detection module comprises:
and the first frozen screen sub-module is used for judging that frozen screen faults occur if the residence time of the message to be processed is greater than or equal to a preset residence threshold value, a user input event exists in an input event pipeline connected with the main thread or a vertical synchronous signal exists in a message queue of the main thread, grabbing stack information of the main thread, and recording the grabbed stack information as a first frozen screen fault log.
In a possible implementation manner of the second aspect, the processing duration includes an execution duration;
the duration monitoring module comprises:
an execution timing sub-module, configured to time an execution duration of the message to be processed when the message to be processed leaves the message queue;
the frozen screen detection module comprises:
and the second frozen screen sub-module is used for judging that a frozen screen fault occurs when the execution time of the message to be processed is longer than or equal to a preset execution threshold value, and grabbing stack information of the main thread and recording the grabbed stack information as a second frozen screen fault log if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread.
In a possible implementation manner of the second aspect, the second freeze screen submodule includes:
the information grabbing sub-module is used for grabbing the stack information of the main thread and storing the grabbed stack information if the execution completion signal of the message to be processed is not detected when the execution duration of the message to be processed is greater than or equal to a first preset execution threshold value;
and the frozen screen judging submodule is used for judging that a frozen screen fault occurs if the execution time length of the message to be processed is greater than or equal to a second preset execution threshold value, if an execution completion signal of the message to be processed is not detected, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, and recording the grabbed stack information as a second frozen screen fault log, wherein the first preset execution threshold value is smaller than the second preset execution threshold value.
In a possible implementation manner of the second aspect, the second frozen screen sub-module further includes:
and the stuck judging sub-module is used for recording the grabbed stack information as a stuck fault log if the execution duration of the message to be processed is greater than or equal to the first preset execution threshold value and less than the second preset execution threshold value when the execution completion signal of the message to be processed is received.
In a possible implementation manner of the second aspect, the duration monitoring module is specifically configured to monitor, by a first thread independent from the main thread, a processing duration of a message to be processed in the main thread.
In a possible implementation manner of the second aspect, the apparatus further includes:
and the application recovery module is used for executing preset application recovery operation on the application program corresponding to the main thread.
A third aspect of the embodiments of the present application provides a terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, which when executed by the processor causes the terminal device to carry out the steps of the method as described above.
A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, causes a terminal device to carry out the steps of the method as described above.
A fifth aspect of the embodiments of the present application provides a computer program product for causing a terminal device to carry out the steps of the method as described above when the computer program product is run on the terminal device.
Compared with the prior art, the embodiment of the application has the beneficial effects that:
in the frozen screen detection method, the processing time of the message in the main thread of the application program is monitored. If there is a message with a processing time length greater than or equal to the preset time length threshold, the processing time length of the message is overtime. At this time, it is not directly determined that there is a freeze screen failure, but a message queue of the incoming event pipe and the main thread is queried. If a user input event associated with the main thread exists in the input event pipeline or a vertical synchronous signal exists in a message queue of the main thread, the user operation indicating that the application program does not respond exists, the user can perceive that the interface of the application program is blocked, and the terminal equipment only judges that the frozen screen fault exists.
In the process of judging the frozen screen fault, by combining the user input event and the vertical synchronous signal, whether the user can perceive that the processing time of the message is overtime or not can be known, and whether the frozen screen fault exists or not is judged pertinently, so that the accuracy of detecting the frozen screen fault is improved, the condition that the message processing overtime condition which cannot be perceived by some users is judged to be the frozen screen fault is avoided, and the problems that the accuracy is low and the use experience of the user is easily influenced in the existing frozen screen detection scheme are solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram of a system architecture according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a frozen screen detection method according to an embodiment of the application;
FIG. 3 is a schematic diagram of a message processing timeline provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of another message processing timeline provided by an embodiment of the present application;
fig. 5 is a schematic diagram of an application scenario provided in an embodiment of the present application;
fig. 6 is a schematic diagram of another application scenario provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a freeze screen detection device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The frozen screen detection method provided by the embodiment of the application can be applied to terminal equipment such as mobile phones, tablet computers, wearable equipment, vehicle-mounted equipment, augmented reality (augmented reality, AR)/Virtual Reality (VR) equipment, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA) and the like, and the embodiment of the application does not limit the specific types of the terminal equipment.
For example, the terminal device may be a Station (ST) in a WLAN, which may be a cellular telephone, a cordless telephone, a Session initiation protocol (Session InitiationProtocol, SIP) telephone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (Personal Digital Assistant, PDA) device, a handheld device with wireless communication capabilities, a computing device or other processing device connected to a wireless modem, an in-vehicle device, a car networking terminal, a computer, a laptop computer, a handheld communication device, a handheld computing device, a satellite radio, a wireless modem card, a television Set Top Box (STB), a smart television, a customer premise equipment (customer premise equipment, CPE) and/or other devices for communicating over a wireless system, as well as next generation communication systems, such as mobile terminals in a 5G network or mobile terminals in a future evolving public land mobile network (Public Land Mobile Network, PLMN) network, etc.
The frozen screen means that the terminal equipment cannot respond to the control operation of the user within a certain time. At present, the reasons for the failure of the frozen screen mainly comprise two kinds of problems, namely a system problem and a problem of an application program.
When there is a message congestion and blocking failure in the main thread of the application, there may be a freeze screen failure. At this point, the entire system is normal, with only the interface of the failed application stuck.
When the terminal equipment has a frozen screen fault, the use experience of a user can be extremely influenced. The current freeze screen detection techniques are mainly program unresponsive (Application Not Responding, ANR) detection techniques and Ping Pong (Ping/Pong) detection mechanisms.
In the ANR detection technology, a terminal device monitors whether an application program responds overtime from a system, and after the application program responds overtime, the terminal device performs stack grabbing processing on a main thread of the application program, and records the grabbed stack information as a frozen screen fault log.
In the Ping/Pong detection mechanism, the terminal device starts an independent thread, the independent thread periodically sends Ping messages to the main thread of the application program, and the main thread returns Pong messages to the independent thread after receiving the Ping messages. If the main thread fails to return the Pong message on time, the main thread is considered to be blocked, stack grabbing processing is carried out on the main thread, and the grabbed stack information is recorded as a frozen screen fault log.
The frozen screen detection schemes are used for detecting whether the main thread of the application program is blocked or not. Once the main thread of the application program is blocked, a freeze failure is considered to occur. However, when the main thread of the application program has a message blocking condition, it may be that the bottom operation of the application program is blocked, and it may not be that the interface of the application program is blocked. When the bottom layer of the application program operates the card, the user is unaware and the use experience of the user is not affected.
At this time, if the terminal device performs the application recovery operation, such as restarting the application program, the user experience may be adversely affected.
In view of the above, the embodiments of the present application provide a method, an apparatus, a terminal device, and a computer storage medium for detecting a frozen screen, so as to solve the problem that the existing frozen screen detection scheme has low accuracy and is easy to affect the use experience of a user.
Referring to fig. 1, fig. 1 is a system architecture diagram of a terminal device according to an embodiment of the present application. The system architecture of the terminal device may include: input subsystem 101, main thread 102, and input event pipe 103.
The input subsystem 101, the main thread 102, and the input event pipe 103 are all software structures of the terminal device.
The input subsystem 101 is configured to receive various user input events, and distribute the user input events to corresponding modules for processing. The user input event may be a hardware-triggered event in which the user operates the terminal device, for example, the user clicks on a screen of the terminal device to trigger the user input event.
The terminal device may be internally provided with one or more application programs. When an application is started, the operating system of the terminal device creates a main thread 102 of the application, which main thread 102 is used for processing various types of messages related to the application.
When the input subsystem 101 needs to distribute a user input event to an application for processing, the input subsystem 101 creates an input event pipe 103 connected to the main thread 102 of the application, and the input subsystem 101 distributes the user input event to the main thread 102 of the application through the input event pipe 103. One input event pipe 103 is connected to only the main thread 102 of one application program, and one or more input event pipes 103 may exist between the input subsystem 101 and a certain main thread 102.
The following embodiments of the present application mainly take an architecture scenario shown in fig. 1 as an example, to illustrate a frozen screen detection method provided by the embodiments of the present application. Referring to fig. 2, the method may include:
s201, monitoring the processing time of a message to be processed in a main thread;
when the terminal equipment needs to detect the frozen screen fault, the terminal equipment can monitor the processing time of each message to be processed in the main thread of the application program.
The mode of the terminal equipment for monitoring the main thread can be selected according to actual requirements. In some embodiments, the terminal device may enable a first thread, through which the processing duration of the message to be processed in the main thread is monitored.
The first thread is mutually independent from the main thread of the application program, so that the monitoring result of the first thread is prevented from being influenced when the main thread of the application program has a message blocking fault.
S202, if the processing time length of the message to be processed is greater than or equal to a preset time length threshold value, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, and recording a frozen screen fault log.
When the terminal equipment monitors the processing time length of each message to be processed, if the processing time length of any message to be processed is larger than or equal to a preset time length threshold value, the terminal equipment indicates that the main thread may have a message blocking fault. At this time, the terminal device may check whether a user input event exists in an input event pipe connected to the main thread, and check whether a vertical synchronization (vsync) signal exists in a message queue of the main thread.
The input subsystem distributes user input events to each input event pipeline, and waits for a main thread connected with the input event pipeline to acquire and process the user input events in the input event pipeline.
Wherein the user input event is an event triggered by the user operating the terminal device. For example, when a user is playing a game, the user clicks a screen of the terminal device, a sensor of the terminal device detects a click operation of the user, a user input event corresponding to the click operation is generated, the input subsystem distributes the user input event to a main thread of the game application program, the main thread of the game application program processes the user input event, and the user input event is responded to the click operation of the user.
The vsync signal is generated by hardware or software in the terminal device, and after the vsync signal is generated, the display subsystem of the terminal device distributes the vsync signal to the message queue of the main thread of the corresponding application program, and the main thread of the application program processes the vsync signal. The vsync signal is used to coordinate the frame rate and the screen refresh frequency. The frame rate is the rate at which the graphics rendering components within the terminal device generate image frames, and the screen refresh frequency refers to the frequency at which the terminal device refreshes the screen. In general, the frame rate and the screen refresh frequency are difficult to be kept consistent, and the display screen displayed by the terminal device is likely to be torn. Accordingly, the terminal device can periodically trigger the vsync signal through the vertical synchronization function, and control the time at which the graphic rendering component performs graphic rendering and the time at which the screen is refreshed through the vsync signal, thereby keeping the frame rate and the screen refresh screen consistent. For example, when the user starts the vertical synchronization function of the terminal device while playing the game and controls the frame rate and the refresh frequency to 60Hz, the terminal device triggers the vertical synchronization signal every 1/60 second to instruct the graphics rendering component to perform graphics rendering and screen refreshing, thereby ensuring that the frame rate and the screen refresh frequency are maintained at 60Hz.
User input events in the input event pipe and the vsync signal in the message queue of the main thread need to be processed and responded to by the main thread. Therefore, when the main thread has a message blocking fault, if the terminal device detects that a user input event exists in an input event pipeline connected with the main thread or a vsync signal exists in a message queue of the main thread, the main thread cannot timely process the user input event and/or the vsync signal, so that the application program cannot timely respond to the operation of a user and refresh the display interface of the application program, the user can perceive that the application program is blocked, and at the moment, the terminal device can determine that a freeze screen fault exists and record a freeze screen fault log.
For example, the user is playing a game using a mobile phone, and the vertical synchronization function is turned on. At a certain moment, the terminal equipment detects that the processing time length of a certain message in the main thread is longer than a preset time length threshold value, and if a vsync signal is not processed in a message queue of the main thread, the terminal equipment cannot process the vsync signal in time and cannot refresh a game picture of the game application in time, so that the game picture is blocked, and a user can directly perceive that the application program is blocked. At this time, the terminal device may determine that a freeze failure has occurred, and record a freeze failure log.
If the terminal device detects that the input event pipeline connected with the main thread has no user input event and the message queue of the main thread has no vsync signal when the main thread has a message blocking fault, the terminal device indicates that all operations of the user have been responded, and the user is unaware even if the main thread has the message blocking fault. The definition of the frozen screen means that the terminal equipment cannot respond to the control operation of the user within a certain time, so that the frozen screen fault is judged not to occur under the condition that the user cannot perceive that the application program is blocked.
For example, when a user uses an application, at some point, the main thread of the application experiences a message blocking failure. However, only some messages of the bottom operation are unprocessed in the message queue of the main thread, no vsync signal exists, no user input event exists in the input event pipeline connected with the main thread, and the application program is indicated to refresh the display interface of the previous frame, and no unresponsive user operation exists. At this time, although the main thread has a message blocking failure, it is not perceived by the user, and it should be determined that the freeze failure has not occurred according to the definition of the freeze failure.
In the freeze screen detection method of the embodiment, when judging whether the application program has a freeze screen fault, the message queues of the input event pipeline and the main thread are detected, whether a user can perceive that the main thread of the application program has a message blocking fault or not is confirmed according to whether a user input event exists in the input event pipeline and whether a vsync signal exists in the message queue, and whether the freeze screen fault exists is judged pertinently, so that the accuracy of detecting the freeze screen fault is improved, the problem that the message blocking fault of the main thread which cannot be perceived by some users is judged to be the freeze screen fault is solved, and the problems that the existing freeze screen detection scheme has low accuracy and is easy to influence the use experience of the user are solved.
In addition, the processing duration of the message to be processed described above may be defined according to actual situations.
In one possible implementation, the processing duration may be a time interval between a time point when the message to be processed enters the message queue of the main thread and a time point when the message processing is completed.
In this case, when the terminal device performs the freeze screen detection, it may be detected whether the main thread has a message blocking failure. However, the terminal device cannot further confirm whether the message blocking failure is caused by too many messages to be processed in the main thread or by a certain timeout of processing of the messages to be processed.
Thus, in another possible implementation, the terminal device may divide the processing duration into a residence duration and an execution duration. The residence time length represents the time that the message to be processed resides in the message queue of the main thread.
The terminal equipment can acquire the first time when the message to be processed enters the message queue of the main thread and the second time when the message to be processed leaves the message queue, and calculates the residence time of the message to be processed according to the first time and the second time.
For example, the main thread may send a first signal to the first thread when a message to be processed enters the message queue, and the first thread determines a first time when the message to be processed enters the message queue according to the first signal; when the message to be processed leaves the message queue, the main thread can send a second signal to the first thread, and the first thread determines a second time when the message to be processed leaves the message queue according to the second signal; the first thread then subtracts the first time from the second time to obtain a residence time of the message to be processed.
If the terminal equipment detects that the residence time of any message to be processed is greater than or equal to the preset residence threshold value, the main thread causes message blocking faults because a large number of messages to be processed are backlogged. At this time, the terminal device may inquire whether a user input event exists in an input event pipe connected to the main thread and whether a vsync signal exists in a message queue.
If the terminal equipment detects that a user input event exists in an input event pipeline connected with the main thread or a vsync signal exists in a message queue, the terminal equipment judges that a frozen screen fault occurs, grabs stack information of the main thread, and records the grabbed stack information as a first frozen screen fault log.
If the terminal device detects that no user input event exists in an input event pipeline connected with the main thread and no vsync signal exists in the message queue, the terminal device determines that the frozen screen fault does not occur.
The execution duration represents the time that a message to be processed leaves the message queue to the time that the message is processed to completion.
When the message to be processed leaves the message queue of the main thread, the terminal equipment counts the execution duration of the message to be processed until receiving the execution completion signal of the message to be processed, and stops counting.
For example, the main thread may send a second signal to the first thread when a message to be processed leaves the message queue, and the first thread starts to time the execution duration of the message according to the second signal; after the message processing is completed, the main thread sends an execution completion signal to the first thread, and the first thread stops timing the execution duration of the message.
When the terminal equipment detects that the execution time length of any message to be processed is greater than or equal to a preset execution threshold value, if the execution completion information of the message to be processed is not detected yet, the execution time length of the message to be processed is too long, and message blocking faults are caused in a main thread. At this time, the terminal device may inquire whether a user input event exists in an input event pipe connected to the main thread and whether a vsync signal exists in a message queue.
If the terminal equipment detects that a user input event exists in an input event pipeline connected with the main thread or a vsync signal exists in a message queue, the terminal equipment judges that a frozen screen fault occurs, grabs stack information of the main thread, and records the grabbed stack information as a second frozen screen fault log.
If the terminal device detects that no user input event exists in an input event pipeline connected with the main thread and no vsync signal exists in the message queue, the terminal device determines that the frozen screen fault does not occur.
In the method for detecting the frozen screen, the processing time of the message to be processed is divided into the residence time and the execution time, the residence time and the execution time are monitored respectively, the cause of the message blocking fault of the main thread can be effectively distinguished, and the corresponding first frozen screen fault log or the second frozen screen fault log is recorded, so that a developer can conduct targeted optimization adjustment according to the first frozen screen fault log or the second frozen screen fault log.
In addition, when the frozen screen fault occurs, the terminal equipment needs to grab stack information of the main thread to generate a frozen screen fault log. In one possible implementation manner, the terminal device may determine whether a freeze screen fault occurs according to a preset execution threshold, a user input event and a vsync signal, and execute the action of grabbing the stack information after determining that the freeze screen fault occurs.
When the terminal equipment adopts the scheme to capture the stack information of the main thread, the stack information captured by the terminal equipment does not necessarily cause the stack information of the main thread when the frozen screen fault occurs.
For example, as shown in fig. 3, it is assumed that the preset execution threshold is set to 2s. The terminal equipment detects that the message A leaves a message queue of the main thread at the moment T1 to start being processed, and starts timing the execution duration of the message A. At the time of T2, the execution duration of the message A is equal to 2s, and if a user input event exists in an input event pipeline connected with the main thread, the terminal equipment judges that the application program has a frozen screen fault. Then, the terminal device grabs the stack information of the main thread at the time T4. However, before the terminal device captures the stack information of the main thread, the message a is processed at time T3, and the main thread starts to process the next message B to be processed, so that when the terminal device captures the stack information of the main thread at time T4, the captured stack information is the stack information of the main thread processing message B, and not the stack information of the main thread processing message a. At this time, the stack information grabbed by the terminal device is not stack information when the frozen screen fault occurs, and the frozen screen fault log recorded by the terminal device cannot assist the developer in locating the cause of the frozen screen fault.
In another possible implementation, the terminal device may set two preset execution thresholds, a first preset execution threshold and a second preset execution threshold, respectively. The specific values of the first preset execution threshold and the second preset execution threshold can be set according to actual conditions, and the value of the first preset execution threshold is smaller than the second preset execution threshold. For example, the terminal device may set the first preset execution threshold to 1s and the second preset execution threshold to 2s.
And after the execution duration of the message to be processed starts to be timed, the terminal equipment monitors the execution duration of the message to be processed.
When the execution duration of the message to be processed is greater than or equal to a first preset execution threshold, if the terminal equipment does not acquire the execution completion signal of the message to be processed, the execution duration of the message to be processed is long, which may cause a frozen screen fault, and the terminal equipment can grasp stack information of the main thread and store the grasped stack information.
When the execution duration of the message to be processed is greater than or equal to a second preset execution threshold, if the terminal device has not acquired the execution completion information of the message to be processed, the terminal device may detect whether a user input event exists in an input event pipe connected to the main thread and whether a vsync signal exists in a message queue.
If the input event pipeline does not have a user input event and the message queue does not have a vsync signal, the terminal device determines that the application program has no frozen screen fault.
If the input event pipeline has a user input event or a vsync signal exists in a message queue, the execution duration of the message to be processed is excessively long, so that a message blocking fault of a main thread perceived by a user is caused, the terminal equipment judges that the application program has a frozen screen fault, and the prestored stack information is recorded as a second frozen screen fault log.
Since the captured stack information is captured by the terminal device during the process of processing the message to be processed, the captured stack information can be ensured to be stack information of a frozen screen fault site.
For example, as shown in fig. 4, it is assumed that the first preset execution threshold is set to 1s and the second preset execution threshold is set to 2s. The terminal equipment detects that the message A leaves a message queue of the main thread at the moment T1 to start being processed, and starts timing the execution duration of the message A. At the time T5, the execution duration of the message A is equal to 1s, the terminal equipment grabs the stack information of the main thread, saves the stack information, and continues to monitor the execution duration of the message A. At the time T2, the execution duration of the message A is equal to 2s, and if the terminal equipment monitors that the message A is not processed, the input event pipeline connected with the main thread and the message queue are detected. And if the terminal equipment finds that the user input event exists in the input event pipeline, the terminal equipment judges that the application program has a frozen screen fault. And the terminal equipment records the stack information acquired at the time T5 as a second frozen screen fault log at the time T4. At this time, since the stack information is grabbed at the time T5 and the message a is not processed at the time T5, even if the message a is processed at the time T3, the main thread starts to process the message B to be processed, and the terminal device can ensure that the grabbed stack information is the stack information when the frozen screen fault occurs, and ensure the accuracy of the second frozen screen fault log, thereby effectively assisting the developer to locate the cause of the frozen screen fault.
Secondly, if the terminal device receives the execution completion signal of the message to be processed, the execution duration of the message to be processed is greater than or equal to the first preset execution threshold value and less than the second preset execution threshold value, which indicates that the message to be processed occupies more time in the processing process, but does not cause the message blocking fault of the main thread yet. At this time, the terminal device may record the previously stored stack information as a katon fault log, so that a developer may perform optimization adjustment on the application program according to the katon fault log.
After determining that the application program has a frozen screen fault, if a developer presets an application recovery operation, the terminal device can execute the preset application recovery operation on the application program corresponding to the main thread, so that the application program is recovered to a normal working state as soon as possible, and the use experience of a user is improved.
The specific content of the application recovery operation may be set according to the actual situation. For example, the application restore operation described above may restart the application.
In order to better explain the frozen screen detection method provided by the embodiment of the application, the following description is made with reference to a specific scene.
As shown in fig. 5 and fig. 6, when a user starts a certain application program on a terminal device, the terminal device creates a main thread 502 corresponding to the application program, and the main thread 502 includes a message queue 5021 and a processing module 5022. The input subsystem 501 system of the terminal device creates an input event pipe 503 connected to the main thread 502, and the terminal device enables a thread 504 independent from the main thread 502, monitors the processing time of each message to be processed in the main thread 502 by the thread 504, detects whether a user input event exists in the input event pipe 503, and checks whether a vsync signal exists in the message queue 5021.
Scene one: assume that a preset duration threshold set in the terminal device is 5s.
When a message a to be processed enters the message queue 5021, the main thread 502 sends a first signal to the thread 504, and the thread 504 starts to time the processing duration of the message a according to the first signal.
When the processing time length of the message a is greater than or equal to 5s, the thread 504 has not received the execution completion signal corresponding to the message a sent by the main thread 502, which indicates that the processing time length of the message a is timeout.
At this point, the thread 504 queries whether a user input event is present in the input event pipe 503 and whether a vsync signal is present in the message queue 5021. If the thread 504 inquires that the user input event exists in the input event pipeline 503, it is determined that a freeze screen fault occurs, stack information of the main thread 502 is grabbed, and the grabbed stack information is recorded as a freeze screen fault log.
Scene II: assume that a preset residence threshold set in the terminal device is 2s.
When message B to be processed enters the message queue, the main thread 502 sends a first signal to the thread 504, and the thread 504 obtains a first time when the message B enters the message queue according to the first signal. When message B leaves the message queue, main thread 502 sends a second signal to thread 504, and thread 504 obtains a second time when message B leaves the message queue based on the second signal.
Thread 504 subtracts the first time from the second time to obtain the residence time of message B as 3s. At this point, the thread 504 queries whether a user input event is present in the input event pipe 503 and whether a vsync signal is present in the message queue 5021. If the thread 504 inquires that the user input event exists in the input event pipeline 503, it is determined that a frozen screen fault occurs, stack information of the main thread 502 is grabbed, and the grabbed stack information is recorded as a first frozen screen fault log.
Scene III: assuming that a preset residence threshold value set in the terminal equipment is 2s, and a preset execution threshold value is 3s.
When the message C to be processed enters the message queue, the main thread 502 sends a first signal to the thread 504, and the thread 504 obtains a first time when the message C enters the message queue according to the first signal. When message C leaves the message queue, main thread 502 sends a second signal to thread 504, and thread 504 obtains a second time when message C leaves the message queue based on the second signal.
The thread 504 subtracts the first time from the second time to obtain a residence time of 1s for the message C, where the residence time of the message C is less than the preset residence threshold. At this point, thread 504 begins to time the execution duration of message C.
When the execution time length of the message C is greater than or equal to 3s, the thread 504 has not received the execution completion signal corresponding to the message C sent by the main thread 502, which indicates that the execution time length of the message C is timeout.
At this point, the thread 504 queries whether a user input event is present in the input event pipe 503 and whether a vsync signal is present in the message queue 5021. If the thread 504 inquires that the user input event exists in the input event pipeline 503, it is determined that a frozen screen fault occurs, stack information of the main thread 502 is grabbed, and the grabbed stack information is recorded as a second frozen screen fault log.
Scene four: assuming that a preset residence threshold value set in the terminal equipment is 2s, the first preset execution threshold value is 2s, and the second preset execution threshold value is 3s.
When a message D to be processed enters the message queue, the main thread 502 sends a first signal to the thread 504, and the thread 504 obtains a first time when the message D enters the message queue according to the first signal. When message D leaves the message queue, main thread 502 sends a second signal to thread 504, and thread 504 obtains a second time when message D leaves the message queue based on the second signal.
The thread 504 subtracts the first time from the second time to obtain a residence time of 1s for the message D, where the residence time of the message D is less than the preset residence threshold. At this point, thread 504 begins to time the execution duration of message D.
When the execution time length of the message D is greater than or equal to 2s, and the thread 504 has not received the execution completion signal corresponding to the message D sent by the main thread 502, the thread 504 grabs the stack information of the main thread 502, and stores the grabbed stack information.
When the execution duration of the message D is 2.3s, the thread 504 receives the execution completion signal corresponding to the message D sent by the main thread 502, and the thread 504 stops timing the execution duration of the message D, and records the stored stack information as a katon fault log.
Scene five: assuming that a preset residence threshold value set in the terminal equipment is 2s, the first preset execution threshold value is 2s, and the second preset execution threshold value is 3s.
When a message E to be processed enters the message queue, the main thread 502 sends a first signal to the thread 504, and the thread 504 obtains a first time when the message E enters the message queue according to the first signal. When message E leaves the message queue, main thread 502 sends a second signal to thread 504, and thread 504 obtains a second time when message E leaves the message queue based on the second signal.
The thread 504 subtracts the first time from the second time to obtain a residence time of 1s for the message E, where the residence time of the message E is less than the preset residence threshold. At this point, thread 504 begins to time the execution duration of message E.
When the execution time of the message E is greater than or equal to 2s, the thread 504 has not received the execution completion signal corresponding to the message E sent by the main thread 502, and then the thread 504 grabs the stack information of the main thread 502, and stores the grabbed stack information.
When the execution time of the message E is greater than or equal to 2s, the thread 504 has not received the execution completion signal corresponding to the message E sent by the main thread 502, and the thread 504 inquires whether a user input event exists in the input event pipe 503 and whether a vsync signal exists in the message queue 5021. If the thread 504 inquires that the user input event exists in the input event pipeline 503, it determines that a freeze screen fault occurs, and records the stored stack information as a second freeze screen fault log.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
Referring to fig. 7, an embodiment of the present application provides a freeze screen detection device, for convenience of description, only a portion related to the present application is shown, and as shown in fig. 7, the freeze screen detection device includes,
a duration monitoring module 701, configured to monitor a processing duration of a message to be processed in a main thread;
the frozen screen detection module 702 is configured to determine that a frozen screen fault occurs and record a frozen screen fault log if the processing time length of the message to be processed is greater than or equal to a preset time length threshold, and a user input event exists in an input event pipeline connected to the main thread or a vertical synchronization signal exists in a message queue of the main thread.
Further, the processing duration includes a residence duration;
the duration monitoring module 701 includes:
a time obtaining sub-module, configured to obtain a first time when the message to be processed enters the message queue of the main thread and a second time when the message to be processed leaves the message queue;
a residence time length sub-module, configured to calculate a residence time length of the message to be processed according to the first time and the second time;
the freeze screen detection module 702 includes:
and the first frozen screen sub-module is used for judging that frozen screen faults occur if the residence time of the message to be processed is greater than or equal to a preset residence threshold value, a user input event exists in an input event pipeline connected with the main thread or a vertical synchronous signal exists in a message queue of the main thread, grabbing stack information of the main thread, and recording the grabbed stack information as a first frozen screen fault log.
Further, the processing duration includes an execution duration;
the duration monitoring module 701 includes:
an execution timing sub-module, configured to time an execution duration of the message to be processed when the message to be processed leaves the message queue;
the freeze screen detection module 702 includes:
and the second frozen screen sub-module is used for judging that a frozen screen fault occurs when the execution time of the message to be processed is longer than or equal to a preset execution threshold value, and grabbing stack information of the main thread and recording the grabbed stack information as a second frozen screen fault log if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread.
Further, the second freeze screen submodule includes:
the information grabbing sub-module is used for grabbing the stack information of the main thread and storing the grabbed stack information if the execution completion signal of the message to be processed is not detected when the execution duration of the message to be processed is greater than or equal to a first preset execution threshold value;
And the frozen screen judging submodule is used for judging that a frozen screen fault occurs if the execution time length of the message to be processed is greater than or equal to a second preset execution threshold value, if an execution completion signal of the message to be processed is not detected, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, and recording the grabbed stack information as a second frozen screen fault log, wherein the first preset execution threshold value is smaller than the second preset execution threshold value.
Further, the second freeze screen sub-module further includes:
and the stuck judging sub-module is used for recording the grabbed stack information as a stuck fault log if the execution duration of the message to be processed is greater than or equal to the first preset execution threshold value and less than the second preset execution threshold value when the execution completion signal of the message to be processed is received.
Further, the duration monitoring module 701 is specifically configured to monitor, by a first thread independent of the main thread, a processing duration of a message to be processed in the main thread.
Further, the apparatus further comprises:
And the application recovery module is used for executing preset application recovery operation on the application program corresponding to the main thread.
Further, the user input event includes a user operation event and/or a vertical synchronization signal.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
Referring to fig. 8, the embodiment of the application further provides an electronic device. As shown in fig. 8, the electronic device 80 of this embodiment includes: a processor 80, a memory 81, a computer program 82 stored in said memory 81 and executable on said processor 80. The steps of the above-described embodiment of the freeze detection method are implemented when the processor 80 executes the computer program 82, such as steps S201 to S202 shown in fig. 2. Alternatively, the processor 80 may perform the functions of the modules/units of the apparatus embodiments described above, such as the functions of the modules 701 to 702 shown in fig. 7, when executing the computer program 82.
By way of example, the computer program 82 may be partitioned into one or more modules/units that are stored in the memory 81 and executed by the processor 80 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions describing the execution of the computer program 82 in the terminal device 8. For example, the computer program 82 may be divided into a duration monitoring module and a freeze screen detection module, each of which specifically functions as follows:
The time length monitoring module is used for monitoring the processing time length of the message to be processed in the main thread;
and the frozen screen detection module is used for judging that a frozen screen fault occurs and recording a frozen screen fault log if the processing time length of the message to be processed is greater than or equal to a preset time length threshold value and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronous signal exists in a message queue of the main thread.
The terminal device 8 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The terminal device may include, but is not limited to, a processor 80, a memory 81. It will be appreciated by those skilled in the art that fig. 8 is merely an example of the terminal device 8 and does not constitute a limitation of the terminal device 8, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the terminal device may further include an input-output device, a network access device, a bus, etc.
The processor 80 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 81 may be an internal storage unit of the terminal device 8, such as a hard disk or a memory of the terminal device 8. The memory 81 may be an external storage device of the terminal device 8, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the terminal device 8. The memory 81 is used for storing the computer program as well as other programs and data required by the terminal device. The memory 81 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.
Claims (12)
1. The freeze screen detection method is characterized by comprising the following steps of:
monitoring the processing time of a message to be processed in a main thread; the processing time length comprises an execution time length; the monitoring of the processing duration of the message to be processed in the main thread comprises the following steps: when the message to be processed leaves the message queue, timing the execution duration of the message to be processed;
if the processing time length of the message to be processed is greater than or equal to a preset time length threshold, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, and recording a frozen screen fault log, wherein the method comprises the following steps: when the execution time length of the message to be processed is greater than or equal to a preset execution threshold value, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, grabbing stack information of the main thread, and recording the grabbed stack information as a second frozen screen fault log; the user input event is an event triggered by the user operating the terminal equipment;
When the execution time of the message to be processed is greater than or equal to a preset execution threshold, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, determining that a frozen screen fault occurs, capturing stack information of the main thread, and recording the captured information as a second frozen screen fault log includes:
when the execution duration of the message to be processed is greater than or equal to a first preset execution threshold, if the execution completion signal of the message to be processed is not detected, grabbing stack information of the main thread, and storing the grabbed stack information;
when the execution duration of the message to be processed is greater than or equal to a second preset execution threshold, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, and recording the grabbed stack information as a second frozen screen fault log, wherein the first preset execution threshold is smaller than the second preset execution threshold.
2. The freeze screen detection method of claim 1, wherein the processing duration comprises a residence duration;
the monitoring of the processing time of the message to be processed in the main thread comprises the following steps:
acquiring a first time when the message to be processed enters a message queue of the main thread and a second time when the message to be processed leaves the message queue;
calculating the residence time of the message to be processed according to the first time and the second time;
if the processing time length of the message to be processed is greater than or equal to a preset time length threshold, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, determining that a frozen screen fault occurs, and recording a frozen screen fault log includes:
if the residence time of the message to be processed is greater than or equal to a preset residence threshold value, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, judging that a frozen screen fault occurs, grabbing stack information of the main thread, and recording the grabbed stack information as a first frozen screen fault log.
3. The freeze screen detection method of claim 1, wherein the method further comprises:
and if the execution duration of the message to be processed is greater than or equal to the first preset execution threshold and less than the second preset execution threshold when the execution completion signal of the message to be processed is received, recording the captured stack information as a katon fault log.
4. The frozen screen detection method as recited in claim 1, wherein the monitoring the processing time of the message to be processed in the main thread comprises:
and monitoring the processing time of the message to be processed in the main thread through a first thread independent of the main thread.
5. The freeze screen detection method as recited in claim 1, further comprising, after the determining that the freeze screen failure occurs:
and executing preset application recovery operation on the application program corresponding to the main thread.
6. The utility model provides a freeze screen detection device which characterized in that includes:
the time length monitoring module is used for monitoring the processing time length of the message to be processed in the main thread; the processing time length comprises an execution time length; the duration monitoring module comprises: the execution timing sub-module is used for timing the execution duration of the message to be processed when the message to be processed leaves the message queue;
The frozen screen detection module is used for judging that frozen screen faults occur and recording frozen screen fault logs if the processing time length of the message to be processed is greater than or equal to a preset time length threshold value and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronous signal exists in a message queue of the main thread;
the frozen screen detection module comprises:
the second frozen screen sub-module is used for judging that a frozen screen fault occurs when the execution time of the message to be processed is longer than or equal to a preset execution threshold value, if an execution completion signal of the message to be processed is not detected and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, grabbing stack information of the main thread, and recording the grabbed stack information as a second frozen screen fault log; the user input event is an event triggered by the user operating the terminal equipment;
the second freeze screen submodule includes:
the information grabbing sub-module is used for grabbing the stack information of the main thread and storing the grabbed stack information if the execution completion signal of the message to be processed is not detected when the execution duration of the message to be processed is greater than or equal to a first preset execution threshold value;
And the frozen screen judging submodule is used for judging that a frozen screen fault occurs if the execution time length of the message to be processed is greater than or equal to a second preset execution threshold value, if an execution completion signal of the message to be processed is not detected, and a user input event exists in an input event pipeline connected with the main thread or a vertical synchronization signal exists in a message queue of the main thread, and recording the grabbed stack information as a second frozen screen fault log, wherein the first preset execution threshold value is smaller than the second preset execution threshold value.
7. The freeze screen detection device of claim 6, wherein the processing duration comprises a dwell duration;
the duration monitoring module comprises:
a time obtaining sub-module, configured to obtain a first time when the message to be processed enters the message queue of the main thread and a second time when the message to be processed leaves the message queue;
a residence time length sub-module, configured to calculate a residence time length of the message to be processed according to the first time and the second time;
the frozen screen detection module comprises:
and the first frozen screen sub-module is used for judging that frozen screen faults occur if the residence time of the message to be processed is greater than or equal to a preset residence threshold value, a user input event exists in an input event pipeline connected with the main thread or a vertical synchronous signal exists in a message queue of the main thread, grabbing stack information of the main thread, and recording the grabbed stack information as a first frozen screen fault log.
8. The frozen screen detection device as recited in claim 6 wherein the second frozen screen sub-module further comprises:
and the stuck judging sub-module is used for recording the grabbed stack information as a stuck fault log if the execution duration of the message to be processed is greater than or equal to the first preset execution threshold value and less than the second preset execution threshold value when the execution completion signal of the message to be processed is received.
9. The frozen screen detection apparatus as recited in claim 6, wherein the duration monitoring module is configured to monitor a processing duration of a message to be processed in a main thread through a first thread independent from the main thread.
10. The freeze screen detection device of claim 6, wherein the device further comprises:
and the application recovery module is used for executing preset application recovery operation on the application program corresponding to the main thread.
11. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 5 when the computer program is executed.
12. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 5.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010354202.1A CN113568801B (en) | 2020-04-29 | 2020-04-29 | Frozen screen detection method and device, terminal equipment and computer storage medium |
PCT/CN2021/084388 WO2021218548A1 (en) | 2020-04-29 | 2021-03-31 | Screen freezing detection method and apparatus, terminal device, and computer storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010354202.1A CN113568801B (en) | 2020-04-29 | 2020-04-29 | Frozen screen detection method and device, terminal equipment and computer storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113568801A CN113568801A (en) | 2021-10-29 |
CN113568801B true CN113568801B (en) | 2023-11-03 |
Family
ID=78158461
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010354202.1A Active CN113568801B (en) | 2020-04-29 | 2020-04-29 | Frozen screen detection method and device, terminal equipment and computer storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113568801B (en) |
WO (1) | WO2021218548A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114116425A (en) * | 2021-11-30 | 2022-03-01 | 北京博睿宏远数据科技股份有限公司 | Method and device for detecting application program blockage and storage medium |
CN117093441B (en) * | 2023-07-12 | 2024-10-01 | 荣耀终端有限公司 | Performance monitoring method and device for electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107590057A (en) * | 2017-09-28 | 2018-01-16 | 努比亚技术有限公司 | Freeze screen monitoring with solving method, mobile terminal and computer-readable recording medium |
CN108228358A (en) * | 2017-12-06 | 2018-06-29 | 广东欧珀移动通信有限公司 | Correct method, apparatus, mobile terminal and the storage medium of vertical synchronizing signal |
CN108345524A (en) * | 2017-01-22 | 2018-07-31 | 腾讯科技(深圳)有限公司 | Method for monitoring application program and Application Monitoring device |
CN108519923A (en) * | 2018-03-01 | 2018-09-11 | 北京三快在线科技有限公司 | A kind of interim card detection method and device and electronic equipment |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8990671B2 (en) * | 2011-10-31 | 2015-03-24 | Buckyball Mobile Inc. | Method and system of jamming specified media content by age category |
US20150121178A1 (en) * | 2011-10-31 | 2015-04-30 | Amit V. KARMARKAR | Audio content editor for jamming restricted content |
CN107704133B (en) * | 2017-09-28 | 2021-09-21 | 努比亚技术有限公司 | Screen freezing monitoring and solving method, mobile terminal and computer readable storage medium |
-
2020
- 2020-04-29 CN CN202010354202.1A patent/CN113568801B/en active Active
-
2021
- 2021-03-31 WO PCT/CN2021/084388 patent/WO2021218548A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108345524A (en) * | 2017-01-22 | 2018-07-31 | 腾讯科技(深圳)有限公司 | Method for monitoring application program and Application Monitoring device |
CN107590057A (en) * | 2017-09-28 | 2018-01-16 | 努比亚技术有限公司 | Freeze screen monitoring with solving method, mobile terminal and computer-readable recording medium |
CN108228358A (en) * | 2017-12-06 | 2018-06-29 | 广东欧珀移动通信有限公司 | Correct method, apparatus, mobile terminal and the storage medium of vertical synchronizing signal |
CN108519923A (en) * | 2018-03-01 | 2018-09-11 | 北京三快在线科技有限公司 | A kind of interim card detection method and device and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN113568801A (en) | 2021-10-29 |
WO2021218548A1 (en) | 2021-11-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022037251A1 (en) | Video data processing method and apparatus | |
CN113568801B (en) | Frozen screen detection method and device, terminal equipment and computer storage medium | |
US10601930B2 (en) | Lease-based heartbeat protocol method and apparatus | |
CN110708696B (en) | Network data recovery method and device, storage medium and electronic equipment | |
CN110188016B (en) | Method, terminal and storage medium for detecting application program no-response blocking | |
US20230066899A1 (en) | Video data processing method and apparatus, and electronic device | |
CN101316203B (en) | Method for monitoring embedded IP terminal internetwork connection condition | |
CN111949511A (en) | Application program pause processing method and device, terminal and storage medium | |
CN114554110B (en) | Video generation method, device, electronic equipment and storage medium | |
CN113127113A (en) | Response method of operation instruction and computer equipment | |
WO2023216839A1 (en) | Frozen screen detection method and apparatus, electronic device, and vehicle | |
CN116932248A (en) | Event processing method and device based on threads and coroutines and terminal equipment | |
CN115865734B (en) | Fault detection method, data generation method, device, equipment and medium | |
CN114826886B (en) | Disaster recovery method and device for application software and electronic equipment | |
CN113205079B (en) | Face detection method and device, electronic equipment and storage medium | |
CN115878379A (en) | Data backup method, main server, backup server and storage medium | |
CN115643408A (en) | Image compression method, device, equipment and storage medium | |
CN114281583A (en) | Device detection method and device, electronic device and readable storage medium | |
CN114024878A (en) | Data transmission method, device, medium and equipment | |
CN109167808B (en) | Data processing method, device and system | |
CN111510772A (en) | Method, device, equipment and storage medium for balancing video frame rate error | |
CN112015443A (en) | Upgrading method and device for electronic equipment, electronic equipment and storage medium | |
CN111935313B (en) | Connection pool management method and device | |
CN114679443A (en) | Method and device for downloading video data, electronic equipment and storage medium | |
CN109151532A (en) | A kind of video intercepting method, apparatus, terminal and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |