Multi-core load rate measurement method and system, and vehicle

By configuring separate storage space for the nuclear load rate measurement program and acquisition variables, and using hardware timers to obtain the time limit for the task operation status, the problem of large errors in the nuclear load rate measurement in the prior art is solved, and a higher accuracy of nuclear load rate measurement is achieved.

CN119512738APending Publication Date: 2025-02-25SINO TRUK JINAN POWER CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411470188.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The core load rate measurement method in the existing vehicle-mounted controller has the problem of large errors and the inability to accurately measure the time information of different operating states of each task.

Method used

By configuring separate storage space for the core load rate measurement program and acquisition variables, and using the hardware timer as the time reference, the time limit for each operating state of each target task in the target core is obtained and the core load rate is calculated.

Benefits of technology

Improve the accuracy of nuclear load rate measurement and avoid the impact on the performance of the original program in the nuclear.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512738A_ABST
    Figure CN119512738A_ABST
Patent Text Reader

Abstract

The invention relates to the field of vehicle nuclear load rate measurement, and particularly discloses a multi-core nuclear load rate measurement method and system and a vehicle. Independent program storage space is configured for each nuclear load rate measurement program; respectively configuring an independent variable storage space for the acquisition variable of each nuclear load rate measurement program; taking a hardware timer as a time reference, and obtaining a time value of each running state of each target task in the target core; calculating a nuclear load rate according to the time value of each running state of each target task; and sending out the nuclear load rate through a CAN channel. According to the method, the core load rate is measured according to the time of each running state of each task, the measurement accuracy is improved, meanwhile, the hardware timer serves as a time reference, the accuracy of time recording is improved, and the performance of an original program in a core is not affected when the method runs in an independent storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of vehicle nuclear load rate measurement, and in particular to a multi-core nuclear load rate measurement method and system, and a vehicle. Background Art

[0002] At present, with the increasing number of on-board controllers, the calculation and control of controllers are becoming increasingly complex, and the application of multi-core operating systems is growing day by day. How to scientifically allocate task scheduling based on the operating system and effectively monitor and evaluate the load rate of each MCU has become a key issue. Accurate load rate measurement not only helps to optimize system task allocation, but also provides an important reference for resource allocation and power management. The existing core load rate measurement method in vehicle controllers usually roughly calculates the running time of each task during the running task, and compares it with the total running time by accumulating the time of a single task. The resulting core load rate has a large error. Therefore, there is an urgent need for an accurate load rate measurement method suitable for multi-core processors.

[0003] The related technology with publication number CN114036033A discloses a method for calculating a load rate. When the load rate is a process load rate or a task load rate, the method includes: recording different states of the process or task, and recording the running time of each section of the process or task according to the change of the state; obtaining the total running time of the process or task; and dividing the total running time of the process or task by the cycle time of the process or task to obtain the corresponding load rate.

[0004] However, the existing technology cannot accurately measure the time information of each task in different running states. The acquisition of time information depends on the operating system time, and the resolution is not high enough. When measuring the core load rate, it will also affect the performance of the original program in the core. Summary of the invention

[0005] To solve the above problems, the present invention provides a multi-core core load rate measurement method, system and vehicle, which measure the core load rate according to the time of each running state of each task to improve the measurement accuracy. At the same time, the hardware timer is used as the time reference to improve the accuracy of time recording, and it runs in a separate storage space without affecting the performance of the original program in the core.

[0006] In a first aspect, the technical solution of the present invention provides a multi-core core load rate measurement method, comprising the following steps: Step 1, step of configuring storage space; Separate program storage space is configured for each nuclear load rate measurement program; Separate variable storage spaces are configured for the collected variables of each nuclear load rate measurement program; Step 2, running a nuclear loading rate measurement program to perform nuclear loading rate measurement; Using the hardware timer as the time reference, obtain the time interval of each running state of each target task in the target core; Calculate the nuclear load rate according to the time period of each operating state of each target task; Step 3, the step of sending the nuclear load rate; The core load rate is sent out via the CAN channel.

[0007] In an optional implementation, using a hardware timer as a time reference, obtaining the time of each running state of each target task in the target core specifically includes: Using the hardware timer as the time reference, the chip timer information is obtained by reading the register information of the chip timer of the target core and combining the register configuration to count up or down. The time interval of each running state of each target task in the target core is recorded according to the chip timer information.

