Resource monitoring method and device, electronic equipment and computer storage medium

By timely collecting and calculating the CPU and memory usage rate of the autonomous driving integrated system, and issuing early warnings in a timely manner, solving the problem that the system cannot monitor abnormal changes in CPU and memory in real time, and improving system stability.

CN119088633APending Publication Date: 2024-12-06CHONGQING CHANGAN AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310660300.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-06
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The autonomous driving integrated system cannot monitor abnormal changes in CPU and memory in real time during operation, making it difficult to ensure system stability.

Method used

Provide a resource monitoring method, which collects system resource information regularly, calculates CPU and memory occupancy, and issues warning information when the occupancy rate exceeds the preset indicators, so that developers can timely discover and optimize problems.

Benefits of technology

Real-time monitoring of the resources of the integrated autonomous driving system and functional modules is realized, and power consumption and memory leaks are timely discovered and optimized, thereby improving system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088633A_ABST
    Figure CN119088633A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource monitoring method and device, electronic equipment and a computer storage medium, and belongs to the technical field of automatic driving, and the method comprises the steps: collecting system resource information during the operation of an automatic driving integrated system in each monitoring period; calculating the resource occupancy rate of the system according to the system resource information, and / or calculating the resource occupancy rate of each functional module integrated in the automatic driving integrated system; and when the resource occupancy rate of the system or at least one of the function modules exceeds the corresponding preset index, sending corresponding early warning information. Thus, changes of the system CPU and the memory during operation of the automatic driving integrated system can be monitored regularly, and CPU and memory monitoring of each functional module can be detailed, so that developers can find, check and optimize the problems of module power consumption, memory leakage and the like in time, and the stability of the automatic driving integrated system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of autonomous driving technology, the autonomous driving integrated system includes more and more functional modules, such as positioning, mapping, decision-making, perception, planning, fusion, etc. When the autonomous driving function is started, in addition to the normal operation of each functional module, there is also communication and transmission of interactive data between the functional modules. Therefore, it is necessary to integrate the above multiple functional modules into a unified autonomous driving integrated system to ensure that each functional module can operate normally and the data between the functional modules can communicate and transmit normally. When multiple optical modules in the autonomous driving integrated system are running at the same time, in order to ensure the stability of system performance, the system's CPU load and memory resource usage need to be considered. At present, the way to view the changes in the system CPU and memory of the autonomous driving integrated system is mainly to manually enter commands such as top or free commands. This method cannot monitor the changes in the CPU and memory in real time, resulting in the framework being unable to detect abnormal changes in the system CPU and memory in time during operation. Summary of the invention

[0003] In view of this, the present invention aims to propose a resource monitoring method, device, electronic device and computer storage medium, which can regularly monitor the changes in the system CPU and memory of the autonomous driving integrated system during operation, and refine the CPU and memory monitoring of each functional module, so that developers can promptly discover, troubleshoot and optimize module power consumption, memory leakage and other problems, and improve the stability of the autonomous driving integrated system.

[0004] In a first aspect of the present invention, a resource monitoring method is provided, which is applied to an autonomous driving integrated system. The method comprises:

[0005] In each monitoring cycle, collecting system resource information when the autonomous driving integrated system is running;

[0006] Calculating the resource occupancy rate of the system according to the system resource information, and / or calculating the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system;

[0007] When the resource occupancy rate of at least one functional module in the system or each functional module exceeds a preset index corresponding thereto, a corresponding warning message is issued.

[0008] In one implementation, the system resources include a system CPU and a system memory, and collecting system resource information when the autonomous driving integrated system is running in each monitoring cycle includes:

[0009] At the start time and the end time of each monitoring cycle, read the file information of the / proc / stat file and the / proc / meminfo file in the system respectively, wherein the file information of the / proc / stat file includes the user state and the system state of the system CPU, and the file information of the / proc / meminfo file includes the total physical memory of the system and the free physical memory of the system;

[0010] According to the file information of the / proc / stat file, the first user state and the first system state of the system CPU at the beginning time of each monitoring cycle and the second user state and the second system state at the end time are collected;

[0011] According to the file information of the / proc / meminfo file, the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time are collected.

[0012] In one implementation, calculating the resource occupancy rate of the system according to the system resource information includes:

[0013] The system CPU occupancy rate of each monitoring period is calculated according to the first user state, the first system state, the second user state, the second system state, and the monitoring period.

