Kernel interrupt monitoring method and device, equipment and storage medium

By configuring interrupt numbers and thresholds, the kernel interrupt shutdown events are captured and monitored and relevant process information is captured, and the problem of difficulty in monitoring kernel interrupts in the existing technology is solved, and the in-depth analysis of interrupt status and problem positioning is achieved, which improves the performance and stability of the operating system.

CN119847873AInactive Publication Date: 2025-04-18LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411996474.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology is difficult to monitor and analyze kernel interrupts in depth, and cannot effectively track interrupt processing. There is a lack of an effective way to monitor interrupt load.

Method used

By configuring the interrupt number and interrupt shutdown time threshold of the interrupt shutdown event to be monitored, the occurrence of the interrupt shutdown event is captured, and the interrupt shutdown event is monitored according to the threshold, relevant process information is captured, and stored in the kernel data structure.

Benefits of technology

It realizes in-depth monitoring of kernel interrupt status, provides the context of interrupt source, helps problem backtracking or positioning, and improves the performance and stability of the operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847873A_ABST
    Figure CN119847873A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a kernel interrupt monitoring method, device and equipment and a storage medium, and the method comprises the following steps: configuring an interrupt number of an interrupt closing event to be monitored and an interrupt closing duration threshold; after the monitoring service is started, the occurrence of an interrupt closing event is captured according to the interrupt number, and the interrupt closing event is monitored according to an interrupt closing duration threshold value so as to capture process information related to the interrupt closing event; and storing the monitored information of the interrupt closing event and the captured process information in a kernel data structure through a cache mechanism. In this way, interrupt configuration and threshold condition setting are supported, operation is convenient, interrupt closing events can be captured and monitored, the kernel interrupt state can be deeply analyzed, the context of an interrupt source can be provided, and guidance information is provided for problem backtracking or positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a kernel interrupt monitoring method, device, equipment and storage medium. Background Art

[0002] In a computer system, the kernel, as the core component of the operating system, is responsible for managing and coordinating the interaction between hardware resources and upper-level applications. The performance of the kernel directly affects the stability and response speed of the entire system, and interrupts are the key mechanism for the kernel to handle hardware events. However, kernel programmers often lack effective ways to monitor interrupts when faced with interrupt loads. Related performance monitoring methods usually cannot go deep into the kernel level and cannot effectively track the interrupt processing process.

[0003] Therefore, how to design a monitoring method for kernel interrupts to help kernel programmers accurately identify and solve problems related to interrupts is a technical problem that people in this field urgently need to solve. Summary of the invention

[0004] The purpose of the present invention is to provide a kernel interrupt monitoring method, device, equipment and storage medium, which can monitor the kernel interrupt status and provide the context of the interrupt source, providing guidance information for problem backtracing or positioning.

[0005] In order to solve the above technical problems, the present invention provides a kernel interrupt monitoring method, the method comprising:

[0006] Configure the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event;

[0007] After the monitoring service is started, the occurrence of the interrupt shutdown event is captured according to the configured interrupt number, and the interrupt shutdown event is monitored according to the configured interrupt shutdown duration threshold to capture process information related to the interrupt shutdown event;

[0008] The monitored information of the interruption disabling event and the captured process information are stored in the kernel data structure through a cache mechanism.

[0009] In a first aspect, in the kernel interrupt monitoring method provided by the present invention, configuring the interrupt number of the interrupt disabling event to be monitored includes:

[0010] The interrupt number of the interrupt disabling event is configured as a specified hardware interrupt number, or the interrupt number of the interrupt disabling event is configured as all interrupts;

[0011] When configuring the interrupt number of the interrupt shutdown event to be monitored and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event, it also includes:

[0012] Define a recording strategy for monitoring information; the recording strategy includes periodic recording and automatic recording.

[0013] On the other hand, in the above-mentioned kernel interrupt monitoring method provided by the present invention, after the monitoring service is started, the occurrence of the interrupt shutdown event is captured according to the configured interrupt number, including:

[0014] After the monitoring service is enabled, a hook point is implanted in a key function of the kernel, and the hook point is used to scan the interrupt shutdown information in the kernel in real time to capture the occurrence of the interrupt shutdown event according to the configured interrupt number.

