CN113535442A - Terminal stuck analysis method and device and computer storage medium - Google Patents

Terminal stuck analysis method and device and computer storage medium Download PDF

Info

Publication number
CN113535442A
CN113535442A CN202010286596.1A CN202010286596A CN113535442A CN 113535442 A CN113535442 A CN 113535442A CN 202010286596 A CN202010286596 A CN 202010286596A CN 113535442 A CN113535442 A CN 113535442A
Authority
CN
China
Prior art keywords
terminal
message
message processing
processing duration
monitored
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.)
Pending
Application number
CN202010286596.1A
Other languages
Chinese (zh)
Inventor
郭健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202010286596.1A priority Critical patent/CN113535442A/en
Publication of CN113535442A publication Critical patent/CN113535442A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0781Error filtering or prioritizing based on a policy defined by the user or on a policy defined by a hardware/software module, e.g. according to a severity level
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Abstract

The embodiment of the application discloses a method and a device for analyzing terminal stuck and a computer storage medium, wherein the method comprises the following steps: in the operation process of the terminal, determining the message processing duration corresponding to the monitored message; if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration; and analyzing the acquired operation information to generate a pause analysis report of the terminal.

Description

Terminal stuck analysis method and device and computer storage medium
Technical Field
The present application relates to the field of terminal application technologies, and in particular, to a method and an apparatus for analyzing terminal stuck, and a computer storage medium.
Background
With the increasing popularization of terminal devices such as smart phones, tablet computers and palm computers, the processing capacity of the terminal devices is stronger and stronger, and the number of application programs which can be installed and run is more and more. During the running of the application program, a stuck phenomenon, which is also known as a "card", may occur.
There are many reasons for causing the stuck state, and there are two main detection methods related to the stuck state of the terminal at present: one is a buried point, if a message processing time is too long, the related log is stored and returned; the other is a performance collection and analysis (sysstrace) tool that collects the state of all threads of the system and then passes the sysstrace back. However, both of the two detection methods have some defects, for example, for the buried point, the reason of detailed blockage cannot be obtained due to the limit of the authority of the buried point, the buried point may not conform to the actual use, the buried point needs to be added, and the analysis difficulty is high; for the sysstrace tool, the amount of collected data is large, and the sysstrace tool cannot be always in an open state, so that resources are consumed.
Disclosure of Invention
The application aims to provide a terminal blockage analysis method, a terminal blockage analysis device and a computer storage medium, which can accurately identify the terminal blockage and can improve the smoothness of a terminal by analyzing the reason of the terminal blockage.
In order to achieve the purpose, the technical scheme of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a method for analyzing a terminal stuck, where the method includes:
in the operation process of the terminal, determining the message processing duration corresponding to the monitored message;
if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration;
and analyzing the acquired operation information to generate a pause analysis report of the terminal.
Preferably, before the determining the message processing duration corresponding to the monitored message, the method further includes:
monitoring a message queue corresponding to a user thread; wherein the message queue includes at least the monitored messages;
and respectively setting a starting time and an ending time aiming at the processing process of each message in the message queue.
Preferably, the determining a message processing duration corresponding to the monitored message includes:
acquiring the starting time and the ending time corresponding to the monitored message;
and calculating a difference value according to the obtained starting time and the obtained ending time to obtain the message processing duration corresponding to the monitored message.
Preferably, after the determining the message processing duration corresponding to the monitored message, the method further includes:
comparing the message processing duration with a preset threshold;
and judging whether the terminal generates a jamming phenomenon according to the comparison result.
Preferably, the determining whether the terminal generates a stuck phenomenon according to a comparison result includes:
and if the message processing duration is greater than a preset threshold, determining that the terminal generates a pause phenomenon, and executing the step of acquiring the running information of the monitored message in the message processing duration.
Preferably, the operation information includes at least: and in the message processing duration, the running duration of the user thread in different states and the resource information of the user thread in a sleep state and a blocking state.
Preferably, the analyzing the acquired operation information to generate a katton analysis report of the terminal includes:
judging whether the running time of the user thread in different states in the message processing time meets a preset standard or not according to the acquired running information, and acquiring a judgment result;
and generating a stuck analysis report of the terminal according to the judgment result and the resource information of the user thread in the sleep state and the blocking state.
Preferably, after the analyzing the acquired operation information and generating the katton analysis report of the terminal, the method further includes:
and determining abnormal factors causing the terminal jam according to the generated jam analysis report and carrying out optimization processing.
Preferably, before the message processing duration is greater than a preset threshold, the method further includes:
acquiring hardware performance parameters of the terminal; the hardware performance parameters comprise performance parameters of a central processing unit and a memory;
and determining the preset threshold according to the acquired hardware performance parameters.
In a second aspect, an embodiment of the present application provides an analysis apparatus for a terminal stuck, where the analysis apparatus for a terminal stuck includes a determination unit, a comparison unit, and an analysis unit; wherein the content of the first and second substances,
the determining unit is configured to determine a message processing duration corresponding to the monitored message in the operation process of the terminal;
the comparison unit is configured to acquire the running information of the monitored message in the message processing duration if the message processing duration is greater than a preset threshold;
the analysis unit is configured to analyze the acquired operation information and generate a katton analysis report of the terminal.
Preferably, the analysis device for terminal stuck further comprises a monitoring unit and a setting unit; wherein the content of the first and second substances,
the monitoring unit is configured to monitor a message queue corresponding to a user thread; wherein the message queue includes at least the monitored messages;
the setting unit is configured to set a start time and an end time for a processing procedure of each message in the message queue.
Preferably, the analysis device for terminal stuck further comprises an acquisition unit and a calculation unit; wherein the content of the first and second substances,
the acquiring unit is configured to acquire a start time and an end time corresponding to the monitored message;
and the calculating unit is configured to calculate a difference value according to the obtained starting time and the obtained ending time to obtain the message processing duration corresponding to the monitored message.
Preferably, the comparing unit is further configured to compare the message processing duration with a preset threshold; and judging whether the terminal generates a jamming phenomenon according to the comparison result.
Preferably, the comparing unit is specifically configured to determine that a stuck phenomenon occurs in the terminal if the message processing duration is greater than a preset threshold, and execute the step of acquiring the operation information of the monitored message in the message processing duration.
Preferably, the operation information includes at least: and in the message processing duration, the running duration of the user thread in different states and the resource information of the user thread in a sleep state and a blocking state.
Preferably, the analysis unit is specifically configured to determine, for the obtained running information, whether running durations in which the user threads are in different states within the message processing duration satisfy a preset standard, and obtain a determination result; and generating a stuck analysis report of the terminal according to the judgment result and the resource information when the user thread is in the sleep state and the blocking state.
Preferably, the analysis apparatus for terminal stuck further includes an optimization unit configured to determine an abnormal factor causing the terminal stuck according to the generated stuck analysis report and perform optimization processing.
Preferably, the obtaining unit is further configured to obtain a hardware performance parameter of the terminal; the hardware performance parameters comprise performance parameters of a central processing unit and a memory;
the determining unit is further configured to determine the preset threshold according to the acquired hardware performance parameter.
In a third aspect, an embodiment of the present application provides an analysis apparatus for terminal stuck, where the analysis apparatus for terminal stuck includes a memory and a processor; wherein the content of the first and second substances,
the memory for storing a computer program operable on the processor;
the processor, when executing the computer program, is configured to perform the method according to any of the first aspects.
In a fourth aspect, an embodiment of the present application provides a computer storage medium storing a terminal stuck analysis program, where the terminal stuck analysis program, when executed by at least one processor, implements the method according to any one of the first aspects.
According to the analysis method, the device and the computer storage medium for terminal jamming, in the operation process of a terminal, the message processing duration corresponding to a monitored message is determined; if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration; and analyzing the acquired operation information to generate a pause analysis report of the terminal. Therefore, whether the terminal is stuck can be accurately identified by comparing the message processing duration corresponding to the monitored message with the preset threshold value; after the terminal jamming is identified, only the running information of the monitored message in the message processing duration is obtained, so that the data volume is reduced, and the efficiency of analyzing the cause of the terminal jamming can be improved; in addition, the cause analysis of the terminal blockage is used for solving or relieving the blockage phenomenon of the terminal, so that the fluency of the terminal can be improved.
Drawings
Fig. 1 is a schematic flowchart of an analysis method for terminal stuck provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of another terminal stuck analysis method according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another terminal stuck analysis method according to an embodiment of the present disclosure;
fig. 4 is a schematic view of an application scenario architecture of a user thread operation according to an embodiment of the present application;
fig. 5 is a schematic logic timing diagram of a user thread operation according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an analysis apparatus for terminal stuck provided in the embodiment of the present application;
fig. 7 is a schematic structural diagram of another analysis apparatus for terminal stuck provided in the embodiment of the present application;
fig. 8 is a schematic structural diagram of another analysis apparatus for terminal stuck provided in the embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant application and are not limiting of the application. It should be noted that, for the convenience of description, only the parts related to the related applications are shown in the drawings.
In an embodiment of the present application, referring to fig. 1, a flowchart of an analysis method for terminal stuck provided in the embodiment of the present application is shown. As shown in fig. 1, the method may include:
s101: in the operation process of the terminal, determining the message processing duration corresponding to the monitored message;
it should be noted that the terminal may be described in various forms, for example, it may be a mobile terminal such as a smart phone, a tablet computer, a palmtop computer, a notebook computer, a Personal Digital Assistant (PDA), a Portable Media Player (PMP), a navigation device, a wearable device, etc., or it may be a fixed terminal such as a Digital TV, a desktop computer, etc.; the embodiments of the present application are not particularly limited.
It should be noted that the terminal is stuck, which mainly means that in the running process of the terminal, due to the stuck of the user thread, for example, the picture does not respond when the user plays a game, and the picture is blocked when the user listens to a song. Here, the user thread is created by an Android (Android) application installed in the terminal at runtime. Wherein, the user thread can be regarded as a thread interacting with the user, it does not need kernel support and is realized in the application program, it does not depend on the kernel of the operating system, the application process uses the thread library to provide the function of creating, synchronizing, dispatching and managing the thread to control the user thread. In addition, since the user thread is created and managed by the application process by using the thread library and does not depend on the kernel of the operating system, the blocking of one thread can cause the blocking of all threads including the whole process, thereby causing the terminal to be stuck.
For a user thread, there is a message queue in the user thread, and the message queue includes a plurality of messages. If the message processing time of a certain message in the message queue is too long, the user can feel that the terminal is stuck at the moment. Therefore, one message can be selected from the message queue as the detected message, and the message processing time length corresponding to the detected message is determined.
S102: if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration;
it should be noted that the preset threshold is a preset determination value used for measuring whether the terminal is stuck due to the fact that the message processing duration is too long. Here, the preset threshold may be preset by the terminal, or may be user-defined. Specifically, the preset threshold may be determined according to a hardware performance parameter of the terminal, where the hardware performance parameter may include a performance parameter of key hardware such as a Central Processing Unit (CPU) and a memory.
In this way, after the message processing duration corresponding to the detected message is determined, the message processing duration can be compared with a preset threshold; according to the comparison result, if the message processing duration is less than or equal to the preset threshold, the detected message can be ignored, then other messages are selected from the message queue as the detected message, and the step of determining the message processing duration corresponding to the monitored message is continuously executed; if the message processing duration is greater than the preset threshold, the terminal is indicated to generate a pause phenomenon, and at this time, the running information of the monitored message in the message processing duration can be acquired.
It should be further noted that the operation information at least includes: and in the message processing duration, the running duration of the user thread in different states and the resource information of the user thread in a sleep state and a blocking state. Here, the user thread generally includes a plurality of states, such as an executable state (represented by an R state), a sleep state (represented by an S state), and a blocking state (represented by a D state), among others. To reduce the amount of data, only thread information associated with the user thread may be output at this time; specifically, if the message processing duration is greater than the preset threshold, the running information such as the duration of the user thread in different states and the owner of the resource when the user thread is in the S state and the D state within the message processing duration can be acquired, so as to generate the stuck analysis report of the terminal subsequently.
S103: and analyzing the acquired operation information to generate a pause analysis report of the terminal.
It should be noted that after the operation information is acquired, the operation information may be analyzed to obtain a cause of the terminal stuck, and a final stuck analysis report is generated.
It should be further noted that, after generating the katton analysis report of the terminal, the method may further include: and displaying the card analysis report of the terminal. In this way, the cause of the terminal jamming can be intuitively presented, and the user/developer can conveniently take corresponding measures based on the information to solve or relieve the jamming phenomenon of the terminal.
The embodiment provides a terminal stuck analysis method, which includes determining a message processing duration corresponding to a monitored message in the operation process of a terminal; if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration; and analyzing the acquired operation information to generate a pause analysis report of the terminal. Therefore, whether the terminal is stuck can be accurately identified by comparing the message processing duration corresponding to the monitored message with the preset threshold value; after the terminal jamming is identified, only the running information of the monitored message in the message processing duration is obtained, so that the data volume is reduced, and the efficiency of analyzing the cause of the terminal jamming can be improved; in addition, the cause analysis of the terminal blockage is used for solving or relieving the blockage phenomenon of the terminal, so that the fluency of the terminal can be improved.
In another embodiment of the present application, referring to fig. 2, a flowchart of another terminal stuck analysis method provided in the embodiment of the present application is shown. As shown in fig. 2, the method may include:
s201: acquiring the starting time and the ending time corresponding to the monitored message;
it should be noted that, during the execution of the user thread, the start time and the end time may be set for the processing procedure of each message in the message queue. In this way, for the monitored message in the message queue, after the processing procedure of the message is finished, the start time and the end time corresponding to the message can be obtained.
S202: calculating a difference value according to the obtained starting time and the obtained ending time to obtain a message processing duration corresponding to the monitored message;
it should be further noted that after the start time and the end time corresponding to the monitored message are obtained, a difference value may be calculated for the start time and the end time, so that the message processing duration corresponding to the monitored message may be obtained.
S203: if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration;
it should be noted that the preset threshold is a preset determination value used for measuring whether the terminal is stuck due to the fact that the message processing duration is too long. Here, the preset threshold may be preset by the terminal, or may be user-defined. Generally, the size of the preset threshold is related to the hardware performance parameters of the terminal itself. Specifically, in some embodiments, before S203, the method may further include:
acquiring hardware performance parameters of a terminal;
and determining the preset threshold according to the acquired hardware performance parameters.
In this embodiment, the hardware performance parameters may include performance parameters of key hardware such as a central processing unit and a memory. In this way, after the hardware performance parameters of the terminal are obtained, the hardware index value of the terminal can be determined according to the obtained hardware performance parameters; and then, determining a preset threshold according to the determined hardware index value. That is, in some embodiments, the determining the preset threshold according to the obtained hardware performance parameter may include:
determining a hardware index value of the terminal according to the acquired hardware performance parameters;
and selecting a preset threshold corresponding to the hardware index value from the corresponding relation based on the corresponding relation between the pre-established hardware index value and the preset threshold so as to obtain the preset threshold.
It should be further noted that, according to the obtained hardware performance parameters, such as the performance parameters of the central processing unit and the performance parameters of the memory, the performance evaluation value of the central processing unit and the performance evaluation value of the memory may be determined; then, a weight value of the central processing unit and a weight value of the memory are set, and a hardware index value of the terminal can be obtained by performing weighted calculation on the performance evaluation value of the central processing unit, the performance evaluation value of the memory, the weight value of the central processing unit and the weight value of the memory.
In addition, inside the terminal, a corresponding relationship between the hardware index value and a preset threshold value may be established in advance. Therefore, according to the determined hardware index value, a preset threshold corresponding to the hardware index value can be inquired from the corresponding relation, then the message processing time length can be compared with the preset threshold, and if the message processing time length is larger than the preset threshold, the running information of the monitored message in the message processing time length can be acquired.
S204: analyzing the acquired operation information to generate a stuck analysis report of the terminal;
it should be noted that after the operation information is acquired, the operation information may be analyzed to obtain a cause of the terminal stuck, and a final stuck analysis report is generated. Specifically, in some embodiments, for S204, the analyzing the acquired operation information to generate a katton analysis report of the terminal may include:
judging whether the running time of the user thread in different states in the message processing time meets a preset standard or not according to the acquired running information, and acquiring a judgment result;
and generating a stuck analysis report of the terminal according to the judgment result and the resource information of the user thread in the sleep state and the blocking state.
In the embodiment of the present application, for example, it may be determined whether the running durations of the user threads in different states within the message processing duration in the running information satisfy the preset criterion with respect to the obtained running information, and then the obtained determination result and the resource information of the user threads in the sleep state and the blocking state are written into the stuck analysis report of the terminal, so as to generate the stuck analysis report.
S205: and determining abnormal factors causing the terminal jam according to the generated jam analysis report and carrying out optimization processing.
After the generation of the terminal stuck analysis report, optimization processing may be performed for the cause of the terminal stuck. Specifically, after the hiton analysis report is obtained, abnormal factors causing the terminal to be hiton, such as whether the resources cannot be obtained or whether a large kernel is not available, can be determined according to the hiton analysis report, and then optimization processing is performed on the abnormal factors, so that the katon phenomenon of the terminal can be solved or alleviated, and the purpose of improving the fluency of the terminal is achieved.
The embodiment provides an analysis method for terminal jamming, and the specific implementation of the embodiment is elaborated through the embodiment, so that it can be seen that through the technical scheme of the embodiment, the message processing duration corresponding to the monitored message is compared with a preset threshold value, and whether the terminal is jammed or not can be accurately identified; after the terminal jamming is identified, only the running information of the monitored message in the message processing duration is obtained, so that the data volume is reduced, and the efficiency of analyzing the cause of the terminal jamming can be improved; in addition, the cause analysis of the terminal blockage is used for solving or relieving the blockage phenomenon of the terminal, so that the fluency of the terminal can be improved.
In another embodiment of the present application, referring to fig. 3, a flowchart of another terminal stuck analysis method provided in the embodiment of the present application is shown. As shown in fig. 3, the method may include:
s301: monitoring a message queue corresponding to a user thread;
s302: setting a starting time and an ending time respectively aiming at the processing process of each message in the message queue;
it should be noted that, the message queue includes a plurality of messages, and the plurality of messages at least includes the monitored message. In this way, in the execution process of the user thread, the starting time and the ending time are respectively set for the processing process of each message in the message queue, so that the message processing duration corresponding to each message can be conveniently calculated in the follow-up process.
S303: determining the message processing duration corresponding to the monitored message;
it should be noted that, for the monitored message, after the start time and the end time corresponding to the monitored message are obtained, a difference value may be calculated according to the obtained start time and end time, so as to obtain a message processing duration corresponding to the monitored message.
S304: comparing the message processing duration with a preset threshold;
it should be noted that, according to the comparison result, it can be determined whether the terminal is stuck. If the comparison result is that the message processing duration is less than or equal to the preset threshold, it cannot be judged whether the terminal is in a stuck state, the monitored message is ignored at this time, then a message is selected from the remaining messages in the message queue, the selected message is taken as the monitored message, and the step of executing S303 is returned; if the comparison result is that the message processing duration is greater than the preset threshold, it can be determined that the terminal sends a pause phenomenon, and at this time, the reason for the terminal pause needs to be further analyzed, that is, the step of obtaining the operation information of the monitored message within the message processing duration is executed.
S305: if the message processing duration is less than or equal to the preset threshold, ignoring the monitored message, selecting a message from the rest messages in the message queue, resetting the selected message as the monitored message, and returning to the step S303;
s306: if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration;
s307: and analyzing the acquired operation information to generate a pause analysis report of the terminal.
It should be noted that after the operation information is acquired, the operation information may be analyzed to obtain a cause of the terminal stuck, and a final stuck analysis report is generated. After the terminal card pause analysis report is generated, the terminal card pause analysis report can be displayed; or according to the generated katton analysis report, determining abnormal factors causing the terminal katton and carrying out optimization processing so as to solve or relieve the katton phenomenon of the terminal.
The embodiment provides an analysis method for terminal jamming, and the specific implementation of the embodiment is elaborated through the embodiment, so that it can be seen that through the technical scheme of the embodiment, the message processing duration corresponding to the monitored message is compared with a preset threshold value, and whether the terminal is jammed or not can be accurately identified; after the terminal jamming is identified, only the running information of the monitored message in the message processing duration is obtained, so that the data volume is reduced, and the efficiency of analyzing the cause of the terminal jamming can be improved; in addition, the cause analysis of the terminal blockage is used for solving or relieving the blockage phenomenon of the terminal, so that the fluency of the terminal can be improved.
Further, referring to fig. 4, a schematic diagram of an application scenario architecture in which a user thread runs is shown according to an embodiment of the present application. As shown in fig. 4, in the application scenario, the threads associated with the user thread may include: thread a, thread B, and thread C, which give the runtime of the monitored messages in different states on thread a, thread B, and thread C, and resource information when the threads are in S-state and D-state. The specific code logic sequence for the monitored message is shown in fig. 5.
Specifically, after the processing of the monitored message is started, thread a is recorded, and runs on a big core (big core), namely running (big), for 50ms, at this time, thread a calls an arbitrary function, such as represented by foo1(), and enters a Sleep state (S state), namely Sleep: binder _ transaction void 1 (); then recording thread B, still running on the large core, with a running time of 50ms, at which time thread B calls an arbitrary function, such as represented by foo2(), and enters a Sleep state due to the call of funex, i.e. Sleep: funex void foo2 (); recording a thread C, calling any function, such as represented by foo3(), and running on the corelet, namely running (little) foo3(), wherein the running time is 900 ms; then after the futex resource is released, returning to the thread B, enabling the thread B to enter a blocking state (D state), and recording sleep information when the 900ms is greater than a first set value; after binder calling is finished, returning to the thread A, enabling the thread A to enter a D state, and recording sleep information when the thread A is larger than a second set value for 1000 ms; until the processing process of the monitored message is finished; at this time, the message processing duration corresponding to the monitored message can be obtained, and if the message processing duration is greater than the preset threshold, the tracking message in the message processing duration is output.
In the embodiment of the present application, Binder indicates an inter-thread communication method, and is responsible for sending data of a thread a to a thread B. The flux can be regarded as short for a fast userpace flux, and represents a fast user space exclusive lock. The mutual exclusion lock acts between threads, and any other thread cannot access the protected resource as long as the mutual exclusion lock is locked. If not locked, the resource may be available, otherwise blocking is performed waiting for the resource to be available. Here, fig. 4 shows an example of a state structure when a certain user thread runs, and a detailed code logic sequence is shown in fig. 5. The embodiment of the application provides a more intuitive analysis method which is mainly applied to an android system; when a terminal stuck is detected, the running information of the user thread (i.e. the trace information shown in fig. 5) can be output, including the duration of the user thread in different states and the key resource information stored in the key S state and D state, so as to analyze the cause of the terminal stuck.
Taking the logic timing diagram of the code shown in fig. 5 as an example, it can be analyzed that the running time of the foo3() called by the thread C is too long according to the trace information output in fig. 5, and then the time for the foo3() to hold the futex lock can be optimized, so that the stuck phenomenon of the terminal can be solved or alleviated.
The embodiment provides an analysis method for terminal stuck, and the specific implementation of the foregoing embodiment is explained in detail through this embodiment, it can be seen that, in the process of using a terminal by a user, the terminal stuck felt by the user is only in a user thread, and a message queue exists in the user thread, and if a processing time corresponding to a certain message in the message queue is too long, the user feels stuck. The method and the device for processing the message set start time and end time are set, so that after the message processing time corresponding to the message is obtained, if the message processing time exceeds a preset threshold value, operation information in the time is output; and the reason for terminal jam can be obtained through analyzing the operation information. Therefore, the terminal jamming can be accurately identified by comparing the message processing duration with the preset threshold; after the terminal is identified to be stuck, only the thread related to the user thread is recorded, and the data volume is small; and the kernel state statistics does not need to apply for the authority by each application program; in addition, the cause analysis of the terminal blockage is used for solving or relieving the blockage phenomenon of the terminal, so that the fluency of the terminal can be improved.
Based on the same inventive concept of the foregoing embodiment, refer to fig. 6, which shows a schematic structural diagram of an analysis apparatus 60 for terminal stuck provided by an embodiment of the present application. As shown in fig. 6, the terminal stuck analysis apparatus 60 may include a determination unit 601, a comparison unit 602, and an analysis unit 603; wherein the content of the first and second substances,
a determining unit 601, configured to determine, in an operation process of the terminal, a message processing duration corresponding to the monitored message;
a comparing unit 602, configured to obtain operation information of the monitored message within the message processing duration if the message processing duration is greater than a preset threshold;
an analyzing unit 603 configured to analyze the acquired operation information and generate a katton analysis report of the terminal.
It should be noted that the analysis device 60 of the terminal card pause may be integrated in the terminal, or may be a separate device, such as a smart phone, a tablet computer, a palm computer, a notebook computer, a game console, a desktop computer, a personal digital assistant, and the like. According to the analysis device 60 of the terminal stuck, the cause of the terminal stuck can be analyzed, and the stuck phenomenon of the terminal can be solved or alleviated by optimizing the cause.
Further, in some embodiments, referring to fig. 7, the analysis apparatus 60 of the terminal stuck may further include a monitoring unit 604 and a setting unit 605; wherein the content of the first and second substances,
a monitoring unit 604 configured to monitor a message queue corresponding to a user thread; wherein the message queue includes at least the monitored messages;
a setting unit 605 configured to set a start time and an end time for a processing procedure of each message in the message queue, respectively.
Further, in some embodiments, referring to fig. 7, the analysis apparatus 60 of the terminal stuck may further include an obtaining unit 606 and a calculating unit 607; wherein the content of the first and second substances,
an obtaining unit 606 configured to obtain a start time and an end time corresponding to the monitored message;
the calculating unit 607 is configured to perform difference calculation according to the obtained start time and end time to obtain a message processing duration corresponding to the monitored message.
Further, in some embodiments, the comparing unit 602 is further configured to compare the message processing duration with a preset threshold; and judging whether the terminal generates a jamming phenomenon according to the comparison result.
Further, in some embodiments, the comparing unit 602 is specifically configured to determine that a stuck phenomenon occurs in the terminal if the message processing duration is greater than a preset threshold, and execute the step of acquiring the operation information of the monitored message within the message processing duration.
Further, in some embodiments, the operational information includes at least: and in the message processing duration, the running duration of the user thread in different states and the resource information of the user thread in a sleep state and a blocking state.
Further, in some embodiments, the analysis unit 603 is specifically configured to, for the obtained running information, determine whether running durations of the user threads in different states in the message processing duration satisfy a preset standard, and obtain a determination result; and generating a stuck analysis report of the terminal according to the judgment result and the resource information when the user thread is in the sleep state and the blocking state.
Further, in some embodiments, referring to fig. 7, the terminal stuck analysis apparatus 60 may further include an optimization unit 608 configured to determine an abnormal factor causing the terminal stuck according to the generated stuck analysis report, and perform optimization processing.
Further, in some embodiments, the obtaining unit 606 is further configured to obtain a hardware performance parameter of the terminal; the hardware performance parameters comprise performance parameters of a central processing unit and a memory;
the determining unit 601 is further configured to determine the preset threshold according to the acquired hardware performance parameter.
It is understood that in this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., and may also be a module, or may also be non-modular. Moreover, each component in the embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware or a form of a software functional module.
Based on the understanding that the technical solution of the present embodiment essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the method of the present embodiment. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Accordingly, the present embodiments provide a computer storage medium storing a terminal stuck analysis program, which when executed by at least one processor implements the steps of the method of any of the preceding embodiments.
Based on the above-mentioned composition of the terminal stuck analysis apparatus 60 and the computer storage medium, referring to fig. 8, it shows a specific hardware structure example of the terminal stuck analysis apparatus 60 provided in the embodiment of the present application, which may include: a communication interface 801, a memory 802, and a processor 803; the various components are coupled together by a bus system 804. It is understood that the bus system 804 is used to enable communications among the components. The bus system 804 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 804 in FIG. 8. Wherein the content of the first and second substances,
a communication interface 801, which is used for receiving and sending signals during the process of sending and receiving information to and from other external network elements;
a memory 802 for storing a computer program capable of running on the processor 803;
a processor 803 for executing, when running the computer program, the following:
in the operation process of the terminal, determining the message processing duration corresponding to the monitored message;
if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration;
and analyzing the acquired operation information to generate a pause analysis report of the terminal.
It will be appreciated that the memory 802 in the subject embodiment can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, but not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (ddr Data Rate SDRAM, ddr SDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchronous chained SDRAM (Synchronous link DRAM, SLDRAM), and Direct memory bus RAM (DRRAM). The memory 802 of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
And the processor 803 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 803. The Processor 803 may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 802, and the processor 803 reads the information in the memory 802, and completes the steps of the above method in combination with the hardware thereof.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the Processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented with modules (e.g., procedures, functions, and so on) that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
Optionally, as another embodiment, the processor 803 is further configured to perform the steps of the method of any one of the previous embodiments when running the computer program.
It should be noted that, in the present application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
Features disclosed in several of the product embodiments provided in the present application may be combined in any combination to yield new product embodiments without conflict.
The features disclosed in the several method or apparatus embodiments provided in the present application may be combined arbitrarily, without conflict, to arrive at new method embodiments or apparatus embodiments.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A method for analyzing terminal stuck, the method comprising:
in the operation process of the terminal, determining the message processing duration corresponding to the monitored message;
if the message processing duration is greater than a preset threshold, acquiring the running information of the monitored message in the message processing duration;
and analyzing the acquired operation information to generate a pause analysis report of the terminal.
2. The method of claim 1, wherein before the determining the message processing duration corresponding to the monitored message, the method further comprises:
monitoring a message queue corresponding to a user thread; wherein the message queue includes at least the monitored messages;
and respectively setting a starting time and an ending time aiming at the processing process of each message in the message queue.
3. The method according to claim 2, wherein the determining the message processing duration corresponding to the monitored message comprises:
acquiring the starting time and the ending time corresponding to the monitored message;
and calculating a difference value according to the obtained starting time and the obtained ending time to obtain the message processing duration corresponding to the monitored message.
4. The method of claim 1, wherein after determining the message processing duration corresponding to the monitored message, the method further comprises:
comparing the message processing duration with a preset threshold;
and judging whether the terminal generates a jamming phenomenon according to the comparison result.
5. The method of claim 4, wherein the determining whether the terminal is stuck according to the comparison result comprises:
and if the message processing duration is greater than a preset threshold, determining that the terminal generates a pause phenomenon, and executing the step of acquiring the running information of the monitored message in the message processing duration.
6. The method of claim 1, wherein the operational information comprises at least: and in the message processing duration, the running duration of the user thread in different states and the resource information of the user thread in a sleep state and a blocking state.
7. The method of claim 6, wherein analyzing the obtained operation information to generate a katon analysis report of the terminal comprises:
judging whether the running time of the user thread in different states in the message processing time meets a preset standard or not according to the acquired running information, and acquiring a judgment result;
and generating a stuck analysis report of the terminal according to the judgment result and the resource information of the user thread in the sleep state and the blocking state.
8. The method according to any one of claims 1 to 7, wherein after the analyzing the acquired operation information to generate a katton analysis report of the terminal, the method further comprises:
and determining abnormal factors causing the terminal jam according to the generated jam analysis report and carrying out optimization processing.
9. The method of claim 1, wherein before the message processing duration is greater than a preset threshold, the method further comprises:
acquiring hardware performance parameters of the terminal; the hardware performance parameters comprise performance parameters of a central processing unit and a memory;
and determining the preset threshold according to the acquired hardware performance parameters.
10. The analysis device for the terminal stuck is characterized by comprising a determining unit, a comparing unit and an analyzing unit; wherein the content of the first and second substances,
the determining unit is configured to determine a message processing duration corresponding to the monitored message in the operation process of the terminal;
the comparison unit is configured to acquire the running information of the monitored message in the message processing duration if the message processing duration is greater than a preset threshold;
the analysis unit is configured to analyze the acquired operation information and generate a katton analysis report of the terminal.
11. The analysis device for the terminal stuck is characterized by comprising a memory and a processor; wherein the content of the first and second substances,
the memory for storing a computer program operable on the processor;
the processor, when running the computer program, is configured to perform the method of any of claims 1 to 9.
12. A computer storage medium, characterized in that it stores a terminal stuck analysis program, which when executed by at least one processor implements the method according to any one of claims 1 to 9.
CN202010286596.1A 2020-04-13 2020-04-13 Terminal stuck analysis method and device and computer storage medium Pending CN113535442A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010286596.1A CN113535442A (en) 2020-04-13 2020-04-13 Terminal stuck analysis method and device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010286596.1A CN113535442A (en) 2020-04-13 2020-04-13 Terminal stuck analysis method and device and computer storage medium

Publications (1)

Publication Number Publication Date
CN113535442A true CN113535442A (en) 2021-10-22

Family

ID=78119883

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010286596.1A Pending CN113535442A (en) 2020-04-13 2020-04-13 Terminal stuck analysis method and device and computer storage medium

Country Status (1)

Country Link
CN (1) CN113535442A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657251A (en) * 2015-02-04 2015-05-27 广东小天才科技有限公司 Electronic equipment use state monitoring method and device
CN106776253A (en) * 2016-12-08 2017-05-31 武汉斗鱼网络科技有限公司 A kind of interface interim card monitoring method and device
CN109840189A (en) * 2018-12-15 2019-06-04 中国平安人寿保险股份有限公司 Caton formation gathering method, device, computer installation and readable storage medium storing program for executing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657251A (en) * 2015-02-04 2015-05-27 广东小天才科技有限公司 Electronic equipment use state monitoring method and device
CN106776253A (en) * 2016-12-08 2017-05-31 武汉斗鱼网络科技有限公司 A kind of interface interim card monitoring method and device
CN109840189A (en) * 2018-12-15 2019-06-04 中国平安人寿保险股份有限公司 Caton formation gathering method, device, computer installation and readable storage medium storing program for executing

Similar Documents

Publication Publication Date Title
US9355003B2 (en) Capturing trace information using annotated trace output
US20180321992A1 (en) Notification Message Processing Method and Apparatus
KR102205372B1 (en) Client-side activity monitoring
CN110059477B (en) Attack detection method and device
CN111597009B (en) Application program display method and device and terminal equipment
US10241845B2 (en) Application event tracing
CN112527414B (en) Front-end-based data processing method, device, equipment and storage medium
CN106127558B (en) Bill generation method and mobile terminal
CN113467981A (en) Exception handling method and device
CN111400037A (en) Memory management method and device, computer storage medium and terminal
CN108009039B (en) Terminal information recording method, device, storage medium and electronic equipment
CN111124627A (en) Method, device, terminal and storage medium for determining application program caller
CN113535442A (en) Terminal stuck analysis method and device and computer storage medium
CN115794583A (en) Kernel analysis method and device
CN113961534B (en) Method and electronic equipment for generating log file
CN113687942A (en) Detection method and device and electronic equipment
CN108228299B (en) Display method and electronic equipment
CN112732542A (en) Information processing method, information processing device and terminal equipment
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN113886774B (en) Anti-debugging method and device
CN110837433A (en) Performance optimization method and device and electronic equipment
CN113297052B (en) Method, device, storage medium and equipment for positioning stuck event of application program
US10198342B1 (en) Advanced binary instrumentation for debugging and performance enhancement
CN112673354B (en) System state detection method, system state device and terminal equipment
CN117290246A (en) Code quality detection method and device, storage medium and electronic equipment

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