Fault diagnosis method, device, equipment, storage medium and computer program product
By obtaining and analyzing the operating data of multiple threads, the causes of performance failure to determine and cluster processing have solved the complexity and time -consuming problems of artificial analysis in existing technologies, and achieved rapid and accurate diagnosis of performance failure.
Patent Information
- Application Number
- CN202411026565.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-07-29
AI Technical Summary
Existing performance analysis tools are complex to use and require manual analysis and tracking of data, which leads to huge analysis workload and it is difficult to quickly find the key reasons for performance problems.
By obtaining the running data of multiple threads in different time periods, determine the cause of the performance failure for each time period, and the clustering processing is performed to obtain the target cause.
The target cause of rapid determination of performance failure has been achieved, the amount of task of developers is reduced, the efficiency is improved, and the subjectivity and inconsistency brought by human analysis are reduced.
Smart Images

Figure CN118550800B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of fault diagnosis, and in particular to a fault diagnosis method, apparatus, device, storage medium and computer program product. Background Art
[0002] With the rapid development of information technology and the widespread application of smart devices, performance optimization has become one of the key factors in improving user experience. Due to the diversity and complexity of user habits, commercial software often faces various performance issues reported by users after release, but these problems are often difficult to reproduce and solve in a laboratory environment. At present, there are some performance analysis tools, such as the perfetto tool provided by Google, which can help developers capture and analyze system trace data to identify performance bottlenecks. However, the use of these tools is complicated and requires manual analysis of each trace data, which requires high skills of analysts and a huge workload of analysis. It is difficult for developers to find the key causes of performance problems in a large amount of trace data. Summary of the invention
[0003] To overcome the problems existing in the related art, the present disclosure provides a fault diagnosis method, apparatus, device, storage medium and computer program product.
[0004] According to a first aspect of an embodiment of the present disclosure, a fault diagnosis method is provided, the method comprising:
[0005] Get the running data of multiple threads in different time periods;
[0006] For each time period, determining a cause of the performance failure based on the running data of the multiple threads corresponding to the time period;
[0007] Clustering is performed based on the causes of the performance failure corresponding to each time period to obtain a target cause of the performance failure.
[0008] In some embodiments, for each time period, determining the cause of the performance failure based on the running data of the multiple threads corresponding to the time period includes:
[0009] For each time period, determining whether a running state of a preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period;
[0010] In response to the running state of the preset target thread being the preset state and the thread causing the performance fault being the preset target thread, based on the running data of the associated threads associated with the preset target thread among the multiple threads, the cause of the performance fault caused by the preset target thread is determined.
[0011] In some embodiments, determining the reason why the preset target thread causes the performance fault based on the running data of the associated thread associated with the preset target thread among the multiple threads includes:
[0012] For each associated thread, determining whether the running state of the associated thread is the preset state based on the running data of the associated thread;
[0013] In response to the running status of all associated threads not being the preset status, determining the reason why the preset target thread causes the performance fault based on the running data of each associated thread;
[0014] In response to the existence of an associated thread whose running state is the preset state, sub-associated threads whose running states are not the preset state are determined based on the associated threads in the preset state, and the reason why the preset target thread causes the performance fault is determined based on the running data of the sub-associated threads; wherein the sub-associated thread is a thread among the multiple threads, the sub-associated thread is directly or indirectly associated with the associated thread in the preset state, and the thread directly associated with the sub-associated thread is in the preset state.
[0015] In some embodiments, for each time period, determining the cause of the performance failure based on the running data of the multiple threads corresponding to the time period includes:
[0016] The operation data of multiple threads in each time period are analyzed by using a parallel processing mechanism to determine the cause of the performance failure corresponding to each time period.
[0017] In some embodiments, the method further comprises:
[0018] Determine the target operating data associated with the target cause among the operating data of the multiple threads in the different time periods;
[0019] The target reason and the target operation data are displayed.
[0020] In some embodiments, the method further comprises:
[0021] For each time period, based on the cause of the performance failure, marking the running data of the multiple threads;
[0022] In the determining of the operation data of the multiple threads in the different time periods, the target operation data associated with the target cause includes:
[0023] Based on the marks of the running data of the multiple threads in each time period, the target running data associated with the target cause is determined in the running data of the multiple threads in the different time periods.
[0024] In some embodiments, the obtaining of the running data of the multiple threads in different time periods includes:
[0025] In response to the terminal device running the multiple threads detecting the performance failure, receiving the running data of the multiple threads in the different time periods sent by the terminal device.
[0026] According to a second aspect of an embodiment of the present disclosure, a fault diagnosis device is provided, the device comprising:
[0027] An acquisition module, configured to acquire running data of multiple threads in different time periods;
[0028] A first determination module is configured to determine, for each time period, a cause of the performance failure based on the running data of the multiple threads corresponding to the time period;
[0029] The cluster processing module is configured to perform cluster processing based on the causes of the performance failure corresponding to each time period to obtain a target cause of the performance failure.
[0030] In some embodiments, the first determination module is further configured to determine, for each time period, whether the running state of a preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period; in response to the running state of the preset target thread being the preset state and the thread causing the performance fault being the preset target thread, determine the reason why the preset target thread causes the performance fault based on the running data of the associated threads associated with the preset target thread among the multiple threads.
[0031] In some embodiments, the first determination module is further configured to determine, for each associated thread, whether the running state of the associated thread is the preset state based on the running data of the associated thread; in response to the running states of all associated threads not being the preset state, determine the reason why the preset target thread causes the performance fault based on the running data of each associated thread; in response to the existence of an associated thread whose running state is the preset state, determine, based on the associated threads in the preset state, sub-associated threads whose running states are not the preset state, and determine the reason why the preset target thread causes the performance fault based on the running data of the sub-associated threads; wherein the sub-associated thread is a thread among the multiple threads, the sub-associated thread is directly or indirectly associated with the associated thread in the preset state, and the thread directly associated with the sub-associated thread is in the preset state.
[0032] In some embodiments, the first determination module is further configured to analyze the running data of multiple threads in each time period by using a parallel processing mechanism to determine the cause of the performance failure corresponding to each time period.
[0033] In some embodiments, the apparatus further comprises:
[0034] A second determining module is configured to determine the target operating data associated with the target cause among the operating data of the multiple threads in the different time periods;
[0035] A display module displays the target reason and the target operation data.
[0036] In some embodiments, the apparatus further comprises:
[0037] a marking module configured to mark the running data of the plurality of threads for each time period based on the cause of the performance failure;
[0038] The second determination module is further configured to determine the target operation data associated with the target cause in the operation data of the multiple threads in the different time periods based on the marks of the operation data of the multiple threads in each time period.
[0039] In some embodiments, the acquisition module is further configured to receive the running data of the multiple threads in the different time periods sent by the terminal device in response to the terminal device on which the multiple threads are running detecting the performance failure.
[0040] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including a processor;
[0041] Memory for storing computer programs or instructions;
[0042] The processor executes the computer program or instructions to implement the steps of the method described in the first aspect above.
[0043] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, wherein the storage medium stores a computer program or instructions. When the computer program or instructions in the storage medium are executed by a processor, the steps of the method described in the first aspect above are implemented.
[0044] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implements the steps of the method described in the first aspect above.
[0045] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0046] In the embodiment of the present disclosure, the device obtains the running data of multiple threads in different time periods, and for each time period, determines the cause of the performance failure based on the running data of the multiple threads corresponding to the time period, and performs clustering processing based on the causes of the performance failure corresponding to each time period to obtain the target cause of the performance failure. On the one hand, the embodiment of the present disclosure analyzes the running data of the threads in each time period by the device to determine the cause of the performance failure, and performs clustering processing to determine the target cause. Compared with the tedious and time-consuming manual analysis of the running data of the threads in each time period in the related art, the target cause of the performance failure can be determined more quickly and less time-consuming, thereby improving the overall efficiency and reducing the workload of developers. The target cause determined by clustering processing is more representative. On the other hand, it can also reduce the subjectivity and inconsistency caused by manual analysis, thereby improving the accuracy of the determined target cause.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0049] Figure 1 It is a schematic diagram of the principle of capturing tracking data in the related art.
[0050] Figure 2 The figure is a flowchart of a fault diagnosis method according to an exemplary embodiment.
[0051] Figure 3 The present invention is a schematic diagram showing a method for determining a cause of a performance failure according to an exemplary embodiment.
[0052] Figure 4 The diagram is a scene diagram of a fault diagnosis method according to an exemplary embodiment.
[0053] Figure 5 It is a principle diagram showing a fault diagnosis method according to an exemplary embodiment.
[0054] Figure 6 The present invention is a schematic diagram showing a principle of determining a target cause and target operation data according to an exemplary embodiment.
[0055] Figure 7 The figure is a block diagram of a fault diagnosis device according to an exemplary embodiment.
[0056] Figure 8 The present invention is a structural block diagram of a terminal device according to an exemplary embodiment.
[0057] Fig. 9 The figure is a structural block diagram of a cloud device according to an exemplary embodiment. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0059] There is a method in the related art for determining the cause of a performance problem, in which the performance analysis tool Perfetto is used to capture the trace data of threads associated with an application, and the captured trace data of the threads is displayed on a user interface. Developers can view the trace data of the threads on the user interface, and analyze each trace data item by item to determine the cause of the performance problem. Figure 1 It is a schematic diagram of the related technology for capturing tracking data, such as Figure 1 As shown in the figure, the producer process and the consumer process interact through the tracing service. The producer process is responsible for registering the data source, starting, stopping, refreshing and submitting the tracing data. The producer process submits the tracing data by using the shared memory (Shmem) mechanism through the producer socket to write the data into the tracing data buffer with global writable properties. The consumer process has advanced permissions and can read the tracing data from the tracing data buffer through the consumer socket, and use the command line tools on the system to query the data source, start / stop the tracing session, and read and analyze the backtrace tracing data.
[0060] In the above solution, after the performance analysis tool Perfetto captures the tracing data of the threads associated with the application, the developer needs to analyze the tracing data one by one to determine the cause of the performance problem. This requires high skills from the developer and requires analyzing each piece of tracing data. The analysis workload is huge, and it is difficult for developers to find the key cause of the performance problem in a large amount of tracing data.
[0061] In this regard, the present disclosure provides a fault diagnosis method. Figure 2 FIG. 1 is a flow chart of a fault diagnosis method according to an exemplary embodiment. Figure 2 As shown, the method mainly includes the following steps:
[0062] S21, obtaining the running data of multiple threads in different time periods;
[0063] S22. For each time period, determine the cause of the performance failure based on the running data of the multiple threads corresponding to the time period;
[0064] S23: Perform clustering processing based on the causes of the performance failure corresponding to each time period to obtain a target cause of the performance failure.
[0065] In the embodiments of the present disclosure, the fault diagnosis method can be applied to terminal devices, such as user equipment (UE), mobile devices, user terminals, mobile phones, tablet computers, personal digital assistants (PDAs), handheld devices, computing devices, vehicle-mounted devices, wearable devices and other terminal devices. The fault diagnosis method can also be applied to cloud devices, such as physical servers, virtualized servers, virtual machine managers, etc. The fault diagnosis method can also be applied to cloud platforms with computing capabilities. The embodiments of the present disclosure do not limit the execution subject of the fault diagnosis method. In the subsequent description of the embodiments of the present disclosure, the device is used as the execution subject for description.
[0066] In step S21, the device obtains the running data of multiple threads in different time periods, wherein the multiple threads may be all threads running in the terminal device or some threads. The running data of the thread may include the services provided by the operating system called during the execution of the thread, such as file operations, network communications, thread management, etc.; the running data of the thread may also include the communication between threads or between the thread and the operating system, such as the sending and receiving of signals, the signal processing method, etc.; the running data of the thread may also include the memory usage, the central processing unit (CPU) usage, such as the memory allocation, release and memory operation results of the thread, CPU occupancy, execution time and other data. The running data of the thread may also include file and network operation data, execution process data, etc., which are not limited in this embodiment of the present disclosure.
[0067] It should be noted that a thread is the basic unit of CPU scheduling and dispatching, and is a basic unit that can run independently. A thread is a part of a process. A thread can only belong to one process, while a process can have multiple threads. In the embodiment of the present disclosure, obtaining the running data of multiple threads in different time periods includes obtaining the running data of multiple threads in multiple processes in different time periods.
[0068] In the embodiments of the present disclosure, the fault diagnosis method as described above can be applied to a terminal device, a cloud device or a cloud platform; in some embodiments, the fault diagnosis method is applied to a terminal device, and the terminal device obtains the operating data of multiple threads in different time periods in response to detecting a performance failure, wherein the performance failure includes a preset performance failure, and the preset performance failure may be a performance failure that is frequently reported by users in commercial scenarios, such as freeze, heat, no response, crash, etc.
[0069] In the disclosed embodiments, the terminal device may collect thread operation data through built-in thread data collection tools, such as real-time task manager (top), system activity report (System Activity Reporter, SAR) and other built-in tools, or system application programming interface (Application Programming Interface, API) (such as procfs). The terminal device may also collect thread operation data through external thread data collection tools, such as Perfetto, SystemTap, Dynatrace, AppDynamics and other tools; the thread data collection tool may also be customized to collect thread operation data through the customized thread data collection tool.
[0070] It should be noted that when a terminal device collects thread running data through an external thread data collection tool, since the external thread data collection tool may need to collect the running data of threads on multiple systems, the external thread data collection tool can usually only collect the running data of threads involved in the common services of multiple systems. For some application services on the terminal device or unique services such as the system's innovative services, the external thread data collection tool cannot collect the running data of threads involved in these unique services.
[0071] In the disclosed embodiment, when the terminal device collects the running data of the thread through the external thread data collection tool, it can collect the running data of the thread involved in the common business based on the original attributes of the external thread data collection tool, and collect the running data of the thread involved in the unique business through the extended interface by adding an extended interface in the external thread data collection tool.
[0072] The terminal device may pre-set the time interval for collecting the running data of the thread, such as collecting once per second, or collecting once every 10 seconds, and the embodiments of the present disclosure do not limit this. The terminal device may also include a storage component such as a memory. After the terminal device collects the running data of the thread, the running data of the thread may be stored in the storage component, wherein the terminal device may integrate and store the running data of the thread according to the time interval for collecting the running data of the thread. For example, when the time interval for collecting the running data of the thread is 1 second, the running data of the thread collected every 1 second may be integrated into a file of a predetermined format and stored in the storage component; the terminal device may also directly store the collected running data in the storage component, and the embodiments of the present disclosure do not limit this.
[0073] The terminal device may also include a monitoring component. In some embodiments, the terminal device may monitor user-reported instructions, such as user voice instructions, touch instructions, etc., through the monitoring component. When the terminal device responds to monitoring that the user-reported instructions indicate a performance failure of the terminal device, the terminal device determines that a performance failure is detected. For example, the terminal device responds to monitoring that the user's voice instructions include information such as "stuttering" and "slowness", and determines that a performance failure is detected. After detecting the performance failure, the terminal device may obtain the running data of multiple threads in different time periods from the storage component. In other embodiments, the monitoring component may monitor the performance indicators of the terminal device and set a performance indicator threshold. In response to the performance indicator exceeding the performance indicator threshold, it is determined that a performance failure is detected. For example, in response to the monitoring component monitoring that the CPU usage exceeds 80% or the memory usage exceeds 2GB, it is determined that a performance failure is detected. The terminal device may obtain the running data of multiple threads in different time periods from the storage component.
[0074] The terminal device may obtain the operation data of multiple threads in different time periods based on the time when the performance failure is detected, such as obtaining the operation data of multiple threads at a preset time before the performance failure is detected, and the operation data of multiple threads at a preset time after the performance failure is detected, wherein the preset time may include one or more time periods, such as each time period is 1 second, and the preset time may be 10 seconds. The terminal device may also pre-set the length of each time period. Specifically, the terminal device may set the length of each time period based on the aforementioned time interval for collecting operation data, such as determining the length of each time period as the time interval for collecting operation data, or setting the length of each time period as the time interval for collecting two operation data. The embodiments of the present disclosure do not limit this.
[0075] In some other embodiments, the obtaining of the running data of the multiple threads in different time periods includes:
[0076] In response to the terminal device running the multiple threads detecting the performance failure, receiving the running data of the multiple threads in the different time periods sent by the terminal device.
[0077] In an embodiment of the present disclosure, a fault diagnosis method is applied to a cloud device or a cloud platform. A cloud device is used as an example for explanation. The cloud device detects a performance fault in response to a terminal device running multiple threads, and receives the operating data of multiple threads in different time periods sent by the terminal device. The method for the terminal device running multiple threads to detect performance faults and collect the operating data of the threads may be the method described above.
[0078] In the disclosed embodiment, after the terminal device detects a performance failure, it may send the operation data of multiple threads in different time periods to the cloud device, wherein the terminal device may encapsulate the operation data of multiple threads in a preset format according to the collection time interval as a time period, and send the encapsulated operation data of multiple threads in each time period in the preset format to the cloud device, such as packaging the operation data of multiple threads per second into the operation data of multiple threads in a time period. After the terminal device detects the performance failure, it may send the operation data of multiple threads in the preset time before the performance failure is detected, and the operation data of multiple threads in the preset time after the performance failure is detected to the cloud device, wherein the preset time may include one or more time periods, such as each time period is 1 second, and the preset time may be 10 seconds. The cloud device receives the operation data of multiple threads in each time period sent by the terminal device.
[0079] In the disclosed embodiments, the terminal device and the cloud device may further include a shared storage area, such as a storage memory, etc. After collecting the running data of multiple threads, the terminal device may store the running data of multiple threads in a shared memory shared by the terminal device and the cloud device. After the terminal device running multiple threads detects a performance failure, the terminal device may send information representing the performance failure of the terminal device to the cloud device. After receiving the information sent by the terminal device, the cloud device may actively obtain the running data of multiple threads in different time periods from the shared memory.
[0080] In the embodiments of the present disclosure, a cloud device or a cloud platform responds to a terminal device running multiple threads detecting a performance failure, and receives the operating data of multiple threads in different time periods sent by the terminal device. On the one hand, after responding to the terminal device detecting the performance failure, the operating data of multiple threads in different time periods are received and processed, and the response speed is fast. On the other hand, receiving and processing the operating data by the cloud device or the cloud platform can reduce the computing burden of the terminal device, thereby improving the terminal performance.
[0081] In step S22, the device determines the cause of the performance failure for each time period based on the running data of multiple threads corresponding to the time period. After the device obtains the running data of multiple threads in different time periods, it can first perform pre-processing such as data cleaning, deduplication, and missing value processing on the running data of multiple threads in each time period to improve the accuracy and completeness of the data.
[0082] In some embodiments, for each time period, the device can determine key performance indicators based on the running data of multiple threads corresponding to the time period, such as CPU usage, maximum memory occupancy, network latency, and other indicators of each thread, and determine possible abnormal threads or performance bottlenecks based on the key performance indicators, such as determining the thread with the highest CPU usage as an abnormal thread, and further checking the thread status, memory allocation, system call records, etc. of the abnormal thread to determine the cause of the performance failure.
[0083] In other embodiments, for each time period, the device may analyze the correlation between different threads based on the running data of multiple threads corresponding to the time period, and determine the threads that may affect each other, such as resource competition, deadlock, etc. For another example, a high CPU usage rate of a thread may cause other threads to respond slowly. After determining the threads that may affect each other, the cause of the performance failure caused by these threads can be determined based on the running data of these threads.
[0084] In other embodiments, the device may pre-set a preset target thread for normal use of the terminal device that can directly affect the operation of multiple threads, such as a user interface (UI) main thread, a rendering thread, etc. For each time period, determine whether the state of the preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period, and when the state of the preset target thread is the preset state and the thread causing the performance failure is the preset target thread, determine the cause of the performance failure caused by the preset target thread based on the running data of the associated threads of the associated preset target thread among the multiple threads; wherein the preset state may be an uninterruptible sleep state (Uninterruptible Sleep). When the thread is in the uninterruptible sleep state, it indicates that the thread is blocked by other threads, is waiting for the operation to be completed, and cannot be interrupted by a signal. The device may determine the cause of the performance failure caused by the preset target thread based on the running data of the thread that blocks the preset target thread.
[0085] In the embodiment of the present disclosure, after the device determines the cause of the performance failure in each time period, the running data of multiple threads in the corresponding time period may be marked based on the cause of the performance failure in each time period.
[0086] In step S23, the device performs clustering processing based on the causes of performance failure corresponding to each time period to obtain the target cause of the performance failure, wherein the device can perform clustering processing based on the causes of performance failure corresponding to each time period through methods such as K-means clustering, hierarchical clustering, Gaussian mixture model clustering, and fuzzy C-means clustering to obtain the target cause of the performance failure.
[0087] In some embodiments, after determining the causes of the performance failure corresponding to each time period, the device may cluster the causes of the performance failure corresponding to each time period to obtain the target causes of the performance failure, where the target cause may be the category (or categories) of causes with the largest number after clustering.
[0088] In other embodiments, the device may cluster the causes of performance failure corresponding to each time period in an incremental clustering manner to obtain the target cause of the performance failure. Specifically, the device determines the cause of the performance failure for each time period based on the running data of multiple threads corresponding to the time period, and may cluster the causes of performance failure corresponding to each time period to obtain the target cause of the performance failure simultaneously, and continuously update the clustering results.
[0089] In the disclosed embodiment, after the device determines the target cause, it can display the target cause and the running data of multiple threads in each time period on a UI interface for developers or users, so that developers can determine the key threads and the running data of the key threads based on the target cause, and then fix the performance problem.
[0090] In the embodiment of the present disclosure, as described above, after determining the cause of the performance failure in each time period, the device can mark the running data of multiple threads in the corresponding time period based on the cause of the performance failure in each time period. Then, after determining the target cause, the device can display the target cause and the running data of multiple threads in each time period after marking, so that developers can more quickly determine the key threads and the running data of the key threads based on the target cause and the marking of each running data, and then fix the performance problem.
[0091] In the disclosed embodiment, the device can mark the running data of multiple threads in each time period based on the performance indicators of the running data, such as marking the time indicator, frame rate indicator, etc. of the running data of multiple threads in the time period.
[0092] In the disclosed embodiment, after determining the target cause, the device can determine the target operation data associated with the target cause based on the target cause, and display the target cause and the target operation data, thereby enabling developers to repair performance problems based on the target cause and the target operation data and improve efficiency.
[0093] In the embodiment of the present disclosure, the device obtains the running data of multiple threads in different time periods, and for each time period, determines the cause of the performance failure based on the running data of the multiple threads corresponding to the time period, and performs clustering processing based on the causes of the performance failure corresponding to each time period to obtain the target cause of the performance failure. On the one hand, the embodiment of the present disclosure analyzes the running data of the threads in each time period by the device to determine the cause of the performance failure, and performs clustering processing to determine the target cause. Compared with the tedious and time-consuming manual analysis of the running data of the threads in each time period in the related art, the target performance failure cause can be determined more quickly and less time-consuming, thereby improving the overall efficiency and reducing the workload of developers. The target cause determined by clustering processing is more representative; on the other hand, it can also reduce the subjectivity and inconsistency caused by manual analysis, thereby improving the accuracy of the determined target cause.
[0094] In some embodiments, for each time period, determining the cause of the performance failure based on the running data of the multiple threads corresponding to the time period includes:
[0095] For each time period, determining whether a state of a preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period;
[0096] In response to the state of the preset target thread being the preset state and the thread causing the performance fault being the preset target thread, based on the running data of the associated threads associated with the preset target thread among the multiple threads, determining the reason why the preset target thread caused the performance fault.
[0097] In the embodiments of the present disclosure, as mentioned above, the device may pre-set a preset target thread for normal use of the terminal device that can directly affect the operation of multiple threads, such as a UI main thread, a rendering thread, etc. The preset target thread may be one or more, and the embodiments of the present disclosure do not impose any restrictions on this.
[0098] In the embodiment of the present disclosure, when there is one preset target thread, the device determines the state of the preset target thread for each time period, and determines whether the running state of the preset target thread is the preset state. The running state of the thread can be running state (Running), sleeping state (sleep), uninterruptible sleeping state, and runnable state (Runnable), and the preset state can be the uninterruptible sleeping state.
[0099] In some embodiments, the running data of each thread may include the running state of the thread; the device may also determine the running state of the preset target thread based on the running data of the preset target thread. In other embodiments, the device may determine the time when the preset target thread executes each event based on the running data of each thread, and determine the running state of the preset target thread by analyzing the time when the preset target thread executes each event. For example, if the preset target thread performs system call operations (such as input / output (I / O) operations) for a long time, it may indicate that the thread is in a sleep state or an uninterruptible sleep state.
[0100] In the disclosed embodiment, when there are multiple preset target threads, the device can simultaneously determine the status of each preset target thread for each time period, and determine whether the running status of each preset target thread is the preset status; it can also set the priority of the preset target thread in advance, and determine the running status of each preset target thread step by step according to the priorities of multiple preset target threads, and whether the status of each preset target thread is the preset status.
[0101] In an embodiment of the present disclosure, in response to the running state of a preset target thread being a preset state and the thread causing the performance failure being the preset target thread, the device determines the cause of the performance failure caused by the preset target thread based on the running data of the associated threads of the preset target thread among multiple threads.
[0102] In an embodiment of the present disclosure, after determining that the running state of a preset target thread is a preset state, the device may determine whether the thread causing the performance failure is the preset target thread, wherein the device may determine whether the thread causing the performance failure is the preset target thread based on the running data of the preset target thread, such as the device may determine the duration that the preset target thread is in an uninterruptible sleep state, and if the duration exceeds the preset duration, the thread causing the performance failure is judged to be the preset target thread; for another example, the device may determine the usage rate of components such as CPU and memory by the preset target thread, and if the usage rate exceeds a preset usage rate threshold, the thread causing the performance failure is judged to be the preset target thread.
[0103] In an embodiment of the present disclosure, in response to the running state of a preset target thread being a preset state and the thread causing the performance failure being the preset target thread, the device determines the reason why the preset target thread caused the performance failure based on the running data of the associated threads of the associated preset target thread among multiple threads, wherein the associated threads of the associated preset target thread may be threads created and managed by the preset target thread, or threads that create and manage the preset target thread, or threads that have mutual influence and resource competition with the preset target thread, or threads that provide services or support for the preset target thread, and the associated threads of each preset target thread may be one or more, and the embodiments of the present disclosure do not impose any limitation on this.
[0104] In an embodiment of the present disclosure, a device determines a reason why a preset target thread causes a performance failure based on running data of an associated thread of a preset target thread among multiple threads. The device can determine information such as CPU usage, memory usage, input / output (I / O) activity, context switching frequency, etc. of the associated thread based on the running data of the associated thread of the preset target thread among multiple threads, and determines the reason why the preset target thread causes the performance failure based on the information of the associated thread. For example, if there is a CPU resource competition relationship between the preset target thread and an associated thread of the preset target thread, and it can be determined based on the running data of the associated thread that the CPU usage rate of the associated thread is too high, so that the preset target thread cannot use CPU resources, then the reason why the preset target thread causes the performance failure is that the preset target thread cannot use the CPU; for another example, if the business currently executed by the preset target thread requires the use of a mutex lock, but based on the running data of the associated thread, it is determined that the associated thread is using a mutex lock, then the reason why the preset target thread causes the performance failure is that the preset target thread cannot use the mutex lock.
[0105] In the disclosed embodiment, for each time period, the device determines whether the running state of a preset target thread among multiple threads is a preset state based on the running data of multiple threads corresponding to the time period, and in response to the running state of the preset target thread being the preset state and the thread causing the performance failure being the preset target thread, determines the reason why the preset target thread causes the performance failure based on the running data of the associated threads of the associated preset target thread among the multiple threads. On the one hand, the preset target thread is analyzed in a targeted manner, which can shorten the time for analyzing the reason of the performance failure; on the other hand, the interaction and influence between threads are taken into consideration, the analysis is more comprehensive, and the reason why the preset target thread causes the performance failure can be located more accurately.
[0106] In some embodiments, the determining, based on the running data of the associated thread associated with the preset target thread among the multiple threads, the cause of the performance failure caused by the preset target thread includes:
[0107] For each associated thread, determining whether the running state of the associated thread is the preset state based on the running data of the associated thread;
[0108] In response to the running status of all associated threads not being the preset status, determining the reason why the preset target thread causes the performance fault based on the running data of each associated thread;
[0109] In response to the existence of an associated thread whose running state is the preset state, sub-associated threads whose running states are not the preset state are determined based on the associated threads in the preset state, and the reason why the preset target thread causes the performance fault is determined based on the running data of the sub-associated threads; wherein the sub-associated thread is a thread among the multiple threads, the sub-associated thread is directly or indirectly associated with the associated thread in the preset state, and the thread directly associated with the sub-associated thread is in the preset state.
[0110] In the disclosed embodiment, the device determines for each associated thread whether the running state of the associated thread is a preset state based on the running data of the associated thread. As mentioned above, the associated thread and the preset target thread are threads that have mutual influence and resource competition. The device determines the running state of the associated thread based on the running data of the associated thread. In some embodiments, the running data of each associated thread may directly include the running state of the associated thread, and the device may directly determine the running state of the associated thread based on the running data of the associated thread. In other embodiments, the device may determine the time when the associated thread executes each event based on the running data of each associated thread, and determine the running state of the associated thread by analyzing the time when the associated thread executes each event. For example, if the associated thread performs system call operations (such as I / O operations) for a long time, it may indicate that the associated thread is in a sleep state or an uninterruptible sleep state.
[0111] In the embodiments of the present disclosure, as described above, after determining the cause of the performance failure in each time period, the device may mark the running data of multiple threads in the corresponding time period based on the cause of the performance failure in each time period. The device may also mark the running data of multiple threads in the corresponding time period based on the performance indicators of the running data for the running data of multiple threads in each time period. After determining the running status of each associated thread, the device may also mark each associated thread based on the running status of each associated thread. If each associated thread is executing critical business or using critical functions in the time period, each associated thread may be marked based on the critical business or critical function.
[0112] In an embodiment of the present disclosure, in response to the running status of all associated threads being not a preset status, the device determines the reason why a preset target thread causes a performance failure based on the running data of each associated thread. The device can determine the CPU usage, memory usage, input / output (I / O) activity, context switching frequency and other information of the associated thread based on the running data of each associated thread, and determine the reason why the preset target thread causes the performance failure based on the information of each associated thread. For example, if there is a CPU resource competition relationship between the preset target thread and each associated thread of the preset target thread, and it can be determined based on the running data of each associated thread that the CPU usage rate of each associated thread is high, so that the preset target thread cannot use CPU resources, then the reason why the preset target thread causes the performance failure is that the preset target thread cannot use the CPU; for another example, the business currently executed by the preset target thread requires the use of a mutex lock, but based on the running data of each associated thread, it is determined that the first associated thread among the associated threads is using the mutex lock, then the reason why the preset target thread causes the performance failure is that the preset target thread cannot use the mutex lock.
[0113] In an embodiment of the present disclosure, in response to the existence of an associated thread whose running state is a preset state, the device determines, based on the associated thread in the preset state, sub-associated threads whose running states are not the preset state, and determines the cause of the performance failure caused by the preset target thread based on the running data of the sub-associated threads; wherein the sub-associated thread is a thread among multiple threads, the sub-associated thread can be one or more, and the sub-associated thread is directly or indirectly associated with the associated thread in the preset state, such as the sub-associated thread can be a thread that has a resource competition relationship with the associated thread, the sub-associated thread can also be an associated thread of a thread that has a resource competition relationship with the associated thread, and the thread directly associated with the sub-associated thread is in the preset state.
[0114] Figure 3 It is a schematic diagram of determining the cause of a performance failure according to an exemplary embodiment, wherein a key thread L31 is a preset target thread, and the user main interface thread, rendering thread, synthesizer thread, display hardware abstraction layer thread, and display kernel thread in the key thread L31 are all preset target threads, and the running state L32 represents the running state of each thread, and the running state L32 includes running L321, sleeping L322, uninterruptible sleeping L323, and runnable L324. Uninterruptible sleeping L323 is a preset state, and blocking threads AL33, BL34, and NL35 are all associated threads of the preset target thread, and blocking threads A1L36 are associated threads of blocking threads AL33, and blocking threads A2L37 are sub-associated threads. Fault factor attribution L38 is the cause of the performance failure, and lock L381, business logic L382, and others L383 are all specific causes of fault factor attribution L38. It should be noted that Figure 3All threads involved in are threads in multiple threads. Figure 3 As shown, the device first determines the running state of the key thread L31, and in response to the existence of a thread in the key thread L31 whose running state is uninterruptible sleep L323, determines whether the thread in the running state of uninterruptible sleep L323 causes the performance failure, and in response to the existence of a thread in the key thread L31 whose running state is uninterruptible sleep L323, and the thread in the running state of uninterruptible sleep L323 causes the performance failure, determines that there are blocked threads AL33, BL34, and NL35 in the key thread L31 whose running state is uninterruptible sleep L323, and determines the running states of the blocked threads AL33, BL34, and NL35, and responds to the blocking threads AL33, BL34, and NL35. In response to the presence of a thread (blocking thread AL33) whose state is uninterruptible sleep L323 among the blocked threads AL33, the blocked threads BL34, and the blocked threads NL35, the running state of the blocked thread A1L36 of the blocked thread AL33 is further determined. In response to the running state of the blocked thread A1L36 being uninterruptible sleep L323, the running state of the blocked thread A2L37 of the blocked thread A1L36 is further determined. In response to the running state of the blocked thread A2L37 being not uninterruptible sleep L323, the fault factor attribution L38 is determined based on the running data of the blocked thread A2L37. If the blocked thread A2L37 currently holds a mutex lock, the fault factor attribution L38 is the mutex lock.
[0115] In the disclosed embodiment, by judging the running status of each associated thread and each sub-associated thread of the preset target thread step by step, and determining the cause of the performance failure caused by the preset target thread based on the running data of the sub-associated threads, the root thread causing the performance failure can be located more accurately, and the accuracy of determining the cause of the performance failure can be improved; and there is no need to analyze all threads, which can improve the efficiency of determining the cause of the performance failure and is more intelligent.
[0116] In some embodiments, for each time period, determining the cause of the performance failure based on the running data of the multiple threads corresponding to the time period includes:
[0117] The operation data of multiple threads in each time period are analyzed by using a parallel processing mechanism to determine the cause of the performance failure corresponding to each time period.
[0118] In the disclosed embodiments, the device uses a parallel processing mechanism to analyze the running data of multiple threads in each time period to determine the cause of the performance failure corresponding to each time period. For example, a multi-core processor or a distributed computing framework (such as Hadoop, Spark) can be used to process data in different time periods in parallel. For another example, multiple parsing components can be set to process data in different time periods in parallel through multiple parsing components.
[0119] In the disclosed embodiment, the device uses a parallel processing mechanism to analyze the running data of multiple threads in each time period, and determines the cause of the performance failure corresponding to each time period. This can improve the efficiency of determining the cause of the performance failure corresponding to each time period and is more intelligent.
[0120] In some embodiments, the method further comprises:
[0121] Determine the target operating data associated with the target cause among the operating data of the multiple threads in the different time periods;
[0122] The target reason and the target operation data are displayed.
[0123] In an embodiment of the present disclosure, the device determines target operating data associated with a target cause in the operating data of multiple threads in different time periods. In some embodiments, after the device determines the target cause, it can determine the target operating data based on the target cause and the cause of the performance failure corresponding to the operating data of the multiple threads in each time period. For example, the operating data whose cause of the performance failure corresponding to the operating data of the multiple threads in each time period is the target cause is determined as the target operating data; if the target cause includes multiple causes, the operating data whose cause of the performance failure corresponding to the operating data of the multiple threads in each time period is included as the operating data of any one of the target causes and is determined as the target operating data.
[0124] In some other embodiments, the method further comprises:
[0125] For each time period, based on the cause of the performance failure, marking the running data of the multiple threads;
[0126] In the determining of the operation data of the multiple threads in the different time periods, the target operation data associated with the target cause includes:
[0127] Based on the marks of the running data of the multiple threads in each time period, the target running data associated with the target cause is determined in the running data of the multiple threads in the different time periods.
[0128] In the disclosed embodiment, the device marks the running data of multiple threads for each time period based on the cause of the performance failure, wherein the running data of multiple threads can be marked by labels, such as using a simple label system to mark the running data, such as "scheduler", "lock factor", "I / O bottleneck", etc.; the correspondence between numbers and various causes can also be pre-set, and the causes can be marked by marking the numbers associated with the causes, such as "1" can be pre-associated with "lock factor", and "2" can be corresponded with "I / O bottleneck", and the running data of multiple threads can be marked by the numbers corresponding to the causes of the performance failure.
[0129] In the disclosed embodiment, as mentioned above, the running data of multiple threads in the corresponding time period can also be marked based on the performance indicators of the running data, such as marking the time indicators, frame rate indicators, etc. of the running data of multiple threads in the time period.
[0130] In an embodiment of the present disclosure, the device determines target operating data associated with a target cause in the operating data of multiple threads in different time periods based on the markings of the operating data of multiple threads in each time period. The device can directly determine the cause of the performance failure caused by the multiple threads in each time period through the markings of the operating data of multiple threads in each time period, and further determine the target operating data based on the target cause and the cause of the performance failure corresponding to the operating data of the multiple threads in each time period.
[0131] In the embodiment of the present disclosure, the device determines the target operating data associated with the target cause in the operating data of multiple threads in different time periods based on the markings of the operating data of multiple threads in each time period, which can improve the speed of determining the target operating data and is more intelligent.
[0132] In the disclosed embodiment, after the device determines the target operating data, it displays the target cause and the target operating data. For example, the device may display the target cause and the target operating data on a user interface displayed for developers or users, thereby eliminating the need for developers to determine the target cause, or determine the target operating data based on the target cause. Performance issues can be repaired directly based on the displayed target cause and target operating data, thereby improving the efficiency of repairing the problem and further improving the user experience.
[0133] Figure 4 is a scene diagram of a fault diagnosis method according to an exemplary embodiment. Figure 4As shown, the embodiments of the present disclosure can be respectively applicable to the laboratory test L41 scenario, the user trial L42 scenario and the commercial user L43 usage scenario, and respectively obtain the running data of multiple threads in different time periods in each scenario, and for each time period, determine the cause of the performance failure based on the running data of multiple threads corresponding to the time period, and use big data attribution L44 to perform clustering processing based on the causes of performance failure corresponding to each time period, and obtain the cause L45 (target cause) of uninterruptible sleep state blocking, and obtain key running data L46 based on the cause L45 of uninterruptible sleep state blocking, so as to solve the performance bottleneck L47 (performance failure).
[0134] Figure 5 is a schematic diagram of a fault diagnosis method according to an exemplary embodiment, wherein the smart device L51 is a terminal device, the operation data file L52 is the operation data of multiple threads in different time periods, the big data attribution platform L53 is a cloud platform, the big data attribution platform L53 includes a parser module L531 and a big data clustering and retrieval module L532, the uninterruptible sleep state is the bottleneck L54 of the top 3 performance problems, and the state of the preset target thread is the preset state and the thread causing the performance failure is the preset target thread, such as Figure 5 As shown, the smart device L51 obtains the running data of multiple threads in different time periods, and sends the running data to the big data attribution platform L53. The parser module L531 of the big data attribution platform L53 parses the running data of multiple threads in each time period, wherein each parser parses the running data of multiple threads in each time period, and each parser processes in parallel. For each time period, each parser in the parser module L531 determines whether the uninterruptible sleep state is the bottleneck of the top three performance problems L54. If not, no subsequent processing is performed; if so, the uninterruptible sleep state is recursively attributed L55 based on the running data of multiple threads in the time period, wherein the recursive attribution of the uninterruptible sleep state L55 is the aforementioned Figure 3 According to the method, each parser recursively attributes the uninterruptible sleep state to L55 and sends the recursive attribution result to the database L56. The big data clustering and retrieval module L532 in the big data attribution platform L53 obtains the recursive attribution result of each time period, and performs clustering and retrieval processing to determine the target cause and target operation data, and sends the target cause and target operation data to the database L56, wherein the database L56 can be connected to the user interface, and the data in the database L56 can be directly displayed on the user interface.
[0135] Figure 6 is a schematic diagram showing a principle of determining a target cause and target operation data according to an exemplary embodiment, wherein: Figure 6 The executive body is Figure 5Online big data attribution platforms such as Figure 6 As shown, the online big data attribution platform performs online big data attribution L61 to determine the target cause and target operation data. The target cause includes fault factor attribution L611 and blocker business attribution (critical thread) L612. The critical thread is the preset target thread, the fault factor attribution L611 is the target cause, the blocker is the sub-associated thread, the blocker business attribution (critical thread) L612 is the business of the sub-associated thread, the fault factor attribution L611 includes lock factor, optimization factor, scheduler factor, code block long running factor, liability factor, etc., the blocker business attribution (critical thread) L612 includes media service, logger, security-enhanced Linux, etc.; the operation data dimension attribution L613 is To determine the target operating data, as mentioned above, the operating data of each time period can be marked, such as the operating data summary information can be marked for the operating data of each time period, the operating data summary information includes the failure rate (stuttering, slow response), the distribution of key failure factors (the causes of performance failures corresponding to each time period), the key blocker business (the business of the sub-associated thread), and the target operating data can be searched based on the summary information of the operating data. For example, the search can be based on the failure factor, and the operating data whose failure factor is the target cause is determined as the target operating data. The search can be based on the failure rate, and the operating data whose failure rate meets the preset failure rate condition is determined as the target operating data. The search can also be based on the blocker business.
[0136] Figure 7 FIG. 7 is a block diagram of a fault diagnosis device 700 according to an exemplary embodiment. Figure 7 As shown, the fault diagnosis device 700 mainly includes:
[0137] An acquisition module 701 is configured to acquire the running data of multiple threads in different time periods;
[0138] A first determination module 702 is configured to determine, for each time period, a cause of the performance failure based on the running data of the multiple threads corresponding to the time period;
[0139] The clustering processing module 703 is configured to perform clustering processing based on the causes of the performance failure corresponding to each time period to obtain a target cause of the performance failure.
[0140] In some embodiments, the first determination module 702 is further configured to determine, for each time period, whether the running state of a preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period; in response to the running state of the preset target thread being the preset state and the thread causing the performance fault being the preset target thread, determine the reason why the preset target thread causes the performance fault based on the running data of the associated threads associated with the preset target thread among the multiple threads.
[0141] In some embodiments, the first determination module 702 is further configured to determine, for each associated thread, whether the running state of the associated thread is the preset state based on the running data of the associated thread; in response to the running states of all associated threads not being the preset state, determine the reason why the preset target thread causes the performance fault based on the running data of each associated thread; in response to the existence of an associated thread whose running state is the preset state, determine, based on the associated threads in the preset state, sub-associated threads whose running states are not the preset state, and determine the reason why the preset target thread causes the performance fault based on the running data of the sub-associated threads; wherein the sub-associated thread is a thread among the multiple threads, the sub-associated thread is directly or indirectly associated with the associated thread in the preset state, and the thread directly associated with the sub-associated thread is in the preset state.
[0142] In some embodiments, the first determination module 702 is further configured to analyze the running data of multiple threads in each time period by using a parallel processing mechanism to determine the cause of the performance failure corresponding to each time period.
[0143] In some embodiments, the apparatus further comprises:
[0144] A second determining module is configured to determine the target operating data associated with the target cause among the operating data of the multiple threads in the different time periods;
[0145] A display module displays the target reason and the target operation data.
[0146] In some embodiments, the apparatus further comprises:
[0147] a marking module configured to mark the running data of the plurality of threads for each time period based on the cause of the performance failure;
[0148] The second determination module is further configured to determine the target operation data associated with the target cause in the operation data of the multiple threads in the different time periods based on the marks of the operation data of the multiple threads in each time period.
[0149] In some embodiments, the acquisition module 701 is further configured to receive the running data of the multiple threads in the different time periods sent by the terminal device in response to the terminal device running the multiple threads detecting the performance failure.
[0150] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0151] Figure 8 800 is a block diagram of a terminal device 800 according to an exemplary embodiment. For example, the terminal device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a wearable device, a medical device, a fitness device, a personal digital assistant, etc.
[0152] Reference Figure 8 The terminal device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0153] The processing component 802 generally controls the overall operation of the terminal device 800, such as operations associated with at least one of display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0154] The memory 804 is configured to store various types of data to support operations on the terminal device 800. Examples of such data include at least one of the following: instructions for any application or method operating on the terminal device 800, contact data, phone book data, messages, pictures, and videos. The memory 804 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk.
[0155] The power supply component 806 provides power to various components of the terminal device 800. The power supply component 806 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the terminal device 800.
[0156] The multimedia component 808 includes a screen that provides an output interface between the terminal device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the terminal device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0157] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the terminal device 800 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0158] Input / output (I / O) interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, and buttons. These buttons may include, but are not limited to, home buttons, volume buttons, start buttons, and lock buttons.
[0159] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the terminal device 800. For example, the sensor assembly 814 can detect the open / closed state of the terminal device 800, the relative positioning of the components, such as the display and keypad of the terminal device 800, and the sensor assembly 814 can also detect the position change of the terminal device 800 or a component in the terminal device 800, the presence or absence of contact between the user and the terminal device 800, the orientation or acceleration / deceleration of the terminal device 800, and the temperature change of the terminal device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include, but is not limited to, at least one of the following: an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, and a temperature sensor.
[0160] The communication component 816 is configured to facilitate communication between the terminal device 800 and other devices in a wired or wireless manner. The terminal device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0161] In an exemplary embodiment, the terminal device 800 may be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components.
[0162] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including executable instructions or a computer program, which can be executed by a processor 820 of a terminal device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0163] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a terminal device, enables the terminal device to execute any one of the above-mentioned fault diagnosis methods of the embodiments of the present disclosure.
[0164] The embodiment of the present disclosure provides a computer program product, which includes: a computer program or executable instructions, which are stored in a computer-readable storage medium. The processor of the computer device reads the computer program or executable instructions from the computer-readable storage medium, and the processor executes the computer program or executable instructions, so that the computer device executes any one of the above-mentioned fault diagnosis methods of the embodiment of the present disclosure.
[0165] It should be noted that the fault diagnosis method in the embodiment of the present disclosure can also be executed by a cloud device. Fig. 9 1 is a structural block diagram of a cloud device 900 according to an exemplary embodiment. For example, the cloud device 900 may be provided as a server.
[0166] Reference Fig. 9 The cloud device 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions executable by the processing component 922, such as an application. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute instructions to perform any of the above-mentioned fault diagnosis methods.
[0167] The cloud device 900 may also include a power supply component 926 configured to perform power management of the cloud device 900, a wired or wireless network interface 950 configured to connect the cloud device 900 to a network, and an input / output (I / O) interface 958. The cloud device 900 may operate an operating system stored in the memory 932, such as Windows Server TM, Mac OS X TM, Unix TM Linux TM, FreeBSD TM or the like.
[0168] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0169] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A fault diagnosis method, characterized in that: The method comprises: Get the running data of multiple threads in different time periods; For each time period, determining a cause of the performance failure based on the running data of the multiple threads corresponding to the time period; Perform clustering processing based on the causes of the performance failure corresponding to each time period to obtain the target cause of the performance failure; The determining, for each time period, the cause of the performance failure based on the running data of the multiple threads corresponding to the time period includes: For each time period, determining whether a running state of a preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period; In response to the running state of the preset target thread being the preset state and the thread causing the performance fault being the preset target thread, based on the running data of the associated threads associated with the preset target thread among the multiple threads and whether the running state of each associated thread is the preset state, determine the reason why the preset target thread causes the performance fault; wherein the running state of each associated thread is determined based on the running data of the associated thread; the associated threads include at least one of the following: a thread created and managed by the preset target thread; a thread that creates and manages the preset target thread; a thread that has mutual influence and resource competition with the preset target thread; a thread that provides services or support for the preset target thread.
2. The method according to claim 1, characterized in that: The determining, based on the running data of the associated threads associated with the preset target thread among the multiple threads and whether the running state of each associated thread is the preset state, the cause of the performance fault caused by the preset target thread includes: In response to the running status of all associated threads not being the preset status, determining the reason why the preset target thread causes the performance fault based on the running data of each associated thread; or, In response to the existence of an associated thread whose running state is the preset state, sub-associated threads whose running states are not the preset state are determined based on the associated threads in the preset state, and the reason why the preset target thread causes the performance fault is determined based on the running data of the sub-associated threads; wherein the sub-associated thread is a thread among the multiple threads, the sub-associated thread is directly or indirectly associated with the associated thread in the preset state, and the thread directly associated with the sub-associated thread is in the preset state.
3. The method according to claim 1, characterized in that The determining, for each time period, a cause of the performance failure based on the running data of the multiple threads corresponding to the time period includes: The operation data of multiple threads in each time period are analyzed by using a parallel processing mechanism to determine the cause of the performance failure corresponding to each time period.
4. The method according to claim 1, characterized in that The method further comprises: Determine the target operating data associated with the target cause among the operating data of the multiple threads in the different time periods; The target reason and the target operation data are displayed.
5. The method according to claim 4, characterized in that The method further comprises: For each time period, based on the cause of the performance failure, marking the running data of the multiple threads; In the determining of the operation data of the multiple threads in the different time periods, the target operation data associated with the target cause includes: Based on the marks of the running data of the multiple threads in each time period, the target running data associated with the target cause is determined in the running data of the multiple threads in the different time periods.
6. The method according to claim 1, characterized in that The obtaining of the running data of multiple threads in different time periods includes: In response to the terminal device running the multiple threads detecting the performance failure, receiving the running data of the multiple threads in the different time periods sent by the terminal device.
7. A fault diagnosis device, characterized in that: The device comprises: An acquisition module, configured to acquire running data of multiple threads in different time periods; A first determination module is configured to determine, for each time period, a cause of the performance failure based on the running data of the multiple threads corresponding to the time period; A cluster processing module, configured to perform cluster processing based on the causes of the performance failure corresponding to each time period to obtain a target cause of the performance failure; Among them, the first determination module is also configured to determine, for each time period, whether the running state of a preset target thread among the multiple threads is a preset state based on the running data of the multiple threads corresponding to the time period; in response to the running state of the preset target thread being the preset state and the thread causing the performance fault being the preset target thread, determine the reason why the preset target thread causes the performance fault based on the running data of the associated threads associated with the preset target thread among the multiple threads and whether the running state of each associated thread is the preset state; wherein the running state of each associated thread is determined based on the running data of the associated thread; the associated threads include at least one of the following: a thread created and managed by the preset target thread; a thread that creates and manages the preset target thread; a thread that has mutual influence and resource competition with the preset target thread; a thread that provides services or support for the preset target thread.
8. An electronic device, characterized in that: include: processor; Memory for storing computer programs or instructions; The processor executes the computer program or instructions to implement the steps of the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing a computer program or instruction, characterized in that: When the computer program or instructions in the storage medium are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Fault positioning method and device and storage medium
CN111930547A
Performance monitoring method and device, readable storage medium and computer program product
CN117971600A