[0015] On the other hand, in the kernel interrupt monitoring method provided by the present invention, monitoring the interrupt disabling event according to the configured interrupt disabling duration threshold includes:

[0016] After capturing the occurrence of the interrupt shutdown event, monitoring the interrupt shutdown event, continuously detecting the interrupt shutdown time of the interrupt shutdown event, and comparing the detected interrupt shutdown time with the interrupt shutdown duration threshold;

[0017] Determine whether the detected interruption shutdown time exceeds the interruption shutdown time threshold;

[0018] If the detected interruption closing time exceeds the interruption closing time threshold, triggering an action of capturing process information related to the interruption closing event;

[0019] If the detected interruption shutdown time does not exceed the interruption shutdown duration threshold, the monitoring module enters a guarding state and continues to monitor the interruption shutdown event;

[0020] Among them, when there are multiple interrupt shutdown events, in the process of real-time monitoring of the interrupt shutdown events and continuous detection of the interrupt shutdown time of the interrupt shutdown events, monitoring and filtering are performed according to the interrupt number corresponding to the interrupt shutdown event, and the multiple interrupt shutdown events that occur are filtered out, and the interrupt shutdown time of the multiple interrupt shutdown events is calculated in real time, so that the calculated multiple interrupt shutdown times are compared with the interrupt shutdown duration threshold.

[0021] On the other hand, in the kernel interrupt monitoring method provided by the present invention, capturing process information related to the interrupt disabling event includes:

[0022] After triggering the action of capturing the process information related to the interruption-disabled event, the process information including the call stack, lock, and corresponding file related to the interruption-disabled event is captured.

[0023] On the other hand, in the kernel interrupt monitoring method provided by the present invention, the monitored information of the interrupt shutdown event and the captured process information are stored in the kernel data structure through a cache mechanism, including:

[0024] Temporarily storing the monitored interrupt shutdown event information and captured process information in a kernel data structure through a high-speed cache storage mechanism;

[0025] Solidify the information stored in the kernel data structure into the log file.

[0026] On the other hand, in the kernel interrupt monitoring method provided by the present invention, the information stored in the kernel data structure is solidified into a log file, including:

[0027] According to the defined recording strategy, when the system processor and memory utilization are lower than the set percentage, the file writing disk action is started, and the information stored in the kernel data structure is written to the disk in the form of a log.

[0028] In order to solve the above technical problems, the present invention further provides a kernel interrupt monitoring device, the device comprising:

[0029] A configuration module, used to configure the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event;

[0030] Switch module, used to turn on or off the monitoring service;

[0031] A monitoring module, configured to capture the occurrence of an interrupt shutdown event according to the interrupt number configured by the configuration module after the switch module starts the monitoring service, and monitor the interrupt shutdown event according to the interrupt shutdown duration threshold configured by the configuration module to capture process information related to the interrupt shutdown event;

[0032] The recording module is used to store the information of the interruption closing event monitored by the monitoring module and the captured process information in the kernel data structure through a cache mechanism.

[0033] In order to solve the above technical problems, the present invention further provides a kernel interrupt monitoring device, the device comprising:

[0034] Memory for storing computer programs;

[0035] The processor is used to implement the steps of the above-mentioned kernel interrupt monitoring method when executing the computer program.

[0036] In order to solve the above technical problem, the present invention also provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above kernel interrupt monitoring method are implemented.

[0037] In order to solve the above technical problem, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above kernel interrupt monitoring method when executed by a processor.

[0038] It can be seen from the above technical scheme that a kernel interrupt monitoring method provided by the present invention includes: configuring the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event; after starting the monitoring service, capturing the occurrence of the interrupt shutdown event according to the configured interrupt number, and monitoring the interrupt shutdown event according to the configured interrupt shutdown duration threshold to capture the process information related to the interrupt shutdown event; storing the monitored interrupt shutdown event information and the captured process information in the kernel data structure through a cache mechanism.