[0014] In one implementation, calculating the resource occupancy rate of the system according to the system resource information includes:

[0015] The system memory occupancy rate of each monitoring period is calculated according to the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time.

[0016] In one implementation, collecting system resource information during operation of the autonomous driving integrated system in each monitoring cycle includes:

[0017] At the start time and the end time of each monitoring cycle, read the file information of the / proc / {pid} / stat file and the / proc / {pid} / stat file in the system respectively, wherein the file information of the / proc / {pid} / stat file includes the user state and the system state of the process, and the file information of the / proc / {pid} / stat file includes the process physical memory usage size of the process;

[0018] According to the file information of the / proc / {pid} / stat file, the third user state and the third system state of each process at the beginning time of each monitoring cycle and the fourth user state and the fourth system state at the end time are collected;

[0019] According to the file information of each process in the / proc / {pid} / status file, the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time are collected.

[0020] In one implementation, the calculating, according to the system resource information, the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system includes:

[0021] The CPU occupancy rate of each functional module in each monitoring cycle is calculated according to the third user state and the third system state at the start time of each monitoring cycle and the fourth user state and the fourth system state at the end time of each process.

[0022] In one implementation, the calculating, according to the system resource information, the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system includes:

[0023] The memory occupancy rate of each functional module in each monitoring cycle is calculated according to the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time of each process.

[0024] In one embodiment, when the resource occupancy rate of at least one functional module in the system or each functional module exceeds the corresponding preset index, before issuing the corresponding warning information, the method further includes:

[0025] Formulate a first preset CPU occupancy rate and a first preset memory occupancy rate of the system;

[0026] A second preset CPU occupancy rate and a second preset memory occupancy rate are formulated for each functional module.

[0027] In one implementation, before collecting the system resource information of the autonomous driving integrated system during operation in each monitoring cycle, the method includes:

[0028] A resource monitoring module and a control switch thereof are set in the configuration file of the system, wherein the control switch is used to set whether the resource monitoring module is effective, and the control switch is a global variable.

[0029] In a second aspect of the present invention, there is also provided a resource monitoring device, which is applied to an automatic driving integrated system, and the device includes:

[0030] A first collection module is used to collect system resource information when the autonomous driving integrated system is running in each monitoring cycle;

[0031] a first calculation module, configured to calculate a resource occupancy rate of the system according to the system resource information, and / or calculate a resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system;

[0032] The first warning module is used to issue a corresponding warning message when the resource occupancy rate of at least one functional module in the system or each functional module exceeds the corresponding preset index.

[0033] In a third aspect of the implementation of the present invention, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the resource monitoring method as described in the first aspect.

[0034] In a fourth aspect of the implementation of the present invention, a computer storage medium is further provided. When instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the resource monitoring method as described in the first aspect.

[0035] The embodiment of the present invention provides a resource monitoring method, device, power station equipment and computer storage medium, which collects system resource information of the automatic driving integrated system during operation in each monitoring cycle; calculates the resource occupancy rate of the system based on the system resource information, and / or calculates the resource occupancy rate of each functional module integrated in the automatic driving integrated system; when the resource occupancy rate of at least one functional module in the system or each functional module exceeds the preset index corresponding to it, issues a corresponding warning information. In this way, the system CPU and memory changes of the automatic driving integrated system during operation can be monitored regularly, and the CPU and memory monitoring of each functional module can be refined, so that developers can timely discover, troubleshoot and optimize module power consumption, memory leakage and other problems, and improve the stability of the automatic driving integrated system. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0037] Figure 1 A flowchart of a resource monitoring method provided by an embodiment of the present invention;

[0038] Figure 2 A flowchart of another resource monitoring method provided by an embodiment of the present invention;

[0039] Figure 3 A schematic diagram of a resource monitoring device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0040] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0041] 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] Figure 1 A flowchart of a resource monitoring method provided by an embodiment of the present invention is as follows Figure 1 As shown, this embodiment provides a resource monitoring method, the method comprising:

[0043] In step S101, in each monitoring cycle, system resource information of the autonomous driving integrated system during operation is collected;

[0044] In step S102, the resource occupancy rate of the system is calculated according to the system resource information, and / or the resource occupancy rate of each functional module integrated in the autonomous driving integrated system is calculated;

[0045] In step S103, when the resource occupancy rate of at least one functional module in the system or each functional module exceeds the corresponding preset index, a corresponding warning information is issued.