[0008] In an optional implementation, recording the time gap of each target task in the target core specifically includes: When each target task enters the target task state, the time period of the current task state is continuously obtained. The task states include running, idle, waiting, suspended, and ready. The time period includes the task activation time, start time, preempted time, restart time, waiting time, release time, and end time. The acquired time period is stored in the corresponding variable storage space and stored in the form of a buffer.

[0009] In an optional implementation, the core load rate is calculated according to the time interval of each running state of each target task, specifically including: For each target task, the task load rate is calculated by the following formula: Task load rate = (total task running time / total task existence time) × 100%; The task load rate of each target task is weighted and summed to obtain the core load rate.

[0010] In an optional implementation, before using the hardware timer as the time reference, the following steps are also included: Configure the core load rate measurement program, including configuring the target cores and target tasks to be monitored.

[0011] In an optional implementation, the core load rate is sent through a CAN channel, specifically including: Check the status of each CAN channel in the running program of the target core; Select one of the idle CAN channels as the target CAN channel; Send a custom message with the core load rate to the CAN line through the target CAN channel.

[0012] In a second aspect, the technical solution of the present invention provides a multi-core core load rate measurement system for implementing any of the above methods, the system comprising: Storage space configuration module: used to configure storage space, including configuring a separate program storage space for each nuclear load rate measurement program, and configuring a separate variable storage space for the collected variables of each nuclear load rate measurement program; Core load rate measurement module: used to run the core load rate measurement program to measure the core load rate, including using the hardware timer as the time reference to obtain the time period of each running state of each target task in the target core; and calculating the core load rate according to the time period of each running state of each target task; Core load rate sending module: used to send the core load rate through the CAN channel.

[0013] In an optional implementation, the core load rate measurement module obtains the time interval of each running state of each target task in the target core, specifically including: When each target task enters the target task state, the time period of the current task state is continuously obtained. The task states include running, idle, waiting, suspended, and ready. The time period includes the task activation time, start time, preempted time, restart time, waiting time, release time, and end time. The acquired time period is stored in the corresponding variable storage space and stored in the form of a buffer.

[0014] In an optional implementation, the core load rate measurement module calculates the core load rate according to the time interval of each running state of each target task, specifically including: For each target task, the task load rate is calculated by the following formula: Task load rate = (total task running time / total task existence time) × 100%; The task load rate of each target task is weighted and summed to obtain the core load rate.

[0015] In a third aspect, the technical solution of the present invention provides a vehicle equipped with any of the systems described above.

[0016] Compared with the prior art, the present invention provides a multi-core core load rate measurement method, system and vehicle, which have the following beneficial effects: a separate storage space is configured for the core load rate measurement program and the collected variables, which are isolated from the original program in the core, and the operation of the core load rate measurement program does not affect the original program; at the same time, the hardware timer is used as a time reference to improve the accuracy of time recording, thereby improving the accuracy of core load rate measurement; the core load rate is measured according to the time of each running state of each task, thereby improving the measurement accuracy. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 It is a schematic flow chart of a multi-core core load rate measurement method provided by an embodiment of the present invention.

[0018] Figure 2 The present invention provides a multi-core load rate measurement system structure schematic diagram. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than 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.

[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0021] Figure 1 : is a schematic flow chart of a multi-core core load rate measurement method provided by an embodiment of the present invention, wherein: Figure 1 The execution subject may be a multi-core load rate measurement system. The multi-core load rate measurement method provided in the embodiment of the present invention is executed by a computer device, and accordingly, the multi-core load rate measurement system runs in the computer device. According to different requirements, the order of the steps in the flowchart can be changed, and some can be omitted.

[0022] like Figure 1As shown, the method includes the following steps.

[0023] S1, step of configuring storage space.

[0024] S1.1, configure separate program storage space for each nuclear load rate measurement program.

[0025] S1.2, configure separate variable storage spaces for the collected variables of each nuclear load rate measurement program.

[0026] In an optional implementation, the compilation link file is modified to assign different RAM and FLASH space addresses to the core load rate measurement program and variables without affecting the operation of the original program. At the same time, different measurement variables are divided into different memory areas. In this way, an area can be opened up in the memory space to ensure that the core load rate measurement program runs in a relatively independent memory space and does not occupy resources with the main program in the core. A large amount of time gap information can be stored by setting BUFFER.

[0027] S2, a step of running a nuclear loading rate measurement program to perform nuclear loading rate measurement.

[0028] S2.1, using the hardware timer as the time reference, obtain the time interval of each running state of each target task in the target core.