[0039] The beneficial effect of the present invention lies in that the above-mentioned kernel interrupt monitoring method provided by the present invention pre-configures the interrupt number and the interrupt shutdown duration threshold. After the monitoring service is started, the occurrence of the interrupt shutdown event is captured according to the interrupt number, and the interrupt shutdown event is monitored according to the interrupt shutdown duration threshold, and then the process information related to the interrupt shutdown event is captured. This information is stored in the kernel data structure through a cache mechanism, which supports the configuration of interrupts and the setting of threshold conditions, runs in a daemon service mode, is easy to operate, can capture and monitor kernel interrupt shutdown events, and then can deeply analyze the kernel interrupt status, and capture the process information related to the interrupt shutdown event, which can provide the context of the interrupt source, provide guidance information for problem backtracing or positioning, and is of great significance for improving the performance and stability of the operating system.

[0040] In addition, the present invention also provides a corresponding kernel interrupt monitoring device, a kernel interrupt monitoring equipment and a non-volatile storage medium for the kernel interrupt monitoring device, which have the same or corresponding technical features as the above-mentioned kernel interrupt monitoring method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 A flowchart of a kernel interrupt monitoring method provided by an embodiment of the present invention;

[0043] Figure 2 A schematic diagram of the structure of a kernel interrupt monitoring device provided by an embodiment of the present invention;

[0044] Figure 3 A schematic diagram of the structure of a kernel interrupt monitoring device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0045] Although related log analysis and performance monitoring methods can provide a certain degree of help, they usually cannot go deep into the kernel level. For example: using irqtop (an interrupt request performance testing tool) and lsirq (a tool that displays interrupt information) can help system administrators and developers analyze and optimize interrupt processing performance. irqtop is similar to the top (performance monitoring) command and can display interrupt statistics in real time; lsirq can scan interrupt information and aggregate data output. It supports multiple output formats, including the default text mode, JSON (JavaScript Object Notation) output, and key-value pair output. This tool is very useful for monitoring system integration that needs to process interrupt information in a specific format. Although irqtop and lsirq provide convenience in analyzing interrupt performance, there are some problems when dealing with high interrupt issues: the data update interval of irqtop may cause some important interrupt events to be missed in a short period of time, which may be insufficient for accurately monitoring rapidly changing interrupt situations; lsirq is mainly a static tool that does not provide real-time data, so it may not be effective enough when analyzing interrupt bursts; irqtop provides interactive sorting capabilities, but it does not provide enough low-level details, such as the specific interrupt service execution status, which is necessary for in-depth analysis of specific interrupt problems.

[0046] In an operating system, interrupt latency is an important performance indicator. Although irqtop and lsirq can display the rate and count of interrupts, they cannot provide detailed analysis of interrupt latency, such as the time from when an interrupt occurs to when the service starts executing, which is a limitation for identifying and solving interrupt processing delay problems. irqtop and lsirq mainly provide real-time interrupt information. Unlike some log analysis tools, they cannot provide historical data backtracking. When analyzing long-term interrupt trends or periodic problems, these tools may not provide enough information. irqtop can display the source of the interrupt, but it may not provide detailed context of the interrupt source, such as which device or driver caused the interrupt. When processing a large number of interrupt events, irqtop and lsirq may not be able to effectively filter and aggregate data, causing users to be overwhelmed by a large amount of information during analysis and difficult to quickly identify key problems. In order to solve the above technical problems, the present invention provides a kernel interrupt monitoring method.

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, a number of other embodiments obtained by ordinary technicians in this field without creative work all belong to the protection scope of the present invention.

[0048] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 A flowchart of a kernel interrupt monitoring method provided by an embodiment of the present invention, such as Figure 1 As shown, the kernel interrupt monitoring method includes:

[0049] S101: Configure the interrupt number of the interrupt shutdown event to be monitored and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event.

[0050] In implementation, for different scenarios, the user can use the configuration module to configure the interrupt number to be monitored. In addition, the user can also use the configuration module to configure the interrupt shutdown time threshold corresponding to the interrupt shutdown event.

[0051] It should be noted that the interrupt number is a number used to identify different interrupt sources. When an interrupt occurs, for example, the hardware device requires the processor to handle certain tasks immediately, or a specific event occurs during the software running process and the current task needs to be suspended to handle other situations, an interrupt request will be generated. Each interrupt request has a corresponding interrupt number.

[0052] S102: After the monitoring service is enabled, the occurrence of an interrupt shutdown event is captured according to the configured interrupt number, and the interrupt shutdown event is monitored according to the configured interrupt shutdown duration threshold to capture process information related to the interrupt shutdown event.