[0046] First, in step S101, in each monitoring cycle, the system resource information of the automatic driving integrated system is collected during operation. Since the current automatic driving integrated system mainly checks system resources through manual command input by developers, it is not possible to monitor changes in system resources in real time, resulting in the inability to timely troubleshoot abnormal resource abnormalities. Therefore, in this embodiment, when the automatic driving integrated system is running, when the developer monitors the resources of the automatic driving integrated system, a monitoring cycle for resources in the automatic driving integrated system can be pre-set, such as 1 millisecond, and a resource monitoring task is completed every 1 millisecond, so that the developer does not need to manually input commands to view, wherein the monitoring cycle can be set according to actual conditions, and the system resource information of the automatic driving integrated system during operation can be automatically collected in each monitoring cycle.

[0047] In one embodiment, before collecting system resource information during the operation of the autonomous driving integrated system, a structure for storing system resource information can be pre-defined. During each resource monitoring process, changes in resource information are stored in the pre-defined structure, and the resource data information of the previous monitoring cycle is overwritten, thereby facilitating developers to analyze changes in resource information.

[0048] Secondly, in step S102, the resource occupancy rate of the system is calculated according to the system resource information, and / or the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system is calculated. The resource occupancy rate of the resource information within the monitoring period obtained in step S101 is calculated, wherein, since the functions of the functional modules in the autonomous driving integrated system are different, there are large differences in function implementation and data processing strategies, and the resource requirements of each functional module are also different. Therefore, in addition to calculating the resource occupancy rate of the autonomous driving integrated system, it is also necessary to calculate the resource occupancy rate corresponding to each functional module in the autonomous driving integrated system.

[0049] Finally, in step S103, when the resource occupancy rate of at least one functional module in the system or each functional module exceeds the preset index corresponding thereto, a warning message corresponding thereto is issued. Since it is necessary to perform resource monitoring on the autonomous driving integrated system and each functional module therein, it is also necessary to formulate preset indicators for the resource occupancy rate of the autonomous driving integrated system and each functional module therein. It can be understood that the resource occupancy rate of the autonomous driving integrated system and each functional module has a preset index corresponding thereto, and when the resource occupancy rate of the autonomous driving integrated system or each functional module exceeds the preset index corresponding thereto, a warning message is issued, wherein the warning message may be that the resource occupancy rate of a certain resource in the autonomous driving integrated system exceeds the preset index, or the resource occupancy rate of a certain resource in one or more functional modules exceeds the preset index, and the warning message is fed back to the developer, so that the developer can timely discover, troubleshoot and optimize module power consumption, memory leakage and other problems, and improve the stability of the autonomous driving integrated system.

[0050] Optionally, the system resources include a system CPU and a system memory, and the collecting of system resource information during the operation of the autonomous driving integrated system in each monitoring cycle includes:

[0051] At the start time and the end time of each monitoring cycle, read the file information of the / proc / stat file and the / proc / meminfo file in the system respectively, wherein the file information of the / proc / stat file includes the user state and the system state of the system CPU, and the file information of the / proc / meminfo file includes the total physical memory of the system and the free physical memory of the system;

[0052] According to the file information of the / proc / stat file, the first user state and the first system state of the system CPU at the beginning time of each monitoring cycle and the second user state and the second system state at the end time are collected;

[0053] According to the file information of the / proc / meminfo file, the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time are collected.

[0054] First, at the start time and the end time of each monitoring cycle, the file information of the / proc / {pid} / stat file and the / proc / {pid} / stat file in the system are read respectively, wherein the file information of the / proc / {pid} / stat file includes the user state and the system state of the process, and the file information of the / proc / {pid} / stat file includes the process physical memory usage size of the process.

[0055] The resources in this embodiment include system CPU resources and system memory resources. When monitoring the instantaneous CPU occupancy of the system, the CPU occupancy is divided into three states: user state, system state and idle state, which respectively represent the time when the CPU is in user state execution, the time when the system kernel is executed and the time when the system idle process is executed. Each monitoring cycle task includes two collections, the first collection is at the beginning of the monitoring cycle, and the second collection is at the end of the monitoring cycle. In the LINUX system, the original data of the system CPU is mainly obtained through the system / proc / stat file. The / proc file is a pseudo file system that only exists in the memory. Both users and applications can obtain detailed information of the system through the / proc directory.