[0029] In this embodiment, the hardware timer is used as the time reference, and the chip timer information is obtained by reading the register information of the chip timer of the target core and combining the register configuration, using an up or down counting method; and the time of each running state of each target task in the target core is recorded according to the chip timer information. The measurement mechanism based on the hardware timer can ensure the accuracy of the measured time information.

[0030] In this embodiment, when each target task enters the target task state, the time of the current task state is continuously obtained to obtain the time of each target task in the target core. In this embodiment, the task state includes running, idle, waiting, suspended, and ready, and the time includes the activation time, start time, preempted time, restart time, waiting time, release time, and end time of the task.

[0031] In this embodiment, the acquired time period is stored in the corresponding variable storage space and stored in the form of a buffer. The different state time information of each task can be stored in different temporary variables (buffers), and the buffer can be refreshed quickly to realize a flexible time period reading mechanism.

[0032] In an optional implementation, a core load rate measurement program is pre-configured, including configuring target cores and target tasks to be monitored, which can increase or decrease the tasks or core load rates to be monitored as needed, thereby achieving measurement flexibility and avoiding the transmission of a large amount of meaningless values.

[0033] S2.2, calculate the core load rate according to the time period of each operating state of each target task.

[0034] This embodiment classifies the states of the running tasks in each core, accumulates the time of each state of each task, generates time accumulation data, calculates the load rate of the tasks in the core based on the time accumulation data, and further calculates the core load rate.

[0035] First, for each target task, calculate the task load rate using the following formula: Task load rate = (total task running time / total task existence time) × 100%. Then, perform the weighted sum of the task load rates of each target task to obtain the core load rate. It should be noted that the total task running time refers to the total time of the actual running process, and the total task existence time refers to the total time from the start to the end of the task.

[0036] S3, the step where the nuclear loading rate is issued.

[0037] This embodiment sends the core load rate through the CAN channel. Specifically, the state of each CAN channel in the running program of the target core is detected; one CAN channel in the idle state is selected as the target CAN channel; and a custom message with the core load rate is sent to the CAN line through the target CAN channel. Through the message customization method, it is possible to configure which core load rate values ​​and which task load rate values ​​are sent.

[0038] In this embodiment, the core load rate is sent to the CAN line in the form of a CAN message, which can be received by all CAN tools. Furthermore, in a multi-core system, by real-time monitoring of the load of each core, task allocation can be dynamically adjusted to avoid overloading of some cores while other cores are idle, thereby improving overall resource utilization; providing real-time load data for the task scheduler, optimizing task allocation and scheduling strategies, and improving system performance.

[0039] An embodiment of a multi-core load rate measurement method is described in detail above. Based on the multi-core load rate measurement method described in the above embodiment, an embodiment of the present invention further provides a multi-core load rate measurement system corresponding to the method.

[0040] Figure 2This is a schematic block diagram of the structure of a multi-core core load rate measurement system provided by an embodiment of the present invention. In this embodiment, the multi-core core load rate measurement system can be divided into multiple functional modules according to the functions it performs. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory.

[0041] Storage space configuration module: used to configure storage space, including configuring a separate program storage space for each nuclear load rate measurement program, and configuring a separate variable storage space for the collected variables of each nuclear load rate measurement program.

[0042] Core load rate measurement module: used to run the core load rate measurement program to measure the core load rate, including using the hardware timer as the time reference to obtain the time period of each running state of each target task in the target core; and calculating the core load rate according to the time period of each running state of each target task.

[0043] Core load rate sending module: used to send the core load rate through the CAN channel.

[0044] In an optional embodiment, the core load rate measurement module obtains the time period of each running state of each target task in the target core, specifically including: when each target task enters the target task state, continuously obtains the time period of the current task state, the task states include running, idle, waiting, suspended, and ready, and the time period includes the task activation time, start time, preempted time, restart time, waiting time, release time, and end time; the obtained time period is stored in the corresponding variable storage space and stored in the form of a buffer.

[0045] In an optional embodiment, the core load rate measurement module calculates the core load rate based on the time period of each operating state of each target task, specifically including: for each target task, calculating the task load rate by the following formula, task load rate = (total task running time / total task existence time) × 100%; performing weighted summation of the task load rates of each target task to obtain the core load rate.

[0046] The multi-core load rate measurement system of this embodiment is used to implement the aforementioned multi-core load rate measurement method. Therefore, the specific implementation method of this system can be seen in the embodiment part of the multi-core load rate measurement method in the previous text. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, which will not be elaborated here.