[0053] In implementation, after the switch module turns on the monitoring service, the present invention can capture the occurrence of an interrupt shutdown event through the monitoring module according to the interrupt number configured by the configuration module, and then monitor the interrupt shutdown event according to the interrupt shutdown duration threshold configured by the configuration module, and capture the process information related to the interrupt shutdown event.

[0054] S103: storing the monitored interruption disabling event information and the captured process information in a kernel data structure through a cache mechanism.

[0055] It should be noted that the present invention can automatically record abnormal situations, which can help developers and system administrators to deeply understand the interruption behavior in the system and timely discover and solve potential interruption-related problems.

[0056] In the above-mentioned kernel interrupt monitoring method provided by the embodiment of the present invention, the interrupt number and the interrupt shutdown duration threshold can be pre-configured. After the monitoring service is started, the occurrence of the interrupt shutdown event is captured according to the interrupt number, and the interrupt shutdown event is monitored according to the interrupt shutdown duration threshold, and then the process information related to the interrupt shutdown event is captured. This information is stored in the kernel data structure through a cache mechanism, which supports the configuration of interrupts and the setting of threshold conditions. It runs in a daemon service mode, is easy to operate, can capture and monitor kernel interrupt shutdown events, and then can deeply analyze the kernel interrupt status, and capture the process information related to the interrupt shutdown event, which can provide the context of the interrupt source and provide guidance information for problem backtracing or positioning, which is of great significance for improving the performance and stability of the operating system.

[0057] Furthermore, in a specific implementation, in the above-mentioned kernel interrupt monitoring method provided in an embodiment of the present invention, step S101 configures the interrupt number of the interrupt shutdown event to be monitored, which may specifically include: configuring the interrupt number of the interrupt shutdown event to be a specified hardware interrupt number, or configuring the interrupt number of the interrupt shutdown event to be all interrupts.

[0058] In implementation, in the process of configuring the interrupt number of the interrupt shutdown event, the present invention can configure the interrupt number to a specific hardware interrupt number irq (for example, irq=10) or all interrupts all, so that subsequent monitoring of specific interrupts or all interrupts can be performed. The user can also configure the interrupt shutdown duration threshold thre corresponding to the interrupt shutdown event (for example, thre=20ms). It should be noted that the configured interrupt number and interrupt shutdown duration threshold thre can be dynamically adjusted according to user settings to meet the needs of different scenarios and minimize the impact on system services.

[0059] Furthermore, in a specific implementation, in the above-mentioned kernel interrupt monitoring method provided in an embodiment of the present invention, while executing step S101 to configure the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event, it may also include: defining a recording strategy for monitoring information; the recording strategy includes periodic recording and automatic recording.

[0060] In implementation, the present invention can support setting the recording strategy of monitoring information, that is, while configuring the interrupt number of the interrupt shutdown event to be monitored and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event, it can also define whether the monitoring information is recorded in a periodic (period) manner or in an automatic (auto) manner. This further reduces the impact on system service performance.

[0061] Furthermore, in a specific implementation, in the above-mentioned kernel interrupt monitoring method provided in an embodiment of the present invention, after the monitoring service is started, step S102 captures the occurrence of an interrupt shutdown event according to the configured interrupt number, which may specifically include: after the monitoring service is started, a hook point is implanted in the key function of the kernel, and the hook point is used to scan the interrupt shutdown information in the kernel in real time, so as to capture the occurrence of an interrupt shutdown event with the configured interrupt number.

[0062] In implementation, after the monitoring service is enabled, the present invention is responsible for implanting hook points in key functions of the kernel, and utilizing these hook points to scan interrupt shutdown information in the kernel in real time, and then to capture the occurrence of interrupt shutdown events according to the configured interrupt number.