[0056] When collecting system CPU resources and system memory resources, you need to read the file information of the / proc / stat file and / proc / meminfo file in the system, where:

[0057] (1) The / proc / stat file is used to collect system CPU resource information, mainly including the following information:

[0058] ①CPU: CPU name;

[0059] ②nuser: the time the system is in user mode;

[0060] ③nnice: the time the system is in user mode (low priority, nice>0);

[0061] ④nsystem: the time the system is in kernel state;

[0062] ⑤nidle: the time the system is in idle state;

[0063] ⑥niowait: I / O waiting time;

[0064] ⑦nirq: hard interrupt;

[0065] ⑧nsoftirq: soft interrupt;

[0066] (2) The / proc / meminfo file is used to collect system memory resource information, mainly including the following information:

[0067] ①MemTotal: total physical memory of the system;

[0068] ②MemFree: system free physical memory;

[0069] ③MemAvailable: system available memory;

[0070] ④Buffers: The amount of physical memory used for kernel buffering;

[0071] ⑤Cached: cache memory.

[0072] Secondly, according to the file information of the / proc / stat file, the first user state and the first system state of the system CPU at the beginning time of each monitoring cycle and the second user state and the second system state at the end time are collected.

[0073] When collecting system CPU resource information, the first user state and the first system state of the system CPU at the start time and the second user state and the second system state at the end time are collected from the / proc / stat file at the start time and the end time of each monitoring cycle, respectively, wherein the first user state and the first system state are system CPU resource information accumulated from the startup of the autonomous driving integrated system to the start time of the current monitoring cycle, and the second user state and the second system state are system CPU resource information accumulated from the startup of the autonomous driving integrated system to the end time of the current monitoring cycle.

[0074] Finally, according to the file information of the / proc / meminfo file, the total system physical memory, the first system idle physical memory at the start time, and the second system idle physical memory at the end time of the system memory are collected. When collecting system memory resource information, the first system idle physical memory at the start time and the second system idle physical memory at the end time of the system memory, as well as the total system physical memory, are collected from the / proc / meminfo file at the start time and the end time of each monitoring cycle.

[0075] Optionally, calculating the resource occupancy of the system according to the system resource information includes:

[0076] According to the first user state, the first system state, the second user state, the second system state, and the monitoring cycle, the system CPU occupancy rate of each monitoring cycle is calculated. Wherein, the CPU occupancy rate refers to: the ratio of the time when the CPU executes non-system idle processes to the total CPU execution time. Therefore, it is necessary to obtain the CPU execution time of the system in the above three states within a period of time, and then calculate the CPU occupancy rate of the system. The absolute value of the difference between the second user state and the first user state is the system CPU user state of the system in the current monitoring cycle, and the absolute value of the difference between the second system state and the first system state is the system CPU system state of the system in the current monitoring cycle, and the system CPU user state and system CPU system state in the current monitoring cycle are stored in a predefined overall CPU information structure.

[0077] And through the formula:

[0078]

[0079] Calculate the system CPU usage, where nuser is the system CPU user state, nsystem is the system CPU system state, t1 is the start time of the current monitoring cycle, and t2 is the end time of the current monitoring cycle.

[0080] Optionally, calculating the resource occupancy of the system according to the system resource information includes:

[0081] The system memory occupancy rate of each monitoring period is calculated according to the total system physical memory of the system memory, the first system idle physical memory at the start time, and the second system idle physical memory at the end time. The average value of the second system idle physical memory and the first system idle physical memory is used as the system idle physical memory of the system in the current monitoring period, and the system idle physical memory and the total system physical memory in the current monitoring period are stored in a predefined system overall memory information structure.

[0082] And through the formula:

[0083]

[0084] Calculate the system memory usage, where MemTotal is the total physical memory of the system and MemFree is the free physical memory of the system.

[0085] Optionally, in each monitoring cycle, collecting system resource information when the autonomous driving integrated system is running includes:

[0086] At the start time and the end time of each monitoring cycle, read the file information of the / proc / {pid} / stat file and the / proc / {pid} / stat file in the system respectively, wherein the file information of the / proc / {pid} / stat file includes the user state and the system state of the process, and the file information of the / proc / {pid} / stat file includes the process physical memory usage size of the process;

[0087] According to the file information of the / proc / {pid} / stat file, the third user state and the third system state of each process at the beginning time of each monitoring cycle and the fourth user state and the fourth system state at the end time are collected;

