A CPU anomaly detection method, device, equipment and medium
By calculating the estimated threshold value and occupancy fluctuation value, the CPU occupancy anomaly is accurately detected, solving the problem of the existing technology that CPU anomalies cannot be handled in a timely manner, reducing the risk of CPU running business suspension, and improving CPU resource utilization efficiency.
Patent Information
- Application Number
- CN202210322222.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-03-30
AI Technical Summary
The CPU anomaly detection method in the prior art cannot accurately determine the CPU occupancy anomaly, resulting in the CPU anomaly affecting normal business operations and failing to handle abnormal business in a timely manner.
By obtaining the actual current CPU usage, calculating the estimated threshold and positive fluctuation value, the system determines whether the CPU usage is abnormal. It then determines which services can be shut down based on the CPU usage of regular, frequency-reduced, and streaming services, reducing the risk of simultaneous suspension of services running on the CPU.
It can accurately detect abnormal CPU usage, reduce the risk of simultaneous suspension of services running in the CPU, handle abnormal services in a timely manner, and reduce CPU computing resource usage.
Smart Images

Figure CN114791864B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of CPU fault diagnosis, and in particular to a CPU anomaly detection method, device, equipment and medium. Background Art
[0002] In the computer industry, abnormal CPU usage is a common occurrence in every application. Current methods for determining CPU anomalies are relatively simplistic and general, leading to misjudgments.
[0003] Due to the large amount of data transmission, there are a lot of abnormal CPU usage in the embedded recording and broadcasting industry. For the existing abnormal CPU usage detection, the highest empirical value method is usually used.
[0004] The empirical maximum method uses a preset CPU usage threshold (ET) based on past experience to determine when an exception occurs. When the program's CPU usage exceeds ET, an exception is considered. For example, if ET is set to 70%, the program is considered abnormal and all threads within the CPU are suspended.
[0005] Although this method can avoid the CPU "avalanche" caused by abnormal CPU occupancy, it is too rigid. For example, when there is an abnormal thread in the CPU that causes excessive occupancy, all services will be suspended, greatly affecting the use of the CPU. Moreover, the occupancy value ET is a statistical value. Even if there is an abnormal thread in the CPU with excessive occupancy, the CPU will not detect the abnormality and will continue to run the abnormal thread. Therefore, in the existing technology, the method of detecting abnormal CPU occupancy has certain disadvantages. Summary of the Invention
[0006] In view of the above problems in the prior art, the purpose of this article is to provide a CPU anomaly detection method, device, equipment and medium to solve the problem that the prior art cannot accurately determine the CPU occupancy anomaly.
[0007] In order to solve the above technical problems, the specific technical solutions of this article are as follows:
[0008] On the one hand, this article provides a CPU anomaly detection method, including:
[0009] Obtaining the actual current CPU occupancy rate, and when the actual occupancy rate is greater than the estimated threshold value, determining within a test period whether the difference between the actual occupancy rate and the estimated threshold value is greater than the CPU occupancy rate of the portion of the service that can be shut down;
[0010] If it is greater than, it is determined that the CPU occupancy rate is abnormal;
[0011] The estimated threshold value is determined according to an estimated occupancy value and a positive occupancy fluctuation value of the CPU when the CPU runs the current service;
[0012] The CPU occupancy rate of the closable service is determined according to the CPU occupancy rate of the conventional service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service.
[0013] As an embodiment of this invention, the method for calculating the occupancy rate estimate includes:
[0014] Determining a CPU occupancy rate of the streaming media service according to at least one of the recording channel occupancy rate table, the streaming channel occupancy rate table, and the interactive channel occupancy rate table;
[0015] Obtaining the CPU occupancy rate of the basic service, the CPU occupancy rate of the conventional service, and the CPU occupancy rate of the frequency-reduced service;
[0016] An estimated occupancy value is determined according to the CPU occupancy of the streaming service, the CPU occupancy of the basic service, the CPU occupancy of the conventional service, and the CPU occupancy of the frequency-reduced service.
[0017] As an embodiment of this invention, the method for determining the recording channel occupancy table includes:
[0018] Determine the basic CPU usage when the CPU is running the basic business;
[0019] Determine the bit rate and number of channels for recording;
[0020] Periodically sampling the recording CPU occupancy rate of the recording channel, and determining an average recording CPU occupancy rate based on the sampled recording CPU occupancy rates;
[0021] Determine a net occupancy rate of a current recording channel according to the average recording CPU occupancy rate and the basic CPU occupancy rate;
[0022] The bit rate and the number of channels of the recording channel are adjusted step by step to obtain the clean occupancy rates and arrange them to determine the recording channel occupancy rate table.
[0023] As an embodiment of the present invention, the periodic sampling of the recording CPU occupancy of the recording channel and determining the average recording CPU occupancy based on the sampled recording CPU occupancy rates further includes:
[0024] In this recording channel, the CPU usage is recorded by sampling at a period of at least one second.
[0025] Circular sampling is performed to obtain a sample group of recorded CPU usage;
[0026] Sort the recorded CPU occupancy rate sample groups according to the occupancy rate values;
[0027] Remove the recorded CPU usage within the first interval and the recorded CPU usage within the second interval of the sorting results to obtain a standard recorded CPU usage sample group;
[0028] The standard recording CPU occupancy rate sample group is averaged to obtain the average recording CPU occupancy rate.
[0029] As an embodiment of this document, the occupancy positive fluctuation value includes a recorded positive fluctuation value;
[0030] The method for calculating the recorded positive fluctuation value is: calculating the average value of the third interval of the standard recorded CPU occupancy rate sample group to obtain the recorded fluctuation rate, and subtracting the average recorded CPU occupancy rate from the recorded fluctuation rate to obtain the recorded positive fluctuation value.
[0031] As an embodiment of this invention, the method for determining the fluidization channel occupancy table includes:
[0032] Determine the basic CPU usage;
[0033] Determine the bitrate and number of channels for the streaming channel;
[0034] Periodically sampling the streaming CPU occupancy rate of the streaming channel, and determining an average streaming CPU occupancy rate based on a plurality of the sampled streaming CPU occupancy rates;
[0035] Determining a net occupancy rate of a current streaming channel according to the average streaming CPU occupancy rate and the basic CPU occupancy rate;
[0036] The bit rate and the number of channels of the streaming channels are adjusted step by step to obtain the clean occupancy rates and arrange them to determine the streaming channel occupancy table.
[0037] As an embodiment of the present invention, the periodic sampling of the streaming CPU occupancy rate of the streaming channel and determining the average streaming CPU occupancy rate based on the sampled streaming CPU occupancy rates further include:
[0038] Under the streaming channel, the streaming CPU occupancy rate is obtained by sampling at a period of at least one second;
[0039] Circular sampling is performed to obtain a streamed CPU occupancy rate sample group;
[0040] sorting the streamed CPU occupancy rate sample groups according to occupancy rate values;
[0041] Remove the streaming CPU occupancy rates in the first interval and the streaming CPU occupancy rates in the second interval of the sorting results to obtain a standard streaming CPU occupancy rate sample group;
[0042] An average operation is performed on the standard streaming CPU occupancy rate sample group to obtain the average streaming CPU occupancy rate.
[0043] As an embodiment of this document, the occupancy positive fluctuation value includes a fluidization positive fluctuation value;
[0044] The method for calculating the fluidization positive fluctuation value is: calculating the average value of the third interval of the standard fluidization CPU occupancy rate sample group to obtain the fluidization fluctuation rate, and subtracting the fluidization CPU occupancy rate from the fluidization fluctuation rate to obtain the fluidization positive fluctuation value.
[0045] As an embodiment of this invention, the method for determining the interactive channel occupancy table includes:
[0046] Determine the basic CPU usage;
[0047] Determine the bit rate and number of channels for interactive channels;
[0048] Periodically sampling the interactive CPU usage of the interactive channel, and determining the average interactive CPU usage based on the sampled interactive CPU usages;
[0049] Determine a net occupancy rate of a current interactive channel according to the average interactive CPU occupancy rate and the basic CPU occupancy rate;
[0050] The code rate and the number of channels of the interactive channel are adjusted step by step to obtain a number of clean occupancy rates and arrange them to determine the interactive channel occupancy rate table.
[0051] As an embodiment of the present invention, the periodic sampling of the interactive CPU occupancy rate of the interactive channel and determining the average interactive CPU occupancy rate based on the sampled interactive CPU occupancy rates further includes:
[0052] In this interactive channel, the interactive CPU occupancy rate is obtained by sampling at a period of at least one second.
[0053] Circular sampling is performed to obtain interactive CPU usage sample groups;
[0054] sorting the interactive CPU occupancy rate sample groups according to occupancy rate values;
[0055] Remove the interactive CPU usage rates in the first interval and the interactive CPU usage rates in the second interval of the sorted results to obtain a standard interactive CPU usage rate sample group;
[0056] An average operation is performed on the standard interactive CPU occupancy rate sample group to obtain the average interactive CPU occupancy rate.
[0057] As an embodiment of this document, the occupancy positive fluctuation value includes an interactive positive fluctuation value;
[0058] The interactive positive fluctuation value is calculated by calculating the average value of the third interval of the standard interactive CPU occupancy rate sample group to obtain the interactive fluctuation rate, and subtracting the interactive CPU occupancy rate from the interactive fluctuation rate to obtain the interactive positive fluctuation value;
[0059] As an embodiment of this document, the estimated threshold value is determined based on an estimated occupancy value and a positive occupancy fluctuation value of the CPU when running the current service, further comprising:
[0060] The estimated occupancy value is added to the positive occupancy fluctuation value to obtain the estimated threshold value.
[0061] As an embodiment of this document, the CPU occupancy rate of the closable service is determined based on the CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service, further comprising:
[0062] The CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service are added together to obtain the CPU occupancy rate of the closable service.
[0063] As an embodiment of this document, after determining that the CPU occupancy is abnormal if the value is greater than the value, the method includes:
[0064] The closable service is released according to the partial CPU occupancy rate.
[0065] As an embodiment of this document, after determining that the CPU occupancy is abnormal if the value is greater than the value, the method includes:
[0066] Shutting down the regular services and the frequency-reduced services in sequence according to the first round of priorities, and determining whether the abnormal CPU occupancy rate has recovered;
[0067] If the CPU occupancy rate anomaly is not restored, the CPU operation scenario is determined according to the second round of priority;
[0068] When the CPU operation scenario is recording, the interactive channel and the streaming channel are closed in sequence until the abnormal CPU occupancy rate is restored;
[0069] When the CPU operation scenario is streaming, the interactive channel and the recording channel are closed in sequence until the abnormal CPU occupancy rate is restored;
[0070] When the CPU operation scenario is interactive, the streaming channel and the recording channel are closed in sequence until the CPU occupancy rate is abnormally restored.
[0071] As an embodiment of this document, after the abnormal CPU occupancy is recovered, the method includes:
[0072] selecting one of the regular service and the frequency-reduced service to idle according to the first-round priority, identifying the idle service as a faulty service when the abnormal CPU occupancy rate is recovered, and reporting the faulty service;
[0073] When all the regular services and the frequency-reduced services are idling and the CPU occupancy anomaly has not recovered, the services other than the CPU operation scenario are selected to idle in sequence according to the second round of priority, and the services that are idling when the CPU occupancy anomaly is recovered are identified as faulty services and reported.
[0074] On the other hand, this article provides a CPU anomaly detection device, comprising:
[0075] The logic unit is used to obtain the actual occupancy of the current CPU. When the actual occupancy is greater than the estimated threshold value, it is determined within a test period whether the difference between the actual occupancy and the estimated threshold value is greater than the partial CPU occupancy of the service that can be closed.
[0076] The determining unit is configured to determine that an abnormal CPU occupancy occurs when the CPU occupancy is greater than the CPU occupancy.
[0077] The estimated threshold value determining unit is used to determine the estimated threshold value according to the estimated occupancy value and the positive occupancy fluctuation value of the CPU when running the current business.
[0078] The closable service determination unit is configured to determine the CPU occupancy of the closable service according to the CPU occupancy of the conventional service, the CPU occupancy of the frequency-reduced service, and the CPU occupancy of the streaming service.
[0079] On the other hand, this document provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any one of the CPU anomaly detection methods described above is implemented.
[0080] On the other hand, this document provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements any one of the CPU abnormality detection methods.
[0081] By adopting the above technical solution, it is achieved that by obtaining the actual occupancy rate of the current CPU, when the actual occupancy rate is greater than the estimated threshold value, a CPU abnormality test is triggered, and when it is determined within the test cycle that the difference between the actual occupancy rate and the estimated threshold value is greater than the occupancy rate of the part of the CPU for which the business can be closed, it is determined that the CPU has an occupancy abnormality; by estimating the threshold value, the risk of the business running in the CPU being suspended at the same time can be reduced, and when an abnormal business occurs, the abnormal business can be caused to trigger a CPU abnormality, so that operation and maintenance personnel or developers can handle the abnormal business early and reduce the CPU computing resources occupied by the abnormal business.
[0082] In order to make the above and other purposes, features and advantages of this article more obvious and easy to understand, the following specifically cites preferred embodiments and provides detailed descriptions in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] In order to more clearly illustrate the technical solutions in the embodiments of this article or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of this article. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0084] Figure 1 The overall system diagram of a CPU anomaly detection method according to an embodiment of this invention is shown;
[0085] Figure 2 A schematic diagram showing the steps of a CPU anomaly detection method according to an embodiment of the present invention is shown;
[0086] Figure 3 A schematic diagram showing the steps for determining the recording channel occupancy table according to an embodiment of this invention is shown;
[0087] Figure 4 A schematic diagram showing the steps of determining the fluidized channel occupancy rate table according to an embodiment of this invention is shown;
[0088] Figure 5 A schematic diagram showing the steps of determining the interactive channel occupancy table according to the embodiment of this document is shown;
[0089] Figure 6 A recording channel occupancy table diagram according to an embodiment of this invention is shown;
[0090] Figure 7 A schematic diagram of a CPU exception handling method according to an embodiment of the present invention is shown;
[0091] Figure 8 A schematic diagram of a fault location method according to an embodiment of the present invention is shown;
[0092] Figure 9A schematic diagram of a CPU anomaly detection device according to an embodiment of the present invention is shown;
[0093] Figure 10 A flowchart of a CPU anomaly detection method according to an embodiment of the present invention is shown;
[0094] Figure 11 A schematic diagram of a computer device according to an embodiment of the present invention is shown.
[0095] Description of the accompanying symbols:
[0096] 11. Display;
[0097] 12. Control terminal;
[0098] 13. Server;
[0099] 901, logical unit;
[0100] 902, determination unit;
[0101] 903, estimated threshold value determining unit;
[0102] 904. The business determination unit may be closed;
[0103] 1102. Computer equipment;
[0104] 1104, processor;
[0105] 1106. Memory;
[0106] 1108, driving mechanism;
[0107] 1110, input / output module;
[0108] 1112. Input device;
[0109] 1114. Output device;
[0110] 1116. Presentation equipment;
[0111] 1118. Graphical User Interface;
[0112] 1120, network interface;
[0113] 1122, communication link;
[0114] 1124. Communication bus. DETAILED DESCRIPTION
[0115] The following will be combined with the accompanying drawings to clearly and completely describe the technical solutions in the embodiments of this document. Obviously, the embodiments described are only part of the embodiments of this document, not all of the embodiments. Based on the embodiments of this document, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this document.
[0116] It should be noted that the terms "first," "second," and the like in the specification and claims herein and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or devices.
[0117] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0118] like Figure 1 The overall system diagram of a CPU abnormality detection method shown includes a display 11, a control terminal 12 and a server 13.
[0119] The server 13 can be equivalent to an FPGA or CPLD to perform functions such as data caching, data processing and data transmission. The FPGA or CPLD is provided with a CPU with computing functions.
[0120] In this article, the CPU's computing power is related to three factors: the number of CPU cores, the core frequency, and the core's single clock cycle capability. In this article, the hi3531dv100 or hi3531dv200 is selected as the FPGA for data caching, data processing, and data transmission. The hi3531dv100 CPU is an ARM Cortex A9 dual-core @ 1.4GHz, and the hi3531dv200 CPU is an ARM Cortex A53 quad-core @ 1.15GHz. Embedded platforms can be replaced as needed in this field. Based on the ideas in this article, those skilled in the art can build CPU anomaly detection systems for other embedded ARM platforms.
[0121] In this article, the CPU can run threads corresponding to several services. For the convenience of explanation, the threads corresponding to the services are collectively referred to as services. For example, the thread corresponding to the streaming service can be called the streaming service, and the thread corresponding to the basic service can be called the basic service. Those skilled in the art should understand that the abbreviations in this article are only for clarity of description and should not limit the rights protected by them.
[0122] In this article, the services run by the CPU can be divided into streaming services, basic services, regular services and frequency reduction services. It should be noted that the streaming services in this article are services with recording, streaming and interactive functions; the basic services in this article are services that maintain CPU operation and embedded system operation. The CPU occupancy rate of this service basically does not change with the changes and changes of other services, and this basic service needs to be kept open during the entire CPU operation; regular services are services that have no obvious or direct effect on streaming services during the operation of streaming services, such as ntp synchronization time services, dhcp query services and upgrade server 13 online services; frequency reduction services are services that cannot be stopped immediately, but can reduce CPU occupancy by reducing the operating frequency, and have no obvious effect on streaming services, such as serial port data acquisition query services and recording status query services.
[0123] When a CPU malfunction occurs, the user can receive an indication of the CPU malfunction via display 11. The CPU and display 11 can be connected via an I2C bus, or other methods, which are not limited herein. The user can also select the corresponding CPU via control terminal 12 to locate the fault. Specific fault location methods are described in detail below.
[0124] In the prior art, the occupancy value ET is usually used to determine whether the CPU is abnormal. However, this method has certain disadvantages, that is, the CPU resources consumed by all services (including normal services and abnormal services) must reach the ET value before the service can be suspended. This relatively simple and non-personalized method for determining CPU occupancy anomalies will affect the operation of normal services, and when abnormal services occur, the CPU will not determine that the abnormal services have affected the CPU occupancy. Therefore, in the prior art, the method of detecting CPU occupancy anomalies has certain disadvantages.
[0125] In order to solve the above problems, the embodiments of this article provide a CPU anomaly detection method, which can solve the problem that the existing technology cannot accurately determine the abnormality of CPU occupancy. Figure 2This is a step diagram of a CPU anomaly detection method provided in the embodiment of this article. This specification provides the method operation steps described in the embodiment or flowchart, but based on conventional or non-creative labor, more or fewer operation steps may be included. The order of steps listed in the embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual system or device product is executed, it can be executed in the order or in parallel according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 2 As shown, the method may include:
[0126] Step 201: Obtain the actual occupancy of the current CPU. When the actual occupancy is greater than the estimated threshold, determine within a test period whether the difference between the actual occupancy and the estimated threshold is greater than the partial CPU occupancy for services that can be shut down.
[0127] Step 202: If it is greater than, it is determined that the CPU occupancy rate is abnormal;
[0128] The estimated threshold value is determined according to an estimated occupancy value and a positive occupancy fluctuation value of the CPU when the CPU runs the current service;
[0129] The CPU occupancy rate of the closable service is determined according to the CPU occupancy rate of the conventional service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service.
[0130] By adopting the above technical solution, it is achieved that by obtaining the actual occupancy rate of the current CPU, when the actual occupancy rate is greater than the estimated threshold value, a CPU abnormality test is triggered, and when it is determined within the test cycle that the difference between the actual occupancy rate and the estimated threshold value is greater than the occupancy rate of the part of the CPU for which the business can be closed, it is determined that the CPU has an occupancy abnormality; by estimating the threshold value, the risk of the business running in the CPU being suspended at the same time can be reduced, and when an abnormal business occurs, the abnormal business can be caused to trigger a CPU abnormality, so that operation and maintenance personnel or developers can handle the abnormal business early and reduce the CPU computing resources occupied by the abnormal business.
[0131] It should be noted that in this article, 20%-60% of the services that can be shut down can be selected as the partial CPU usage.
[0132] As an embodiment of this invention, the method for calculating the occupancy rate estimate includes:
[0133] Determining a CPU occupancy rate of the streaming media service according to at least one of the recording channel occupancy rate table, the streaming channel occupancy rate table, and the interactive channel occupancy rate table;
[0134] Obtaining the CPU occupancy rate of the basic service, the CPU occupancy rate of the conventional service, and the CPU occupancy rate of the frequency-reduced service;
[0135] An estimated occupancy value is determined according to the CPU occupancy of the streaming service, the CPU occupancy of the basic service, the CPU occupancy of the conventional service, and the CPU occupancy of the frequency-reduced service.
[0136] In this step, the CPU occupancy rate of the streaming service includes three parts: the first part is the CPU occupancy rate of the recording service, the second part is the CPU occupancy rate of the streaming service, and the third part is the CPU occupancy rate of the interactive service.
[0137] In this article, streaming media services correspond to application scenarios of video conferencing or recording. Therefore, the demand proportions for recording services, streaming services, and interactive services are different in different application scenarios, and the quality requirements for recording services, streaming services, and interactive services are also different.
[0138] In this article, the quality of recording, streaming, and interactive services can be adjusted by the corresponding number of channels and bit rates. The recording channel occupancy table in this article corresponds to recording services. This table can be used to query the CPU occupancy of recording services with different number of channels and bit rates. The streaming channel occupancy table in this article corresponds to streaming services. This table can be used to query the CPU occupancy of streaming services with different number of channels and bit rates. The interactive channel occupancy table in this article corresponds to interactive services. This table can be used to query the CPU occupancy of interactive services with different number of channels and bit rates.
[0139] The occupancy estimate is calculated by adding the CPU occupancy of the streaming service, the CPU occupancy of the basic service, the CPU occupancy of the regular service, and the CPU occupancy of the frequency-reduced service.
[0140] It should be noted that the recording channel occupancy table, streaming channel occupancy table, and interactive channel occupancy table in this article are preset. Development, testing, or operation and maintenance personnel can determine the data of different embedded platforms based on the following content, and should not use the data as a limiting factor to limit the scope of protection of this article.
[0141] like Figure 3 The following is a schematic diagram of steps for determining a recording channel occupancy table. As an embodiment of this invention, the method for determining the recording channel occupancy table includes:
[0142] Step 301: Determine the basic CPU occupancy rate when the CPU runs the basic service.
[0143] Step 302: Determine the bit rate and number of channels for the recording channel.
[0144] Step 303: Periodically sample the recording CPU occupancy rate of the recording channel, and determine the average recording CPU occupancy rate based on the sampled recording CPU occupancy rates.
[0145] Step 304: Determine the net occupancy of the current recording channel according to the average recording CPU occupancy and the basic CPU occupancy.
[0146] Step 305: Adjust the bit rate and number of channels of the recording channel step by step to obtain the clean occupancy rates and arrange them to determine the recording channel occupancy table.
[0147] In this step, the process of determining the basic CPU occupancy rate needs to be carried out in real time, and it is necessary to record when determining the bit rate and number of channels of the recording channel. For example, when the number of channels is x2 and the bit rate is 2M, record the current basic CPU occupancy rate, and record the current number of channels and bit rate.
[0148] In a cycle, for example, the recording CPU occupancy rate of the recording channel is obtained once every three seconds, and the cycle is repeated 1000 times to obtain 1000 recording CPU occupancy rate samples. For ease of understanding, these 1000 recording CPU occupancy rate samples are used as a recording CPU occupancy rate sample group. The recording CPU occupancy rate sample group is averaged, mean squared error, and equally spaced sampling is performed to obtain relevant data that can characterize the recording channel. After filling in the recording information, the recording channel occupancy rate table is as follows: Figure 6 The figure shows a recording channel occupancy table.
[0149] in, Figure 6 The vertical axis in the figure shows channels 1-16, and the horizontal axis shows bitrates from 1M to 8M. To save space, the corresponding streaming channel occupancy chart and interactive channel occupancy chart are not summarized in this article.
[0150] As an embodiment of this invention, step 301, periodically sampling the recording CPU occupancy of the recording channel, and determining the average recording CPU occupancy based on the sampled recording CPU occupancy, further includes:
[0151] In this recording channel, the CPU usage is recorded by sampling at a period of at least one second.
[0152] Circular sampling is performed to obtain a sample group of recorded CPU usage;
[0153] Sort the recorded CPU occupancy rate sample groups according to the occupancy rate values;
[0154] Remove the recorded CPU usage within the first interval and the recorded CPU usage within the second interval of the sorting results to obtain a standard recorded CPU usage sample group;
[0155] The standard recording CPU occupancy rate sample group is averaged to obtain the average recording CPU occupancy rate.
[0156] In this step, the number of channels and the bit rate of a recording channel are determined, for example, x2 channels and 3M bit rate. After the number of channels and bit rate of the recording channel are selected, the recording CPU occupancy rate of the channel is recorded one thousand times at a frequency of once every three seconds to obtain a recording CPU occupancy rate sample group, which is recorded as (R1…R 1000 ), where R1 is the recorded CPU occupancy rate obtained in the first cycle. All data in the recorded CPU occupancy rate sample group are sorted in ascending order to obtain (R s1 …R s1000 ), where R s1 To obtain the minimum recorded CPU usage after sorting, remove all data in the first interval from the sorted sequence. The first interval in this article can be the interval where data with sorting results of 1-100 are located. Remove all data in the second interval from the sorted sequence. The second interval in this article can be the interval where data with sorting results of 901-1000 are located. In this way, the discreteness of the recorded CPU usage can be reduced, the calculation deviation of the recorded CPU usage can be reduced, and interference data in the recorded CPU usage can be removed, thereby making the recorded channel occupancy table more accurate.
[0157] After removing all data in the first and second intervals, the standard recording CPU occupancy rate sample group (R s101 …R s900 ), perform arithmetic averaging on the standard recording CPU usage sample group, for example Get the average recording CPU usage.
[0158] It should be noted that the recording frequency and the number of recordings are for illustration only, and those skilled in the art can adjust the recording frequency, the number of recordings, the first interval size and the second interval size as needed.
[0159] As an embodiment of this document, the occupancy positive fluctuation value includes a recorded positive fluctuation value;
[0160] The method for calculating the recorded positive fluctuation value is: calculating the average value of the third interval of the standard recorded CPU occupancy rate sample group to obtain the recorded fluctuation rate, and subtracting the average recorded CPU occupancy rate from the recorded fluctuation rate to obtain the recorded positive fluctuation value.
[0161] In this step, the third interval can be the interval where the data of the sorting result 701-900 is located, that is, the array (R s701 …R s900 ), perform arithmetic averaging on the array, for example The recorded fluctuation rate is obtained. This recording fluctuation rate represents the characteristics of the samples with the largest amplitude in the recorded CPU usage. That is, the fluctuation upper limit of the recorded CPU usage is determined. Then, the recorded positive fluctuation value can be obtained by subtracting the average recorded CPU usage from the fluctuation upper limit of the recorded CPU usage.
[0162] like Figure 4 The schematic diagram of the steps for determining the fluidization channel occupancy table is shown. As an embodiment of this invention, the method for determining the fluidization channel occupancy table includes:
[0163] Step 401: Determine the basic CPU occupancy rate when the CPU runs the basic service.
[0164] Step 402: Determine the bit rate and number of channels of the streaming channel.
[0165] Step 403: Periodically sample the streaming CPU occupancy rate of the streaming channel, and determine an average streaming CPU occupancy rate based on a number of sampled streaming CPU occupancies.
[0166] Step 404: Determine the net occupancy of the current streaming channel according to the average streaming CPU occupancy and the basic CPU occupancy.
[0167] Step 405: Adjust the bit rate and number of channels of the streaming channel step by step to obtain clean occupancy rates and arrange them to determine the streaming channel occupancy table.
[0168] In this step, the process of determining the basic CPU occupancy rate needs to be performed in real time. When determining the bit rate and number of channels of the streaming channel, it is necessary to record them. For example, when the number of channels is x2 and the bit rate is 2M, record the current basic CPU occupancy rate, the current number of channels and the bit rate.
[0169] During a cycle, for example, the streaming CPU occupancy rate of the streaming channel is obtained once every three seconds, and the cycle is repeated 1000 times to obtain 1000 streaming CPU occupancy rate samples. For ease of understanding, these 1000 streaming CPU occupancy rate samples are used as a streaming CPU occupancy rate sample group. The streaming CPU occupancy rate sample group is averaged, mean squared deviation is calculated, and sampling is performed at equal intervals to obtain relevant data that can characterize the streaming channel. After filling in the data according to the recorded information, a streaming channel occupancy rate table is obtained.
[0170] As an embodiment of this invention, step 401, periodically sampling the streaming CPU occupancy rate of the streaming channel, and determining the average streaming CPU occupancy rate based on the sampled streaming CPU occupancy rates, further includes:
[0171] Under the streaming channel, the streaming CPU occupancy rate is obtained by sampling at a period of at least one second;
[0172] Circular sampling is performed to obtain a streamed CPU occupancy rate sample group;
[0173] sorting the streamed CPU occupancy rate sample groups according to occupancy rate values;
[0174] Remove the streaming CPU occupancy rates in the first interval and the streaming CPU occupancy rates in the second interval of the sorting results to obtain a standard streaming CPU occupancy rate sample group;
[0175] An average operation is performed on the standard streaming CPU occupancy rate sample group to obtain the average streaming CPU occupancy rate.
[0176] In this step, the number of channels and the bit rate of a streaming channel are determined, for example, x2 channels and 3M bit rate. After the number of channels and bit rate of the streaming channel are selected, the streaming CPU occupancy rate of the channel is recorded one thousand times at a frequency of once every three seconds to obtain a streaming CPU occupancy rate sample group, which is recorded as (R1…R 1000 ), where R1 is the stream CPU occupancy rate obtained in the first cycle, and all the data in the stream CPU occupancy rate sample group are sorted in ascending order to obtain (R f1 …R f1000 ), where R f1 To obtain the minimum streaming CPU occupancy after sorting, all data in the first interval is removed from the sorted sequence. The first interval in this article may be the interval where data with sorting results of 1-100 are located. All data in the second interval is removed from the sorted sequence. The second interval in this article may be the interval where data with sorting results of 901-1000 are located. In this way, the discreteness of the streaming CPU occupancy can be reduced, the calculation deviation of the streaming CPU occupancy can be reduced, and interference data in the streaming CPU occupancy can be removed, thereby making the streaming channel occupancy table more accurate.
[0177] After removing all data in the first and second intervals, the standard stream CPU occupancy rate sample group (R f101 …R f900 ), perform arithmetic averaging on the standard streaming CPU usage sample group, for example Get the average streaming CPU usage.
[0178] It should be noted that the recording frequency and the number of recordings are for illustration only, and those skilled in the art can adjust the recording frequency, the number of recordings, the first interval size and the second interval size as needed.
[0179] As an embodiment of this document, the occupancy positive fluctuation value includes a fluidization positive fluctuation value;
[0180] The method for calculating the fluidization positive fluctuation value is: calculating the average value of the third interval of the standard fluidization CPU occupancy rate sample group to obtain the fluidization fluctuation rate, and subtracting the average fluidization CPU occupancy rate from the fluidization fluctuation rate to obtain the fluidization positive fluctuation value.
[0181] In this step, the third interval can be the interval where the data of the sorting result 701-900 is located, that is, the array (R f701 …R f900 ), perform arithmetic averaging on the array, for example The fluidization volatility is obtained, which characterizes the sample characteristics of the largest amplitude in the fluidization CPU usage. That is, the upper limit of the fluctuation of the fluidization CPU usage is determined. Then, the fluidization positive fluctuation value can be obtained by subtracting the average fluidization CPU usage from the upper limit of the fluctuation of the fluidization CPU usage.
[0182] like Figure 5 The following is a schematic diagram of steps for determining an interactive channel occupancy table. As an embodiment of this invention, the method for determining the interactive channel occupancy table includes:
[0183] Step 501: Determine the basic CPU occupancy rate when the CPU runs the basic service.
[0184] Step 502: Determine the code rate and number of channels of the interactive channel.
[0185] Step 503: Periodically sample the interactive CPU occupancy rate of the interactive channel, and determine the average interactive CPU occupancy rate based on the sampled interactive CPU occupancy rates.
[0186] Step 504: Determine the net occupancy of the current interactive channel according to the average interactive CPU occupancy and the basic CPU occupancy.
[0187] Step 505: Adjust the code rate and number of channels of the interactive channel step by step to obtain clean occupancy rates and arrange them to determine the interactive channel occupancy rate table.
[0188] In this step, the process of determining the basic CPU occupancy rate needs to be carried out in real time. When determining the bit rate and number of channels of the interactive channel, it is necessary to record them. For example, when the number of channels is x2 and the bit rate is 2M, record the current basic CPU occupancy rate, and record the current number of channels and bit rate.
[0189] During a cycle, for example, the interactive CPU occupancy rate of the interactive channel is obtained once every three seconds, and the cycle is repeated 1000 times to obtain 1000 interactive CPU occupancy rate samples. For ease of understanding, these 1000 interactive CPU occupancy rate samples are used as an interactive CPU occupancy rate sample group. The interactive CPU occupancy rate sample group is averaged, mean squared deviation is calculated, and equally spaced sampling is performed to obtain relevant data that can characterize the interactive channel. After filling in the data according to the recorded information, an interactive channel occupancy rate table is obtained.
[0190] As an embodiment of this invention, step 501, periodically sampling the interactive CPU occupancy rate of the interactive channel and determining the average interactive CPU occupancy rate based on the sampled interactive CPU occupancy rates, further includes:
[0191] In this interactive channel, the interactive CPU occupancy rate is obtained by sampling at a period of at least one second.
[0192] Circular sampling is performed to obtain interactive CPU usage sample groups;
[0193] sorting the interactive CPU occupancy rate sample groups according to occupancy rate values;
[0194] Remove the interactive CPU usage rates in the first interval and the interactive CPU usage rates in the second interval of the sorted results to obtain a standard interactive CPU usage rate sample group;
[0195] An average operation is performed on the standard interactive CPU occupancy rate sample group to obtain the average interactive CPU occupancy rate.
[0196] In this step, the number of channels and the bit rate of an interactive channel are determined, for example, x2 channels and 3M bit rate. After the number of channels and bit rate of the interactive channel are selected, the interactive CPU occupancy rate of the channel is recorded once every three seconds for one thousand times to obtain an interactive CPU occupancy rate sample group, which is recorded as (R1…R 1000 ), where R1 is the interactive CPU occupancy rate obtained in the first cycle. All data in the interactive CPU occupancy rate sample group are sorted in ascending order to obtain (R i1 …R i1000 ), where R i1To obtain the minimum interactive CPU occupancy rate after sorting, remove all data in the first interval from the sorted sequence. The first interval in this article may be the interval where the data with sorting results of 1-100 is located. Remove all data in the second interval from the sorted sequence. The second interval in this article may be the interval where the data with sorting results of 901-1000 is located. In this way, the discrete degree of the interactive CPU occupancy rate can be reduced, the calculation deviation of the interactive CPU occupancy rate can be reduced, and the interference data in the interactive CPU occupancy rate can be removed, so that the accuracy of the interactive channel occupancy rate table is higher.
[0197] After removing all data in the first and second intervals, the standard interactive CPU occupancy rate sample group (R i101 …R i900 ), perform arithmetic averaging on the standard interactive CPU usage sample group, for example Get the average interactive CPU usage.
[0198] It should be noted that the recording frequency and the number of recordings are for illustration only, and those skilled in the art can adjust the recording frequency, the number of recordings, the first interval size and the second interval size as needed.
[0199] As an embodiment of this document, the occupancy positive fluctuation value includes an interactive positive fluctuation value;
[0200] The interactive positive fluctuation value is calculated by calculating the average value of the third interval of the standard interactive CPU occupancy rate sample group to obtain the interactive volatility, and subtracting the average interactive CPU occupancy rate from the interactive volatility to obtain the interactive positive fluctuation value.
[0201] In this step, the third interval can be the interval where the data of the sorting result 701-900 is located, that is, the array (R i701 …R i900 ), perform arithmetic averaging on the array, for example The interactive volatility is obtained, which characterizes the sample characteristics of the largest amplitude in the interactive CPU usage. That is, the upper limit of the fluctuation of the interactive CPU usage is determined. Then, the interactive positive fluctuation value can be obtained by subtracting the average interactive CPU usage from the upper limit of the fluctuation of the interactive CPU usage.
[0202] As an embodiment of this document, the estimated threshold value is determined based on an estimated occupancy value and a positive occupancy fluctuation value of the CPU when running the current service, further comprising:
[0203] The estimated occupancy value is added to the positive occupancy fluctuation value to obtain the estimated threshold value.
[0204] In this step, the estimated threshold value is determined according to the formula: estimated threshold value = occupancy estimated value + occupancy positive fluctuation value.
[0205] It should be noted that in this article, the recording positive fluctuation value, streaming positive fluctuation value, and interactive positive fluctuation value are added together to obtain the occupancy positive fluctuation value.
[0206] As an embodiment of this document, the CPU occupancy rate of the closable service is determined based on the CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service, further comprising:
[0207] The CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service are added together to obtain the CPU occupancy rate of the closable service.
[0208] In this step, the CPU occupancy of the service that can be closed is determined according to the formula: CPU occupancy of service that can be closed = CPU occupancy of normal service + CPU occupancy of frequency-reduced service + CPU occupancy of streaming service.
[0209] As an embodiment of this invention, after determining that the CPU occupancy is abnormal if , step 201 includes:
[0210] The closable service is released according to the partial CPU occupancy rate.
[0211] In this step, the CPU usage of some services that can be shut down is used to compensate for the portion of the actual CPU usage that exceeds the estimated threshold, thereby ensuring the normal operation of the services.
[0212] Although an embedded recording and broadcasting product integrates recording, streaming, and interactive functions, users often prioritize one function over the other in specific scenarios. For example, when using this embedded recording product in a recording scenario, the primary focus is recording, while interactive and streaming functions are less likely to be used or can be sacrificed in the event of a problem. Therefore, recording takes the highest priority in this scenario. Furthermore, when using this embedded recording and broadcasting product to convert analog or digital signals from the front-end into encoded network streams and send them to an NVR in the network for centralized recording, recording and interactive functions are not considered, so streaming takes the highest priority. These functions are less likely to be used or can be sacrificed in the event of a problem. Finally, when using this embedded recording and broadcasting product for video conferencing, interactive functions are the priority, so streaming takes the highest priority, while recording and streaming functions are not. Based on the above analysis, this article provides solutions for resolving abnormal CPU usage.
[0213] like Figure 7 The CPU exception handling method shown in the figure is an embodiment of this invention. After determining that the CPU occupancy is abnormal if greater than, the method includes:
[0214] Step 701: shut down the regular service and the frequency-reduced service in sequence according to the first round of priorities, and determine whether the abnormal CPU occupancy rate is restored.
[0215] In this step, the priority order of the first round is regular business and frequency-reduced business from first to last. Each time a business is closed, it is determined whether the CPU occupancy anomaly has recovered. If it has recovered, the next order of business will be stopped from being closed. If the CPU occupancy anomaly has not recovered after all regular business and frequency-reduced business are closed, some of the services in the streaming media will be closed according to the second round of priority order.
[0216] Step 702: If the CPU occupancy abnormality has not been restored, determine the CPU operation scenario according to the second round of priorities.
[0217] In this step, the second round of priorities is recording, streaming, and interaction. That is, the current CPU operation scenario is determined. When the operation scenario is completed, the channels with lower levels are shut down first according to the priority.
[0218] It should be noted that in each streaming service, including recording service, streaming service and interactive service, according to Figure 6 It can be seen that each business may have many channels working together. Therefore, in this article, when it is determined that the streaming business needs to be closed, the channels of the corresponding business need to be closed one by one. For example, when the recording task needs to be closed, there are 10 channels in the current recording task, so the recording channels can be closed one by one. When closing each channel, determine whether the current CPU usage anomaly has recovered. If it has recovered, there is no need to continue closing the corresponding channel. This can protect the business to the greatest extent and avoid instantaneous loss of business.
[0219] Step 703: When the CPU operation scenario is recording, the interactive channel and the streaming channel are closed in sequence until the CPU occupancy rate is abnormally restored.
[0220] Step 704: When the CPU operation scenario is streaming, the interactive channel and the recording channel are closed in sequence until the CPU occupancy rate is abnormally restored.
[0221] Step 705: When the CPU operation scenario is interactive, the streaming channel and the recording channel are closed in sequence until the CPU occupancy rate is abnormally restored.
[0222] After the CPU usage exception is restored, in order to avoid the exception from happening again, the operation and maintenance personnel need to accurately locate the abnormal business, so this article provides the following Figure 8 The following figure shows the fault location method diagram.
[0223] As an embodiment of this document, after the abnormal CPU occupancy is recovered, the method includes:
[0224] Step 801: Select one of the regular service and the frequency-reduced service to idle according to the first-round priority, identify the idle service when the CPU occupancy rate recovers abnormally as a faulty service, and report it.
[0225] In this step, all CPU services need to be run when the exception occurs, including regular services, frequency-reduced services, and streaming services. At this time, the scene of the CPU occupancy exception is restored. According to the first round of priority, the regular services are idle to determine whether the current CPU occupancy exception is restored. If it is restored, the regular services of the services that caused the CPU occupancy exception are determined. If not, the idling of the regular services is stopped and the frequency-reduced services are idle to determine whether the current CPU occupancy exception is restored. If it is restored, the frequency-reduced services of the services that caused the CPU occupancy exception are determined. If not, it is determined that the CPU occupancy exception is caused by the streaming service.
[0226] Step 802: When all the regular services and the frequency-reduced services are idling and the CPU occupancy anomaly has not recovered, select services other than the CPU operation scenario according to the second round of priority and idle them in sequence. The services that are idling when the CPU occupancy anomaly is recovered are identified as faulty services and reported.
[0227] In this step, according to the second round of priority, the services in the streaming media are idled in sequence, for example, the recording service is idled to determine whether the current CPU occupancy anomaly has recovered. If it has recovered, the recording service that caused the CPU occupancy anomaly is determined. If it has not recovered, the idling of the recording service is stopped, and the streaming service is idled to determine whether the current CPU occupancy anomaly has recovered. If it has recovered, the streaming service that caused the CPU occupancy anomaly is determined. If it has not recovered, the idling of the streaming service is stopped, and the interactive service is idle to determine whether the current CPU occupancy anomaly has recovered. If it has recovered, it is determined that the CPU occupancy anomaly is caused by the interactive service. If it has not recovered, it is determined that the CPU occupancy anomaly is caused by the basic service.
[0228] It should be noted that during the idling process, the channels corresponding to the services can be idled one by one. In this way, the specific channel level can be accurately located.
[0229] like Figure 9A schematic diagram of a CPU anomaly detection device is shown, comprising:
[0230] The logic unit 901 is used to obtain the actual occupancy of the current CPU. When the actual occupancy is greater than the estimated threshold, it is determined within a test period whether the difference between the actual occupancy and the estimated threshold is greater than the partial CPU occupancy of the service that can be closed.
[0231] The determining unit 902 is configured to determine that the CPU occupancy is abnormal when the CPU occupancy is greater than the CPU occupancy.
[0232] The estimated threshold value determining unit 903 is configured to determine the estimated threshold value according to the estimated occupancy value and the positive occupancy fluctuation value of the CPU when the CPU runs the current service.
[0233] The closable service determining unit 904 is configured to determine the CPU occupancy of the closable service according to the CPU occupancy of the normal service, the CPU occupancy of the frequency-reduced service, and the CPU occupancy of the streaming service.
[0234] By adopting the above technical solution, it is achieved that by obtaining the actual occupancy rate of the current CPU, when the actual occupancy rate is greater than the estimated threshold value, a CPU abnormality test is triggered, and when it is determined within the test cycle that the difference between the actual occupancy rate and the estimated threshold value is greater than the occupancy rate of the part of the CPU for which the business can be closed, it is determined that the CPU has an occupancy abnormality; by estimating the threshold value, the risk of the business running in the CPU being suspended at the same time can be reduced, and when an abnormal business occurs, the abnormal business can be caused to trigger a CPU abnormality, so that operation and maintenance personnel or developers can handle the abnormal business early and reduce the CPU computing resources occupied by the abnormal business.
[0235] like Figure 10 The flowchart of a CPU abnormality detection method is shown, including:
[0236] Step 1001: Determine the actual current CPU usage.
[0237] Step 1002: Query the recording channel occupancy table, the streaming channel occupancy table, and the interactive channel occupancy table to calculate the actual occupancy of the current CPU.
[0238] Step 1003: Determine whether the actual occupancy rate is greater than the estimated threshold value. If so, execute step 1003.
[0239] Step 1004: Calculate the difference between the actual occupancy rate and the estimated threshold value.
[0240] Step 1005: Calculate the CPU usage of the portion of the service that can be shut down.
[0241] Step 1006: Determine whether the difference is greater than the CPU usage of the portion of the service that can be closed. If so, execute step 1007; if not, execute step 1008.
[0242] Step 1007: Determine whether the CPU usage is abnormal.
[0243] Step 1008: Determine if the CPU usage is abnormal, and release some services that can be closed.
[0244] It should be noted that the CPU anomaly detection method and device in this article can be used in the field of recording and broadcasting, and can also be used in any field other than the field of recording and broadcasting. The application field of the CPU anomaly detection method and device in this article is not limited.
[0245] like Figure 11 As shown, a computer device provided in an embodiment of the present invention is shown. The computer device 1102 may include one or more processors 1104, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. The computer device 1102 may also include any memory 1106 for storing any type of information, such as code, settings, data, etc. For example, without limitation, the memory 1106 may include any one or more combinations of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any memory may use any technology to store information. Furthermore, any memory may provide volatile or non-volatile retention of information. Furthermore, any memory may represent a fixed or removable component of the computer device 1102. In one embodiment, when the processor 1104 executes associated instructions stored in any memory or combination of memories, the computer device 1102 may perform any operation of the associated instructions. The computer device 1102 also includes one or more drive mechanisms 1108, such as a hard disk drive mechanism, an optical disk drive mechanism, etc., for interacting with any memory.
[0246] The computer device 1102 may also include an input / output module 1110 (I / O) for receiving various inputs (via input devices 1112) and providing various outputs (via output devices 1114). A specific output mechanism may include a presentation device 1116 and an associated graphical user interface (GUI) 1118. In other embodiments, the input / output module 1110 (I / O), input devices 1112, and output devices 1114 may not be included, and the computer device 1102 may simply be a computer device in a network. The computer device 1102 may also include one or more network interfaces 1120 for exchanging data with other devices via one or more communication links 1122. One or more communication buses 1124 couple the components described above together.
[0247] The communication link 1122 may be implemented in any manner, for example, via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 1122 may include any combination of hardwired links, wireless links, routers, gateway functions, etc., governed by any protocol or combination of protocols.
[0248] Corresponding to Figure 2-Figure 8 The embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which executes the steps of the above method when executed by a processor.
[0249] The embodiment of the present invention also provides a computer readable instruction, wherein when the processor executes the instruction, the program causes the processor to execute the following Figure 2-Figure 8 The method shown.
[0250] It should be understood that in the various embodiments of this document, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.
[0251] It should also be understood that in the embodiments herein, the term "and / or" merely describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" could represent: A alone, A and B simultaneously, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the associated objects.
[0252] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.
[0253] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0254] In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices, or units, or can be an electrical, mechanical, or other form of connection.
[0255] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments herein.
[0256] In addition, the functional units in the various embodiments herein may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0257] If the integrated unit 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 this article 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, including a number of instructions for enabling a computer device (which can be a personal computer, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of this article. The aforementioned storage medium includes: various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0258] This article uses specific embodiments to illustrate the principles and implementation methods of this article. The description of the above embodiments is only used to help understand the methods and core ideas of this article. At the same time, for those skilled in the art, based on the ideas of this article, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation to this article.
Claims
1. A CPU anomaly detection method, characterized in that: include: Obtaining the actual current CPU occupancy rate, and when the actual occupancy rate is greater than the estimated threshold value, determining within a test period whether the difference between the actual occupancy rate and the estimated threshold value is greater than the CPU occupancy rate of the portion of the service that can be shut down; If it is greater than, it is determined that the CPU occupancy rate is abnormal; The estimated threshold value is determined according to an estimated occupancy value and a positive occupancy fluctuation value of the CPU when the CPU runs the current service; The CPU occupancy rate of the service that can be closed is determined based on the CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service; The occupancy rate estimate is calculated by: Determining a CPU occupancy rate of the streaming media service according to at least one of the recording channel occupancy rate table, the streaming channel occupancy rate table, and the interactive channel occupancy rate table; Obtaining the CPU occupancy rate of the basic service, the CPU occupancy rate of the conventional service, and the CPU occupancy rate of the frequency-reduced service; Determine an estimated occupancy value based on the CPU occupancy of the streaming service, the CPU occupancy of the basic service, the CPU occupancy of the regular service, and the CPU occupancy of the frequency-reduced service; The method for determining the recording channel occupancy table includes: Determine the basic CPU usage when the CPU is running the basic business; Determine the bit rate and number of channels for recording; Periodically sampling the recording CPU occupancy rate of the recording channel, and determining an average recording CPU occupancy rate based on the sampled recording CPU occupancy rates; Determine a net occupancy rate of a current recording channel according to the average recording CPU occupancy rate and the basic CPU occupancy rate; The bit rate and the number of channels of the recording channel are adjusted step by step to obtain the clean occupancy rates and arrange them to determine the recording channel occupancy rate table.
2. The CPU anomaly detection method according to claim 1, wherein: The periodically sampling the recording CPU occupancy of the recording channel, and determining the average recording CPU occupancy based on the sampled recording CPU occupancy rates, further includes: In this recording channel, the CPU usage is recorded by sampling at a period of at least one second. Circular sampling is performed to obtain a sample group of recorded CPU usage; Sort the recorded CPU occupancy rate sample groups according to the occupancy rate values; Remove the recorded CPU usage within the first interval and the recorded CPU usage within the second interval of the sorting results to obtain a standard recorded CPU usage sample group; The standard recording CPU occupancy rate sample group is averaged to obtain the average recording CPU occupancy rate.
3. The CPU anomaly detection method according to claim 2, wherein: The positive occupancy fluctuation value includes a recorded positive fluctuation value; The method for calculating the recorded positive fluctuation value is: calculating the average value of the third interval of the standard recorded CPU occupancy rate sample group to obtain the recorded fluctuation rate, and subtracting the average recorded CPU occupancy rate from the recorded fluctuation rate to obtain the recorded positive fluctuation value.
4. The CPU anomaly detection method according to claim 1, wherein: The method for determining the fluidization channel occupancy rate table includes: Determine the basic CPU usage; Determine the bitrate and number of channels for the streaming channel; Periodically sampling the streaming CPU occupancy rate of the streaming channel, and determining an average streaming CPU occupancy rate based on a plurality of the sampled streaming CPU occupancy rates; Determining a net occupancy rate of a current streaming channel according to the average streaming CPU occupancy rate and the basic CPU occupancy rate; The bit rate and the number of channels of the streaming channels are adjusted step by step to obtain the clean occupancy rates and arrange them to determine the streaming channel occupancy table.
5. The CPU anomaly detection method according to claim 4, wherein: The periodically sampling the streaming CPU occupancy rate of the streaming channel, and determining the average streaming CPU occupancy rate based on the sampled streaming CPU occupancy rates, further includes: Under the streaming channel, the streaming CPU occupancy rate is obtained by sampling at a period of at least one second; Circular sampling is performed to obtain a streamed CPU occupancy rate sample group; sorting the streamed CPU occupancy rate sample groups according to occupancy rate values; Remove the streaming CPU occupancy rates in the first interval and the streaming CPU occupancy rates in the second interval of the sorting results to obtain a standard streaming CPU occupancy rate sample group; An average operation is performed on the standard streaming CPU occupancy rate sample group to obtain the average streaming CPU occupancy rate.
6. The CPU anomaly detection method according to claim 5, wherein: The positive occupancy fluctuation value includes a positive fluidization fluctuation value; The method for calculating the fluidization positive fluctuation value is: calculating the average value of the third interval of the standard fluidization CPU occupancy rate sample group to obtain the fluidization fluctuation rate, and subtracting the average fluidization CPU occupancy rate from the fluidization fluctuation rate to obtain the fluidization positive fluctuation value.
7. The CPU anomaly detection method according to claim 1, wherein: The method for determining the interactive channel occupancy rate table includes: Determine the basic CPU usage; Determine the bit rate and number of channels for interactive channels; Periodically sampling the interactive CPU usage of the interactive channel, and determining the average interactive CPU usage based on the sampled interactive CPU usages; Determine a net occupancy rate of a current interactive channel according to the average interactive CPU occupancy rate and the basic CPU occupancy rate; The code rate and the number of channels of the interactive channel are adjusted step by step to obtain a number of clean occupancy rates and arrange them to determine the interactive channel occupancy rate table.
8. The CPU anomaly detection method according to claim 7, wherein: The periodic sampling of the interactive CPU occupancy rate under the interactive channel and determining the average interactive CPU occupancy rate based on the sampled interactive CPU occupancy rates further includes: In this interactive channel, the interactive CPU occupancy rate is obtained by sampling at a period of at least one second. Circular sampling is performed to obtain interactive CPU usage sample groups; sorting the interactive CPU occupancy rate sample groups according to occupancy rate values; Remove the interactive CPU usage rates in the first interval and the interactive CPU usage rates in the second interval of the sorted results to obtain a standard interactive CPU usage rate sample group; An average operation is performed on the standard interactive CPU occupancy rate sample group to obtain the average interactive CPU occupancy rate.
9. The CPU anomaly detection method according to claim 8, wherein: The positive occupancy fluctuation value includes an interactive positive fluctuation value; The method for calculating the interactive positive fluctuation value is to calculate the average value of the third interval of the standard interactive CPU occupancy rate sample group to obtain the interactive volatility, and subtract the average interactive CPU occupancy rate from the interactive volatility to obtain the interactive positive fluctuation value.
10. The CPU anomaly detection method according to claim 1, wherein: The estimated threshold value is determined according to an estimated occupancy value and a positive occupancy fluctuation value of the CPU when the CPU runs the current service, further comprising: The estimated occupancy value is added to the positive occupancy fluctuation value to obtain the estimated threshold value.
11. The CPU anomaly detection method according to claim 1, wherein: The CPU occupancy rate of the closable service is determined based on the CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service, further comprising: The CPU occupancy rate of the regular service, the CPU occupancy rate of the frequency-reduced service, and the CPU occupancy rate of the streaming service are added together to obtain the CPU occupancy rate of the closable service.
12. The CPU anomaly detection method according to claim 1, wherein: After determining that the CPU occupancy rate is abnormal if the value is greater than the value, the method further includes: The closable service is released according to the partial CPU occupancy rate.
13. The CPU anomaly detection method according to claim 1, wherein: After determining that the CPU occupancy rate is abnormal if the value is greater than the value, the method further includes: Shutting down the regular services and the frequency-reduced services in sequence according to the first round of priorities, and determining whether the abnormal CPU occupancy rate has recovered; If the CPU occupancy rate anomaly is not restored, the CPU operation scenario is determined according to the second round of priority; When the CPU operation scenario is recording, the interactive channel and the streaming channel are closed in sequence until the abnormal CPU occupancy rate is restored; When the CPU operation scenario is streaming, the interactive channel and the recording channel are closed in sequence until the abnormal CPU occupancy rate is restored; When the CPU operation scenario is interactive, the streaming channel and the recording channel are closed in sequence until the CPU occupancy rate is abnormally restored.
14. The CPU anomaly detection method according to claim 13, wherein: After the abnormal CPU occupancy rate is recovered, the method includes: selecting one of the regular service and the frequency-reduced service to idle according to the first-round priority, identifying the idle service as a faulty service when the abnormal CPU occupancy rate is recovered, and reporting the faulty service; When all the regular services and the frequency-reduced services are idling and the CPU occupancy anomaly has not recovered, the services other than the CPU operation scenario are selected to idle in sequence according to the second round of priority, and the services that are idling when the CPU occupancy anomaly is recovered are identified as faulty services and reported.
15. A CPU abnormality detection device, characterized in that: include: a logic unit configured to obtain an actual CPU occupancy rate of the current CPU, and when the actual occupancy rate is greater than an estimated threshold value, determine within a test period whether a difference between the actual occupancy rate and the estimated threshold value is greater than a portion of the CPU occupancy rate for services that can be shut down; A determining unit, configured to determine that the CPU occupancy rate is abnormal when the value is greater than the value; An estimated threshold value determining unit, configured to determine the estimated threshold value according to an estimated occupancy value and a positive occupancy fluctuation value of the CPU when running a current service; A closable service determination unit, configured to determine the CPU occupancy of the closable service based on the CPU occupancy of the conventional service, the CPU occupancy of the frequency-reduced service, and the CPU occupancy of the streaming service; The occupancy rate estimate is calculated by: Determining a CPU occupancy rate of the streaming media service according to at least one of the recording channel occupancy rate table, the streaming channel occupancy rate table, and the interactive channel occupancy rate table; Obtaining the CPU occupancy rate of the basic service, the CPU occupancy rate of the conventional service, and the CPU occupancy rate of the frequency-reduced service; Determine an estimated occupancy value based on the CPU occupancy of the streaming service, the CPU occupancy of the basic service, the CPU occupancy of the regular service, and the CPU occupancy of the frequency-reduced service; The method for determining the recording channel occupancy table includes: Determine the basic CPU usage when the CPU is running the basic business; Determine the bit rate and number of channels for recording; Periodically sampling the recording CPU occupancy rate of the recording channel, and determining an average recording CPU occupancy rate based on the sampled recording CPU occupancy rates; Determine a net occupancy rate of a current recording channel according to the average recording CPU occupancy rate and the basic CPU occupancy rate; The bit rate and the number of channels of the recording channel are adjusted step by step to obtain the clean occupancy rates and arrange them to determine the recording channel occupancy rate table.
16. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the CPU abnormality detection method according to any one of claims 1 to 14 is implemented.
17. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the CPU abnormality detection method according to any one of claims 1 to 14 is implemented.
Citation Information
Patent Citations
CPU utilization rate monitoring method and device, electronic equipment and storage medium
CN109800124A
Video self-adaption method, related equipment and storage medium
CN111147893A
Information processor and method, and program
JP2006085386A