[0063] Further, in specific implementation, in the above-mentioned kernel interrupt monitoring method provided by an embodiment of the present invention, step S102 monitors the interrupt shutdown event according to the configured interrupt shutdown duration threshold, which may specifically include: after capturing the occurrence of the interrupt shutdown event, monitoring the interrupt shutdown event, continuously detecting the interrupt shutdown time of the interrupt shutdown event, and comparing the detected interrupt shutdown time with the interrupt shutdown duration threshold; judging whether the detected interrupt shutdown time exceeds the interrupt shutdown duration threshold; if the detected interrupt shutdown time exceeds the interrupt shutdown duration threshold, triggering the capture action of the process information related to the interrupt shutdown event; if the detected interrupt shutdown time does not exceed the interrupt shutdown duration threshold, entering the guard state and continuing to monitor the interrupt shutdown event; wherein, when there are multiple interrupt shutdown events, in the process of real-time monitoring of the interrupt shutdown event and continuously detecting the interrupt shutdown time of the interrupt shutdown event, monitoring and filtering are performed according to the interrupt number corresponding to the interrupt shutdown event, filtering out multiple interrupt shutdown events that have occurred, and calculating the interrupt shutdown time of multiple interrupt shutdown events in real time, so as to compare the calculated multiple interrupt shutdown times with the interrupt shutdown duration threshold.

[0064] In implementation, the present invention can monitor the interruption closing operation in real time according to the configured interruption closing duration threshold, and trigger a warning when necessary. Specifically, after capturing the occurrence of an interruption closing event, the interruption closing event can be monitored in real time, the interruption closing time of the interruption closing event can be continuously detected, and the detected interruption closing time can be compared with the interruption closing duration threshold. If the detected interruption closing time exceeds the interruption closing duration threshold, the capture action of the process information related to the interruption closing event is immediately triggered, that is, the information capture is started to obtain the process information corresponding to the interruption. If the detected interruption closing time does not exceed the interruption closing duration threshold, the guard state is entered to continue to monitor the interruption closing event. When there are multiple interruption closing events, the present invention can specifically monitor and filter according to the configured interrupt number, filter out all interruption closing events that occur, and calculate the interruption closing time of all interruption closing events in real time, and then use the calculated interruption closing time to compare with the interruption closing duration threshold.

[0065] Furthermore, in a specific implementation, in the above-mentioned kernel interrupt monitoring method provided in an embodiment of the present invention, step S102 captures process information related to the interrupt shutdown event, which may specifically include: after triggering the action of capturing process information related to the interrupt shutdown event, capturing process information including a call stack, lock, and corresponding file related to the interrupt shutdown event.

[0066] In implementation, the present invention can timely capture process-related information after triggering the capture action of process information related to the interrupt shutdown event. The process-related information includes call stack, lock, corresponding file and other information, further providing rich context information for problem diagnosis and analysis.

[0067] Furthermore, in a specific implementation, in the above-mentioned kernel interrupt monitoring method provided in an embodiment of the present invention, step S103 stores the information of the monitored interrupt closing event and the captured process information in the kernel data structure through a cache mechanism, which may specifically include: first temporarily storing the information of the monitored interrupt closing event and the captured process information in the kernel data structure through a cache storage mechanism; and then solidifying the information stored in the kernel data structure into a log file.

[0068] In implementation, the present invention can temporarily store the information of monitored interrupt shutdown events and captured process information in the kernel data structure through a cache storage mechanism to reduce the impact on system performance; subsequently, the information stored in the kernel data structure can be solidified into a log file to provide problem locating personnel with detailed historical interrupt information for analysis and locating.

[0069] Furthermore, in a specific implementation, the above steps of fixing the information stored in the kernel data structure into the log file may include: according to a defined recording strategy, automatically writing the information stored in the kernel data structure into the log file periodically or under set conditions. Specifically, according to the defined recording strategy, when the system processor and memory utilization rate is lower than a set percentage, the file writing action may be initiated to write the information stored in the kernel data structure into the disk in the form of a log.

[0070] In implementation, the present invention can automatically write the information stored in the kernel data structure into the log file periodically or under specific conditions according to the defined recording strategy. In this way, the system administrator can conveniently review and analyze the interruption event, thereby optimizing the system performance and stability. Specifically, according to the defined recording strategy, when the system processor (such as the central processing unit) and the memory utilization rate are lower than the set percentage (such as 30%), the file writing disk action can be started, and the information stored in the kernel data structure can be written to the disk in the form of a log. In this way, the log is stored in the disk file, which can be stored persistently, and it can ensure that important monitoring data and process information will not be lost under high load conditions.