[0088] According to the file information of each process in the / proc / {pid} / status file, the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time are collected.

[0089] First, at the start and end of each monitoring cycle, the file information of the / proc / {pid} / stat file and the / proc / {pid} / stat file in the system are read respectively, wherein the file information of the / proc / {pid} / stat file includes the user state and system state of the process, and the file information of the / proc / {pid} / stat file includes the process physical memory usage size of the process. This embodiment also needs to monitor the resources of each functional module of the autonomous driving integrated system, wherein the resources of each functional module include CPU resources and memory resources, each functional module is a process, and each functional module monitors CPU resources and memory resources with the process as the smallest unit.

[0090] In the process of collecting process CPU resources and process memory resources, it is necessary to read the file information of the / proc / {pid} / stat file and the / proc / {pid} / status file in the system, where:

[0091] (1) The / proc / {pid} / stat file is used to collect process CPU resource information, mainly including the following information:

[0092] ①npid: process ID;

[0093] ②state: process status;

[0094] ③nutime: the time the process is in user mode;

[0095] ④nstime: the time the process is in kernel state;

[0096] (2) The / proc / {pid} / status file is used to collect process memory resource information, mainly including the following information:

[0097] ①Name: process name;

[0098] ②State: process status;

[0099] ③Tgid: thread ID;

[0100] ④Pid: process ID;

[0101] ⑤VmPeak: The peak value of virtual memory used by the process;

[0102] ⑥VmSize: The virtual memory value used by the process, including the swap partition;

[0103] ⑦VmHWM: peak value of physical memory used by the process;

[0104] ⑧VmRSS: the physical memory size used by the process;

[0105] ⑨Threads: The number of threads started within the process.

[0106] Secondly, according to the file information of the / proc / {pid} / stat file, the third user state and the third system state of each process at the beginning time of each monitoring cycle and the fourth user state and the fourth system state at the end time are collected.

[0107] When collecting process CPU resource information, the third user state and third system state of each process CPU at the start time and the fourth user state and fourth system state at the end time are collected from the / proc / {pid} / status file at the start time and the end time of each monitoring cycle, respectively. The third user state and the third system state are the process CPU resource information accumulated from the startup of the corresponding functional module in the autonomous driving integrated system to the start time of the current monitoring cycle, and the fourth user state and the fourth system state are the process CPU resource information accumulated from the startup of the corresponding functional module in the autonomous driving integrated system to the end time of the current monitoring cycle.

[0108] Finally, according to the file information of each process in the / proc / {pid} / status file, the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time are collected. When collecting process memory resource information, the third system idle physical memory at the start time of the process memory and the fourth system idle physical memory at the end time, as well as the total physical memory of the system are collected from the / proc / {pid} / status file at the start time and the end time of each monitoring cycle.

[0109] Optionally, the calculating, according to the system resource information, the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system includes:

[0110] The CPU occupancy rate of each functional module in each monitoring cycle is calculated according to the third user state and the third system state at the start time of each monitoring cycle and the fourth user state and the fourth system state at the end time of each process.

[0111] Among them, the absolute value of the difference between the fourth user state and the third user state is the process CPU user state of the process in the current monitoring period, and the absolute value of the difference between the fourth system state and the third system state is the process CPU system state of the process in the current monitoring period, and the process CPU user state and process CPU system state in the current monitoring period are stored in a pre-defined independent process CPU information structure.

[0112] And through the formula:

[0113]

[0114] Calculate the CPU usage of the process, where nutime is the process CPU user state, nstime is the process CPU system state, t1 is the start time of the current monitoring cycle, and t2 is the end time of the current monitoring cycle.

[0115] Optionally, the calculating, according to the system resource information, the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system includes:

[0116] The memory occupancy rate of each functional module in each monitoring cycle is calculated according to the physical memory usage size of the third process at the beginning time of each monitoring cycle and the physical memory usage size of the fourth process at the end time of each process. The average value of the physical memory usage size of the fourth process and the physical memory usage size of the third process is used as the process physical memory usage size of the process in the current monitoring cycle, and the process physical memory usage size and the total physical memory of the system in the current monitoring cycle are stored in a predefined independent process memory information structure.

[0117] And through the formula:

[0118]

[0119] Calculate the memory usage of each process, where MemTotal is the total physical memory of the system and VmRSS is the physical memory usage of the process.