[0047] In addition, since the multi-core load rate measurement system of this embodiment is used to implement the aforementioned multi-core load rate measurement method, its function corresponds to that of the aforementioned method, and will not be described in detail here.

[0048] This embodiment provides a vehicle, which is equipped with the multi-core load rate measurement system of the above embodiment and executes the multi-core load rate measurement method of the above embodiment.

[0049] The above disclosure is only a preferred embodiment of the present invention, but the present invention is not limited thereto. Any non-creative changes that can be thought of by a person skilled in the art, as well as several improvements and modifications made without departing from the principle of the present invention, should fall within the protection scope of the present invention.

Claims

1. A method for measuring multi-core core load rate, characterized in that: The following steps are involved: Step 1, step of configuring storage space; Separate program storage space is configured for each nuclear load rate measurement program; Separate variable storage spaces are configured for the collected variables of each nuclear load rate measurement program; Step 2, running a nuclear loading rate measurement program to perform nuclear loading rate measurement; Using the hardware timer as the time reference, obtain the time interval of each running state of each target task in the target core; Calculate the nuclear load rate according to the time period of each operating state of each target task; Step 3, the step of sending the nuclear load rate; The core load rate is sent out via the CAN channel.

2. The multi-core core load rate measurement method according to claim 1, characterized in that: Using the hardware timer as the time reference, obtain the time of each running state of each target task in the target core, including: Using the hardware timer as the time reference, the chip timer information is obtained by reading the register information of the chip timer of the target core and combining the register configuration to count up or down. The time interval of each running state of each target task in the target core is recorded according to the chip timer information.

3. The multi-core core load rate measurement method according to claim 2, characterized in that: Record the time gap of each target task in the target core, including: When each target task enters the target task state, the time period of the current task state is continuously obtained. The task states include running, idle, waiting, suspended, and ready. The time period includes the task activation time, start time, preempted time, restart time, waiting time, release time, and end time. The acquired time period is stored in the corresponding variable storage space and stored in the form of a buffer.

4. The multi-core core load rate measurement method according to claim 3, characterized in that: The core load rate is calculated based on the time period of each operating state of each target task, including: For each target task, the task load rate is calculated by the following formula: Task load rate = (total task running time / total task existence time) × 100%; The task load rate of each target task is weighted and summed to obtain the core load rate.

5. The multi-core core load rate measurement method according to any one of claims 1 to 4, characterized in that: Before using the hardware timer as the time base, the following steps are also included: Configure the core load rate measurement program, including configuring the target cores and target tasks to be monitored.

6. The method for measuring multi-core core load rate according to any one of claims 1 to 4, characterized in that: The core load rate is sent through the CAN channel, including: Check the status of each CAN channel in the running program of the target core; Select one of the idle CAN channels as the target CAN channel; Send a custom message with the core load rate to the CAN line through the target CAN channel.

7. A multi-core core load rate measurement system, characterized in that: For implementing the method described in any one of claims 1 to 6, the system comprises: Storage space configuration module: used to configure storage space, including configuring a separate program storage space for each nuclear load rate measurement program, and configuring a separate variable storage space for the collected variables of each nuclear load rate measurement program; Core load rate measurement module: used to run the core load rate measurement program to measure the core load rate, including using the hardware timer as the time reference to obtain the time period of each running state of each target task in the target core; and calculating the core load rate according to the time period of each running state of each target task; Core load rate sending module: used to send the core load rate through the CAN channel.

8. The multi-core core load rate measurement system according to claim 7, characterized in that: The core load rate measurement module obtains the time interval of each running state of each target task in the target core, including: When each target task enters the target task state, the time period of the current task state is continuously obtained. The task states include running, idle, waiting, suspended, and ready. The time period includes the task activation time, start time, preempted time, restart time, waiting time, release time, and end time. The acquired time period is stored in the corresponding variable storage space and stored in the form of a buffer.

9. The multi-core core load rate measurement system according to claim 8, characterized in that: The core load rate measurement module calculates the core load rate according to the time period of each operating state of each target task, including: For each target task, the task load rate is calculated by the following formula: Task load rate = (total task running time / total task existence time) × 100%; The task load rate of each target task is weighted and summed to obtain the core load rate.

10. A vehicle, characterized in that: Configure the system described in any one of claims 7-9.

Citation Information

Patent Citations

  • A load rate calculation method and a load rate calculation system

    CN114036033A