[0071] Furthermore, in the specific implementation, the kernel interrupt monitoring method provided in the embodiment of the present invention may also include: generating an interrupt processing view based on the recorded information and displaying it. The interrupt processing view can clearly display the process information and time consumption of the interrupt. This provides a clear interrupt processing view for kernel programmers, making it easier for kernel programmers to accurately identify interrupt shutdown information, accurately locate the interrupt location and duration, and can help understand the occupation of system resources by interrupt processing, so as to more reasonably allocate resources and avoid resource waste.

[0072] In the above embodiments, the kernel interrupt monitoring method is described in detail, and the present invention also provides kernel interrupt monitoring apparatus and kernel interrupt monitoring device corresponding embodiments. It should be noted that the present invention describes the embodiments of the apparatus part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.

[0073] Figure 2 This is a schematic diagram of the structure of the kernel interrupt monitoring device provided by an embodiment of the present invention. This embodiment is based on the perspective of functional modules, such as Figure 2 As shown, the device comprises:

[0074] Configuration module 11, used to configure the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event;

[0075] A switch module 12, used to turn on or off the monitoring service;

[0076] The monitoring module 13 is used to capture the occurrence of the interrupt shutdown event according to the interrupt number configured by the configuration module after the switch module 12 starts the monitoring service, and monitor the interrupt shutdown event according to the interrupt shutdown duration threshold configured by the configuration module to capture the process information related to the interrupt shutdown event;

[0077] The recording module 14 is used to store the information of the interruption disabling event detected by the monitoring module 13 and the captured process information in the kernel data structure through a cache mechanism.

[0078] In the above-mentioned kernel interrupt monitoring device provided by the embodiment of the present invention, through the interaction of the configuration module 11, the switch module 12, the monitoring module 13 and the recording module 14, the interrupt number and the interrupt shutdown duration threshold can be pre-configured. After the monitoring service is turned on, the occurrence of the interrupt shutdown event is captured according to the interrupt number, and the interrupt shutdown event is monitored according to the interrupt shutdown duration threshold, and then the process information related to the interrupt shutdown event is captured. This information is stored in the kernel data structure through a cache mechanism, which supports the configuration of interrupts and the setting of threshold conditions. It runs in a daemon service mode without manual operation, is easy to operate, can capture and monitor kernel interrupt shutdown events, and then can deeply analyze the kernel interrupt status, and capture the process information related to the interrupt shutdown event, which can provide the context of the interrupt source and provide guidance information for problem backtracing or positioning, which is of great significance for improving the performance and stability of the operating system.

[0079] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part refer to the description of the embodiments of the method part, which will not be described here. And it has the same beneficial effects as the kernel interrupt monitoring method mentioned above.

[0080] Furthermore, in a specific implementation, in the kernel interrupt monitoring device provided in the embodiment of the present invention, the configuration module 11 can also be used to define a recording strategy for monitoring information using the configuration module; the recording strategy includes periodic recording and automatic recording.

[0081] In practice, the configuration module 11 of the present invention is a user interface of the system, allowing the user to specify the interrupt number to be monitored and the corresponding interrupt shutdown time threshold, and also define a recording strategy for monitoring information.

[0082] Furthermore, in a specific implementation, in the above-mentioned kernel interrupt monitoring device provided in an embodiment of the present invention, the monitoring module 13 can be specifically used to implant a hook point in the key function of the kernel after the switch module 12 turns on the monitoring service, and use the hook point to scan the interrupt shutdown information in the kernel in real time to capture the occurrence of an interrupt shutdown event according to the interrupt number configured by the configuration module.

[0083] In practice, the switch module 12 of the present invention serves as the control center of the monitoring system to manage the operating status of other modules. The user can easily turn on or off the entire monitoring service through the switch module 12. After the switch module 12 turns on the monitoring service, the monitoring module 13 can implant a hook point in the key function of the kernel, and use the hook point to scan the interrupt shutdown information in the kernel in real time to capture the occurrence of the interrupt shutdown event according to the interrupt number configured by the configuration module 11.