[0120] Optionally, when the resource occupancy rate of at least one functional module in the system or each functional module exceeds a corresponding preset indicator, before issuing a corresponding warning message, the method further includes:

[0121] Formulate a first preset CPU occupancy rate and a first preset memory occupancy rate of the system;

[0122] A second preset CPU occupancy rate and a second preset memory occupancy rate are formulated for each functional module.

[0123] Since it is necessary to conduct regular resource monitoring of the autonomous driving integrated system and its internal functional modules at the same time, and different functional modules have large differences in function implementation and data processing strategies, resulting in inconsistent CPU resource requirements of each functional module, it is necessary to formulate different preset indicators for the autonomous driving integrated system and different functional modules. The preset indicators can be calibrated according to actual conditions, wherein a first preset CPU occupancy rate is formulated for the CPU occupancy rate of the autonomous driving integrated system, a first preset memory occupancy rate is formulated for the memory occupancy rate of the autonomous driving integrated system, a second preset CPU occupancy rate is formulated for the CPU occupancy rate of each functional module in the autonomous driving integrated system, and a second preset memory occupancy rate is formulated for the memory occupancy rate of each functional module in the autonomous driving integrated system.

[0124] Optionally, when the resource occupancy rate of at least one functional module in the system or each functional module exceeds a preset indicator corresponding thereto, issuing corresponding warning information also includes:

[0125] When the CPU occupancy rate of the system exceeds a first preset CPU occupancy rate of the system, or when the memory occupancy rate of the system exceeds a first preset memory occupancy rate of the system, issuing a first warning message;

[0126] When the CPU occupancy rate of each functional module exceeds the second preset CPU occupancy rate of each functional module, or when the memory occupancy rate of each functional module exceeds the second preset memory occupancy rate of each functional module, a second warning message is issued.

[0127] When the resource usage of the autonomous driving integrated system or its internal functional modules exceeds the preset indicators, a corresponding warning message will be issued to the developer. The warning message can be set according to the actual situation, such as:

[0128] When the CPU occupancy rate of the autonomous driving integrated system exceeds the first preset CPU occupancy rate, the first warning message issued is: the CPU occupancy rate of the autonomous driving integrated system is abnormal;

[0129] When the process memory occupancy rate of the positioning function module (process number 8246) exceeds the second preset memory occupancy rate corresponding thereto, the second warning information issued is: the process memory occupancy rate of the positioning function module (process number 8246) is abnormal.

[0130] Optionally, before collecting the system resource information of the autonomous driving integrated system during operation in each monitoring cycle, the method includes:

[0131] A resource monitoring module and a control switch thereof are set in the configuration file of the system, wherein the control switch is used to set whether the resource monitoring module is effective, and the control switch is a global variable.

[0132] In one embodiment, before performing resource monitoring on the autonomous driving integrated system and various functional modules therein, in order to more conveniently use the resource monitoring module and other functions in the system, a global variable can be used as a control switch to set in the system configuration file whether the resource monitoring module function is effective, and the resource monitoring module can be compiled separately to generate an executable file. When the function is set to be effective in the configuration file, the resource monitoring function can be started by directly executing the executable file.

[0133] Figure 2 A flowchart of another resource monitoring method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown:

[0134] In actual applications, first, set whether the resource monitoring module function is enabled in the configuration file in the autonomous driving integrated system, compile the resource monitoring module separately to generate an executable file, and then execute the executable file in the autonomous driving integrated system to enable the resource monitoring module function, run the autonomous driving integrated system, and start each functional module in the autonomous driving integrated system.

[0135] The resource monitoring module periodically monitors the resource occupancy rate of the autonomous driving integrated system and its various functional modules, including CPU resources and memory resources, and sets preset thresholds for the resource occupancy rate of the CPU resources and memory resources of the autonomous driving integrated system and its various functional modules. When it is monitored that the CPU resources or memory resources of the autonomous driving integrated system or a functional module within it exceed the corresponding preset threshold, a corresponding warning message is issued to enable developers to troubleshoot and optimize the autonomous driving integrated system or its internal functional modules based on the warning information, thereby improving the stability of the autonomous driving integrated system.

[0136] Figure 3 A schematic diagram of a resource monitoring device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, this embodiment provides a resource monitoring device, the device comprising:

[0137] A first collection module 11 is used to collect system resource information when the autonomous driving integrated system is running in each monitoring cycle;