[0084] Furthermore, in specific implementation, in the above-mentioned kernel interrupt monitoring device provided by the embodiment of the present invention, the monitoring module 13 can be specifically used to monitor the interrupt shutdown event after capturing the occurrence of the interrupt shutdown event, continuously detect the interrupt shutdown time of the interrupt shutdown event, and compare the detected interrupt shutdown time with the interrupt shutdown duration threshold; determine whether the detected interrupt shutdown time exceeds the interrupt shutdown duration threshold; if the detected interrupt shutdown time exceeds the interrupt shutdown duration threshold, trigger the capture action of the process information related to the interrupt shutdown event; if the detected interrupt shutdown time does not exceed the interrupt shutdown duration threshold, the monitoring module enters the guard state and continues to monitor the interrupt shutdown event. When there are multiple interrupt shutdown events, in the process of real-time monitoring of the interrupt shutdown event and continuously detecting the interrupt shutdown time of the interrupt shutdown event, monitoring and filtering are performed according to the interrupt number corresponding to the interrupt shutdown event, multiple interrupt shutdown events that have occurred are filtered out, and the interrupt shutdown times of the multiple interrupt shutdown events are calculated in real time.

[0085] Furthermore, in the specific implementation, in the above-mentioned kernel interrupt monitoring device provided in the embodiment of the present invention, the recording module 14 can be specifically used to temporarily store the information of the interrupt closing event monitored by the monitoring module 13 and the captured process information in the kernel data structure through a cache storage mechanism; and solidify the information stored in the kernel data structure into a log file.

[0086] In practice, the recording module 14 can be used to automatically write the information stored in the kernel data structure into the log file periodically or under set conditions according to the recording strategy defined by the configuration module. In this way, the system administrator can conveniently review and analyze interruption events, thereby optimizing system performance and stability. In addition, the recording module 14 can be used to start the file writing action to the disk when the system processor and memory utilization rate are lower than the set percentage according to the recording strategy defined by the configuration module, and the information stored in the kernel data structure can be written to the disk in the form of a log.

[0087] Furthermore, in the specific implementation, the kernel interrupt monitoring device provided in the embodiment of the present invention may also include: a display module, which is used to generate and display an interrupt processing view based on the recorded information. This provides a clear interrupt processing view, which is convenient for kernel programmers to accurately identify interrupt shutdown information, accurately locate the interrupt position and duration, and help understand the occupation of system resources by interrupt processing, so as to more reasonably allocate resources and avoid resource waste.

[0088] Figure 3 This is a schematic diagram of the structure of the kernel interrupt monitoring device provided by an embodiment of the present invention. This embodiment describes the embodiment of the device part from the hardware perspective, such as Figure 3 As shown, the kernel interrupt monitoring device includes:

[0089] A memory 20, used for storing computer programs;

[0090] The processor 21 is used to implement the steps of the kernel interrupt monitoring method mentioned in the above embodiment when executing a computer program.

[0091] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0092] The memory 20 may include one or more non-volatile storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the kernel interrupt monitoring method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the kernel interrupt monitoring method mentioned above.

[0093] In some embodiments, the kernel interrupt monitoring device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26. Those skilled in the art will appreciate that Figure 3The structure shown in the figure does not constitute a limitation on the kernel interrupt monitoring device, and may include more or fewer components than shown in the figure. The kernel interrupt monitoring device provided by the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: a kernel interrupt monitoring method, the effect is the same as above.

[0094] Finally, the present invention also provides an embodiment corresponding to a non-volatile storage medium. The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps described in the embodiment of the kernel interrupt monitoring method are implemented.

[0095] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code. The non-volatile storage medium provided by the present invention can implement the kernel interrupt monitoring method mentioned above, and the effect is the same as above.

[0096] Finally, the present invention also provides an embodiment corresponding to a computer program product. The computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps described in the above-mentioned kernel interrupt monitoring method embodiment are implemented. The computer program product provided by the present invention can implement the above-mentioned kernel interrupt monitoring method, and the effect is the same as above.

[0097] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0098] The kernel interrupt monitoring method, device, equipment and storage medium provided by the present invention are introduced in detail above. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A kernel interrupt monitoring method, characterized in that: The method comprises: Configure the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event; After the monitoring service is started, the occurrence of the interrupt shutdown event is captured according to the configured interrupt number, and the interrupt shutdown event is monitored according to the configured interrupt shutdown duration threshold to capture process information related to the interrupt shutdown event; The monitored information of the interruption disabling event and the captured process information are stored in the kernel data structure through a cache mechanism.

2. The kernel interrupt monitoring method according to claim 1, characterized in that: Configure the interrupt number of the interrupt shutdown event to be monitored, including: The interrupt number of the interrupt disabling event is configured as a specified hardware interrupt number, or the interrupt number of the interrupt disabling event is configured as all interrupts; When configuring the interrupt number of the interrupt shutdown event to be monitored and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event, it also includes: Define a recording strategy for monitoring information; the recording strategy includes periodic recording and automatic recording.

3. The kernel interrupt monitoring method according to claim 1, characterized in that: After the monitoring service is enabled, the occurrence of the interrupt shutdown event is captured according to the configured interrupt number, including: After the monitoring service is enabled, a hook point is implanted in a key function of the kernel, and the hook point is used to scan the interrupt shutdown information in the kernel in real time to capture the occurrence of the interrupt shutdown event according to the configured interrupt number.

4. The kernel interrupt monitoring method according to claim 1, characterized in that: The interruption disabling event is monitored according to the configured interruption disabling duration threshold, including: After capturing the occurrence of the interrupt shutdown event, monitoring the interrupt shutdown event, continuously detecting the interrupt shutdown time of the interrupt shutdown event, and comparing the detected interrupt shutdown time with the interrupt shutdown duration threshold; Determine whether the detected interruption shutdown time exceeds the interruption shutdown time threshold; If the detected interruption closing time exceeds the interruption closing time threshold, triggering an action of capturing process information related to the interruption closing event; If the detected interruption shutdown time does not exceed the interruption shutdown duration threshold, the system enters the guarding state and continues to monitor the interruption shutdown event; Among them, when there are multiple interrupt shutdown events, in the process of real-time monitoring of the interrupt shutdown events and continuous detection of the interrupt shutdown time of the interrupt shutdown events, monitoring and filtering are performed according to the interrupt number corresponding to the interrupt shutdown event, and the multiple interrupt shutdown events that occur are filtered out, and the interrupt shutdown time of the multiple interrupt shutdown events is calculated in real time, so as to compare the calculated multiple interrupt shutdown times with the interrupt shutdown duration threshold.

5. The kernel interrupt monitoring method according to claim 4, characterized in that: Capture process information related to the interrupt shutdown event, including: After triggering the action of capturing the process information related to the interruption-disabled event, the process information including the call stack, lock, and corresponding file related to the interruption-disabled event is captured.

6. The kernel interrupt monitoring method according to claim 2, characterized in that: The monitored information of the interrupt shutdown event and the captured process information are stored in the kernel data structure through a cache mechanism, including: Temporarily storing the monitored interrupt shutdown event information and captured process information in a kernel data structure through a high-speed cache storage mechanism; Solidify the information stored in the kernel data structure into the log file.

7. The kernel interrupt monitoring device according to claim 6, characterized in that: Solidify the information stored in the kernel data structure into the log file, including: According to the defined recording strategy, when the system processor and memory utilization are lower than the set percentage, the file writing disk action is started, and the information stored in the kernel data structure is written to the disk in the form of a log.

8. A kernel interrupt monitoring device, characterized in that: The method comprises: A configuration module, used to configure the interrupt number of the interrupt shutdown event to be monitored, and the interrupt shutdown duration threshold corresponding to the interrupt shutdown event; Switch module, used to turn on or off the monitoring service; A monitoring module, configured to capture the occurrence of an interrupt shutdown event according to the interrupt number configured by the configuration module after the switch module starts the monitoring service, and monitor the interrupt shutdown event according to the interrupt shutdown duration threshold configured by the configuration module to capture process information related to the interrupt shutdown event; The recording module is used to store the information of the interruption closing event monitored by the monitoring module and the captured process information in the kernel data structure through a cache mechanism.

9. A kernel interrupt monitoring device, characterized in that: The device comprises: Memory for storing computer programs; A processor, configured to implement the steps of the kernel interrupt monitoring method as claimed in any one of claims 1 to 7 when executing the computer program.

10. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the kernel interrupt monitoring method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Interrupt tracking method, system and device and readable storage medium

    CN115129450A

  • Method and device for monitoring interruption state, electronic equipment and storage medium

    CN116225820A