[0138] A first calculation module 12 is used to calculate the resource occupancy rate of the system according to the system resource information, and / or calculate the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system;

[0139] The first warning module 13 is used to issue a corresponding warning message when the resource occupancy rate of at least one functional module in the system or each functional module exceeds a corresponding preset index.

[0140] Optionally, the first acquisition module 11 includes:

[0141] A first reading unit is used to read file information of a / proc / stat file and a / proc / meminfo file in the system at the start time and the end time of each monitoring cycle, respectively, wherein the file information of the / proc / stat file includes the user state and the system state of the system CPU, and the file information of the / proc / meminfo file includes the total physical memory of the system and the free physical memory of the system;

[0142] A first collecting unit is used to collect the first user state and the first system state of the system CPU at the beginning time of each monitoring cycle and the second user state and the second system state at the end time according to the file information of the / proc / stat file;

[0143] The second collecting unit is used to collect the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time according to the file information of the / proc / meminfo file.

[0144] Optionally, the first calculation module 12 includes:

[0145] The first calculation unit is used to calculate the system CPU occupancy rate of each monitoring period according to the first user state, the first system state, the second user state, the second system state, and the monitoring period.

[0146] Optionally, the first calculation module 12 further includes:

[0147] The second calculation unit is used to calculate the system memory occupancy rate of each monitoring cycle according to the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time.

[0148] Optionally, the first acquisition module 11 further includes:

[0149] A second reading unit is used to read file information of a / proc / {pid} / stat file and a / proc / {pid} / stat file in the system at the start time and the end time of each monitoring cycle, respectively, wherein the file information of the / proc / {pid} / stat file includes a user state and a system state of the process, and the file information of the / proc / {pid} / stat file includes a process physical memory usage size of the process;

[0150] A third collection unit is used to collect the third user state and the third system state of each process at the start time of each monitoring cycle and the fourth user state and the fourth system state at the end time according to the file information of the / proc / {pid} / stat file;

[0151] The fourth collection unit is used to collect the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time according to the file information of each process in the / proc / {pid} / status file.

[0152] Optionally, the first calculation module 12 further includes:

[0153] The third calculation unit is used to calculate the CPU occupancy rate of each functional module in each monitoring cycle according to the third user state and the third system state of each process at the beginning time of each monitoring cycle and the fourth user state and the fourth system state at the end time.

[0154] Optionally, the first calculation module 12 further includes:

[0155] The fourth calculation unit is used to calculate the memory occupancy rate of each functional module in each monitoring cycle according to the physical memory usage size of the third process at the beginning time of each monitoring cycle and the physical memory usage size of the fourth process at the end time of each process.

[0156] Optionally, the device further comprises:

[0157] A first formulation unit is used to formulate a first preset CPU occupancy rate and a first preset memory occupancy rate of the system before issuing a corresponding warning message when the resource occupancy rate of at least one functional module in the system or each functional module exceeds a corresponding preset indicator;

[0158] The second formulating unit is used to formulate a second preset CPU occupancy rate and a second preset memory occupancy rate of each functional module.

[0159] Optionally, the device further comprises:

[0160] The first operating unit is used to set a resource monitoring module and a control switch thereof in a configuration file of the system before collecting system resource information of the autonomous driving integrated system during operation in each monitoring cycle, wherein the control switch is used to set whether the resource monitoring module is effective, and the control switch is a global variable.

[0161] Based on the same inventive concept, another embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the resource monitoring method as described in any of the above embodiments.

[0162] Based on the same inventive concept, another embodiment of the present invention further provides a computer-readable medium. When the instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device can execute the resource monitoring method as described in any of the above embodiments.

[0163] As for the device, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0164] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0165] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0166] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0167] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0169] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0170] Finally, it should be noted that, in this article, 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 "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal 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 terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0171] The resource monitoring method, device, electronic device and computer-readable medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A resource monitoring method, characterized in that: Applied to an autonomous driving integrated system, the method comprises: In each monitoring cycle, collecting system resource information when the autonomous driving integrated system is running; Calculating the resource occupancy rate of the system according to the system resource information, and / or calculating the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system; When the resource occupancy rate of at least one functional module in the system or each functional module exceeds a preset index corresponding thereto, a corresponding warning message is issued.

2. The resource monitoring method according to claim 1, characterized in that: The system resources include the system CPU and system memory. In each monitoring cycle, the system resource information collected when the autonomous driving integrated system is running includes: At the start time and the end time of each monitoring cycle, read the file information of the / proc / stat file and the / proc / meminfo file in the system respectively, wherein the file information of the / proc / stat file includes the user state and the system state of the system CPU, and the file information of the / proc / meminfo file includes the total physical memory of the system and the free physical memory of the system; According to the file information of the / proc / stat file, the first user state and the first system state of the system CPU at the beginning time of each monitoring cycle and the second user state and the second system state at the end time are collected; According to the file information of the / proc / meminfo file, the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time are collected.

3. The resource monitoring method according to claim 2, characterized in that: The calculating the resource occupancy rate of the system according to the system resource information includes: The system CPU occupancy rate of each monitoring period is calculated according to the first user state, the first system state, the second user state, the second system state, and the monitoring period.

4. The resource monitoring method according to claim 2, characterized in that: The calculating the resource occupancy rate of the system according to the system resource information includes: The system memory occupancy rate of each monitoring period is calculated according to the total system physical memory of the system memory, the first system free physical memory at the start time, and the second system free physical memory at the end time.

5. The resource monitoring method according to claim 2, characterized in that: The collecting of system resource information during the operation of the autonomous driving integrated system in each monitoring cycle includes: At the start time and the end time of each monitoring cycle, read the file information of the / proc / {pid} / stat file and the / proc / {pid} / stat file in the system respectively, wherein the file information of the / proc / {pid} / stat file includes the user state and the system state of the process, and the file information of the / proc / {pid} / stat file includes the process physical memory usage size of the process; According to the file information of the / proc / {pid} / stat file, the third user state and the third system state of each process at the beginning time of each monitoring cycle and the fourth user state and the fourth system state at the end time are collected; According to the file information of each process in the / proc / {pid} / status file, the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time are collected.

6. The resource monitoring method according to claim 5, characterized in that: The calculating, according to the system resource information, the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system includes: The CPU occupancy rate of each functional module in each monitoring cycle is calculated according to the third user state and the third system state at the start time of each monitoring cycle and the fourth user state and the fourth system state at the end time of each process.

7. The resource monitoring method according to claim 5, characterized in that: The calculating, according to the system resource information, the resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system includes: The memory occupancy rate of each functional module in each monitoring cycle is calculated according to the physical memory usage size of the third process at the start time of each monitoring cycle and the physical memory usage size of the fourth process at the end time of each process.

8. The resource monitoring method according to claim 2, characterized in that: When the resource occupancy rate of at least one functional module in the system or each functional module exceeds the corresponding preset index, before issuing the corresponding warning information, the method further includes: Formulate a first preset CPU occupancy rate and a first preset memory occupancy rate of the system; A second preset CPU occupancy rate and a second preset memory occupancy rate are formulated for each functional module.

9. The resource monitoring method according to claim 8, characterized in that: When the resource occupancy rate of at least one functional module in the system or each functional module exceeds a preset index corresponding thereto, issuing a corresponding warning message also includes: When the CPU occupancy rate of the system exceeds a first preset CPU occupancy rate of the system, or when the memory occupancy rate of the system exceeds a first preset memory occupancy rate of the system, issuing a first warning message; When the CPU occupancy rate of each functional module exceeds the second preset CPU occupancy rate of each functional module, or when the memory occupancy rate of each functional module exceeds the second preset memory occupancy rate of each functional module, a second warning message is issued.

10. The resource monitoring method according to claim 1, characterized in that: Before collecting the system resource information of the automatic driving integrated system during operation in each monitoring cycle, the following steps are included: A resource monitoring module and a control switch thereof are set in the configuration file of the system, wherein the control switch is used to set whether the resource monitoring module is effective, and the control switch is a global variable.

11. A resource monitoring device, characterized in that: Applied to an autonomous driving integrated system, the device comprises: A first collection module is used to collect system resource information when the autonomous driving integrated system is running in each monitoring cycle; a first calculation module, configured to calculate a resource occupancy rate of the system according to the system resource information, and / or calculate a resource occupancy rate of each of the functional modules integrated in the autonomous driving integrated system; The first warning module is used to issue a corresponding warning message when the resource occupancy rate of at least one functional module in the system or each functional module exceeds the corresponding preset index.

12. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the resource monitoring method according to any one of claims 1 to 10.

13. A computer storage medium, characterized in that: When the instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the resource monitoring method as described in any one of claims 1 to 10.