Information processing apparatus and information processing system
The described system addresses the limitation of conventional MCU measurement methods by using a processor and ring buffers to accurately and efficiently measure program processing time, enhancing versatility and reducing data overwriting.
Patent Information
- Application Number
- JP2024009785
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2025-08-06
AI Technical Summary
Conventional methods for measuring program processing time in MCUs require a system to detect changes in memory usage, limiting the versatility of MCUs that can perform this function.
An information processing device and system that includes a first processor, a first ring buffer, and a second ring buffer to measure start and end timer values, with a calculation unit sampling these values at predetermined cycles to calculate processing time.
Enables more versatile measurement of program processing time using MCUs, improving accuracy and speed by correcting data arrangements and preventing overwriting of timer values.
Smart Images

Figure 2025115304000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to an information processing device and an information processing system. [Background technology]
[0002] In order to improve the processing efficiency of MCUs (Micro Controller Units) built into ECUs (Electronic Control Units) installed in automobiles, designers are required to measure and manage the processing time of programs that control the CPU (Central Processing Unit). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2015-148864 Summary of the Invention [Problem to be solved by the invention]
[0004] A known method for measuring program processing time is to divide the internal memory area into a memory area where the program to be measured is executed and a memory area where programs not to be measured are executed. This method requires the MCU to be equipped with a system that can detect when the memory area used to execute the program has changed. This limits the MCUs that can measure program processing time.
[0005] One of the objects of the present invention is to measure the processing time of a program using an MCU that is more versatile than conventional ones. [Means for solving the problem]
[0006] To achieve the above object, an information processing device according to the present invention includes a first processor, a first ring buffer, and a second ring buffer. The first processor processes a measurement target program, measures a start timer value at the start timing of processing the measurement target program, and measures an end timer value at the end timing of processing the measurement target program. The first ring buffer stores the measured start timer value. The second ring buffer stores the measured end timer value.
[0007] An information processing system according to the present invention includes a first processor, a first ring buffer, a second ring buffer, and a second processor. The first processor measures a start timer value at the start timing of processing of a program to be measured, and measures an end timer value at the end timing of processing of the program to be measured. The first ring buffer stores the measured start timer value. The second ring buffer stores the measured end timer value. The second processor samples the multiple start timer values stored in the first ring buffer at a predetermined cycle, and samples the multiple end timer values stored in the second ring buffer at a predetermined cycle. [Effects of the Invention]
[0008] According to the present invention, it is possible to measure the program processing time using a more versatile MCU than conventional methods. [Brief explanation of the drawings]
[0009] [Figure 1] FIG. 1 is a diagram showing a schematic configuration of an information processing system according to an embodiment. [Figure 2] FIG. 2 is a schematic diagram illustrating an example of data sampled by the calculation unit. [Figure 3] FIG. 3 is a flowchart showing the flow of processing in the information processing system of the embodiment. [Figure 4] FIG. 4 is a schematic diagram illustrating an example of the sampling period of the calculation unit. [Figure 5] FIG. 5 is a schematic diagram illustrating an example of the sampling period of the calculation unit. [Figure 6] FIG. 6 is a schematic diagram showing an example of rearrangement and correction of data sampled by the calculation unit. [Figure 7] FIG. 7 is a schematic diagram showing an example of rearrangement and correction of data sampled by the calculation unit. [Figure 8] FIG. 8 is a flowchart showing the flow of processing by the calculation unit. DETAILED DESCRIPTION OF THE INVENTION
[0010] [Embodiment] Hereinafter, an embodiment of the information processing system 1 will be described in detail with reference to the accompanying drawings. The configuration of the embodiment described below, and the actions and results (effects) brought about by said configuration are merely examples, and are not limited to the following description. Note that in this specification, ordinal numbers are used only to distinguish between parts and components, and do not indicate order or priority.
[0011] The outline and structure of the information processing system 1 according to this embodiment will be described below. Fig. 1 is a configuration diagram showing the outline of the configuration of the information processing system 1 according to one embodiment. The information processing system 1 according to this embodiment is an information processing system that has a function of grasping the processing time of a program, for example.
[0012] The information processing system 1 includes an ECU (Electronic Control Unit / Micro Controller Unit) 10. The ECU 10 includes an MCU (Micro Controller Unit) 101 and a RAM (Random Access Memory) 102. The ECU 10 controls the operations of the MCU 101, the RAM 102, and the like.
[0013] The MCU 101 executes processing of a measurement target program, measures a measurement start timer value at the timing when the processing of the measurement target program starts, and measures a measurement end timer value at the timing when the processing of the measurement target program ends. The MCU 101 is an example of a first processor.
[0014] Here, the measurement start timer value is the value at the start time of the measurement target program's execution. The measurement end timer value is the value at the end time of the measurement target program's execution. Hereinafter, the measurement start timer value at the start timing of the measurement target program's processing may be referred to as the measurement start timer value, and the measurement end timer value at the end timing of the measurement target program's processing may be referred to as the measurement end timer value.
[0015] The RAM 102 is a work area when the MCU 101 executes a program. The RAM 102 stores a measurement start timer value and a measurement end timer value of a measurement target program measured by the MCU 101. The MCU 101 uses the RAM 102 as a work area to execute the measurement target program stored in a ROM (not shown), for example, multiple times at regular intervals.
[0016] The RAM 102 has a first ring buffer 1021 and a second ring buffer 1022. The first ring buffer 1021 holds a start timer value measured by the MCU 101. The second ring buffer 1022 holds an end timer value measured by the MCU 101.
[0017] As will be described later, the first ring buffer 1021 has four arrays A1, A2, A3, and A4, and the second ring buffer 1022 has four arrays B1, B2, B3, and B4.
[0018] The MCU 101 buffers one measurement start timer value each into each of four arrays A1, A2, A3, and A4 in the first ring buffer 1021, in the order of A1, A2, A3, and A4. The MCU 101 buffers one measurement end timer value each into each of four arrays B1, B2, B3, and B4 in the second ring buffer 1022, in the order of B1, B2, B3, and B4. Since the configurations of the four arrays B1, B2, B3, and B4 in the second ring buffer 1022 are the same as the configurations of the four arrays A1, A2, A3, and A4 in the first ring buffer 1021, detailed description thereof will be omitted and not shown. The detailed configuration of the first ring buffer 1021 will be described later.
[0019] The ECU 10 is connected to a calculation unit 105. For example, the ECU 10 is connected to a computer including at least one processor, at least one memory, and a communication interface for communicating with the ECU 10. The calculation unit 105 samples a plurality of start timer values stored in a first ring buffer 1021 at a predetermined cycle. The calculation unit 105 samples a plurality of end timer values stored in a second ring buffer 1022 at a predetermined cycle. The calculation unit 105 calculates the processing time of the measurement target program based on the sampled measurement start timer value and measurement end timer value. For example, the calculation unit 105 is realized by at least one processor of the computer connected to the ECU 10. The calculation unit 105 is an example of a second processor.
[0020] Fig. 2 is a schematic diagram showing an example of data sampled by the calculation unit 105. More specifically, Fig. 2 shows a state in which multiple measurement start timer values sampled by the calculation unit 105 are held in four arrays A1, A2, A3, and A4, respectively. In Fig. 2, the vertical axis (A1, A2, A3, and A4) of the table indicates the arrays of the first ring buffer 1021 and the second ring buffer 1022. Furthermore, the horizontal axis (T1, T2, T3, T4, T5, T6, T7, T8, and T9) of the table indicates the time during which the measurement target program is executed multiple times.
[0021] For example, the calculation unit 105 samples the RAM 102 at time T7 and acquires the measurement start timer value "169138" in array A3. Next, the calculation unit 105 samples the RAM 102 at time T8 and acquires the measurement start timer value "180842" in array A4. Then, the array from which the measurement start timer value is acquired returns to array A1, and the calculation unit 105 samples the RAM 102 at time T9 and acquires the measurement start timer value "193404" in array A1.
[0022] Between time T6 and time T7, the first ring buffer 1021 does not hold the measurement start timer values of arrays A1, A2, and A4. Therefore, at time T7, the measurement start timer values acquired between time T5 and time T6 are held in arrays A1, A2, and A4 without being updated.
[0023] Between time T3 and time T4, the first ring buffer 1021 does not hold the measurement start timer values of any of the four arrays A1, A2, A3, and A4. Therefore, at time T4, the measurement start timer values acquired between time T3 and time T4 are held in the arrays A1, A2, A3, and A4 without being updated.
[0024] The number of arrays included in the first ring buffer 1021 and the second ring buffer 1022 is not limited to four. For example, if the number of arrays included in the first ring buffer 1021 and the second ring buffer 1022 is eight, the first ring buffer 1021 and the second ring buffer 1022 each have arrays A1, A2, A3, A4, A5, A6, A7, and A8. The calculation unit 105 samples the RAM 102 at time T8 and acquires the measurement start timer value "180842" in array A4, and then samples the RAM 102 at time T9 and acquires the measurement start timer value "193404" in array A5. After the measurement start timer values have been acquired in all of the arrays A1 to A8 in this way, the array from which the measurement start timer value was acquired returns to array A1, and the above procedure is repeated.
[0025] The number of arrays included in each of the first ring buffer 1021 and the second ring buffer 1022 can be changed depending on at least one of the sampling period of the calculation unit 105 and the processing speed of the program to be measured. When the sampling period is long, the number of timer values updated simultaneously increases compared to when the sampling period is short, and the timer value data is overwritten more frequently. Furthermore, when the program execution speed is fast, the calculation unit 105 samples more timer values during one sampling period, and the timer value data is overwritten more frequently. In order to prevent the timer value data from being overwritten in this way, it is effective to increase the number of arrays included in the first ring buffer 1021 and the second ring buffer 1022.
[0026] [Program processing time measurement flow] Next, the flow of measuring the processing time of a measurement target program in the information processing system 1 will be described with reference to Figs. 3 to 7. Fig. 3 is a flowchart showing the flow of processing in the information processing system of the above embodiment. Fig. 4 is a schematic diagram showing an example of the sampling period of the calculation unit 105. Fig. 5 is a schematic diagram showing an example of the sampling period of the calculation unit 105. Fig. 6 is a schematic diagram showing an example of rearrangement and correction of data sampled by the calculation unit 105. Fig. 7 is a schematic diagram showing an example of rearrangement and correction of data sampled by the calculation unit 105.
[0027] Among the programs executed by the MCU 101, a program for acquiring a measurement start timer value is embedded before the execution of the measurement target program. Also, a program for acquiring a measurement end timer value is embedded after the execution of the measurement target program. With this configuration, the RAM 102 can store the acquired measurement start timer value and measurement end timer value.
[0028] 3, first, in step S11, under the control of the MCU 101, the measurement start timer value is stored in the RAM 102. Then, the processing of the measurement target program is executed by the MCU 101 (step S12), and the measurement end timer value is stored in the RAM 102 (step S13).
[0029] The measurement start timer value and measurement end timer value stored in the RAM 102 are buffered in the first ring buffer 1021 and the second ring buffer 1022. As a result, the measurement start timer value and measurement end timer value stored in the RAM 102 are held in the first ring buffer 1021 and the second ring buffer 1022 at all times (step S14).
[0030] Since the first ring buffer 1021 and the second ring buffer 1022 have a limited capacity to hold the measurement start timer value and the measurement end timer value, after the upper limit of the capacity of the first ring buffer 1021 and the second ring buffer 1022 is reached, the oldest timer value is overwritten among the measurement start timer value and the measurement end timer value stored in the RAM 102. The above steps S11 to S14 are executed by the processing of the MCU 101.
[0031] Next, the calculation unit 105 periodically samples the RAM 102 and acquires the measurement start timer value and the measurement end timer value buffered in the first ring buffer 1021 and the second ring buffer 1022 (step S15). First, an example of a sampling pattern shown in FIG. 4 will be described. As shown in FIG. 4, the calculation unit 105 samples the RAM 102 between start CP#1 and start CP#2, between start CP#2 and start CP#3, and between start CP#3 and start CP#4. That is, the calculation unit 105 samples the RAM 102 between multiple timings at which the MCU 101 measures the measurement start timer value. Here, start CP#1 refers to the measurement start timer value of the measurement target program that is executed for the first time. The same applies to start CP#2, start CP#3, and start CP#4. In the following description, since the steps executed in the second ring buffer 1022 are the same as those executed in the first ring buffer 1021, only the steps executed in the first ring buffer 1021 will be described.
[0032] At this time, one measurement start timer value is updated for each sampling by the calculation unit 105. The array of measurement start timer values updated by the calculation unit 105 forms a diagonal straight line as shown in Fig. 4. This makes it easy for the calculation unit 105 to calculate the processing time of the measurement target program from the array of sampled measurement start timer values and the array of sampled measurement end timer values.
[0033] Next, an example of the sampling pattern shown in Fig. 5 will be described. As shown in Fig. 5, the cycle in which the calculation unit 105 samples the RAM 102 is between start CP#1 and start CP#2 in the first sampling, between start CP#2 and start CP#3 in the second sampling, and between start CP#4 and end CP#4 in the third sampling. Between the second and third samplings, two measurement start timer values (start CP#3 and start CP#4) are held in the first ring buffer 1021. In other words, between the second and third samplings by the calculation unit 105, the two measurement start timer values are updated. In other words, the update cycle of the start timer values in each array of the first ring buffer 1021 updated by the calculation unit 105 is not uniform.
[0034] For this reason, the calculation unit 105 corrects the arrangement in the time direction of at least one of the multiple start timer values sampled at a predetermined cycle and the multiple end timer values sampled at a predetermined cycle. More specifically, the calculation unit 105 analyzes the measurement data (measurement start timer values and measurement end timer values) of the first ring buffer 1021 and the second ring buffer 1022 acquired by sampling the RAM 102, and rearranges and corrects the measurement data, so that the processing time of the measurement target program can be easily calculated from the arrangement of the sampled measurement start timer values and the arrangement of the sampled measurement end timer values. This rearrangement and correction will be described below.
[0035] The calculation unit 105 corrects the arrangement in the time direction of the multiple start timer values sampled at a predetermined cycle so as to uniform the update cycle of the start timer values in each array of the first ring buffer 1021. Similarly, the calculation unit 105 corrects the arrangement in the time direction of the multiple end timer values sampled at a predetermined cycle so as to uniform the update cycle of the end timer values in each array of the second ring buffer 1022.
[0036] More specifically, after inputting the measurement data in step S16, the calculation unit 105 performs a data search in the +T direction in each of the arrays A1 to A4, as shown in Fig. 6 (step S17, arrow Y1). If an updated measurement start timer value D1 is found in the data search in the +T direction, the calculation unit 105 performs a further search in the +A direction from the position where the timer value is found. If no measurement data exists in the +A direction, the calculation unit 105 performs a search in the -A direction (step S18, arrow Y2).
[0037] When an updated measurement start timer value D2 is found in the data search in the A-axis direction indicated by arrow Y2, the data (measurement data) of the measurement start timer value D1 found in the data search in the +T direction is rearranged and corrected, as shown in Fig. 7. More specifically, the measurement data found in the data search in the +T direction is moved to the closest position among times T1 to T9 in the T-axis direction and overwritten and updated (step S19, arrow Y3). The above steps S15 to S20 are executed by the processing of the calculation unit 105.
[0038] Finally, the calculation unit 105 calculates the processing time of the measurement target program based on the measurement data in the first ring buffer 1021 and the second ring buffer 1022 that have been rearranged and corrected, and then ends the process.
[0039] [Comparative Example] Next, a comparative example of this embodiment will be described with reference to Fig. 8. Fig. 8 is a flowchart showing the processing flow of the calculation unit 105. As shown in Fig. 6, in this comparative example of this embodiment, the calculation unit 105 stores a measurement start timer value and a measurement end timer value. The processing flow of the calculation unit 105 in this comparative example will be described below.
[0040] First, in step S21, the calculation unit 105 detects that the program counter reaches the top of the program to be measured, and then the calculation unit 105 records the internal time of the calculation unit 105 (step S22).
[0041] When the processing of the measurement target program is completed, the calculation unit 105 detects that the program counter at the end of the measurement target program has been reached (step S23). Finally, the calculation unit 105 records the internal time of the calculation unit 105 (step S24). This completes the recording of the start time and end time of the measurement target program by the calculation unit 105.
[0042] The calculation unit 105 records the time when the calculation unit 105 detects the program counter of the measurement target program, and calculates the processing time of the measurement target program. The time detected by the calculation unit 105 may have an error with the time when the program counter of the measurement target program actually reaches the time. Therefore, the processing time of the measurement target program calculated in this comparative example may have an error with the processing time of the measurement target program calculated in this embodiment.
[0043] In the above embodiment, the information processing device includes an MCU 101, a first ring buffer 1021, and a second ring buffer 1022. The MCU 101 processes a measurement target program, measures a start timer value at the start timing of processing the measurement target program, and measures an end timer value at the end timing of processing the measurement target program. The first ring buffer 1021 holds the measured start timer value. The second ring buffer 1022 holds the measured end timer value.
[0044] The information processing system 1 also includes an MCU 101, a first ring buffer 1021, a second ring buffer 1022, and a calculation unit 105. The MCU 101 processes a measurement target program, measures a start timer value at the start timing of processing the measurement target program, and measures an end timer value at the end timing of processing the measurement target program. The first ring buffer 1021 holds the measured start timer value. The second ring buffer 1022 holds the measured end timer value. The calculation unit 105 samples the multiple start timer values held in the first ring buffer 1021 at a predetermined cycle, and samples the multiple end timer values held in the second ring buffer 1022 at a predetermined cycle.
[0045] In the above-described configuration, only one RAM 102 is used to store the measurement start timer value and the measurement end timer value, and there is no system capable of detecting a change in the RAM 102 being used. In other words, the RAM 102 built into the ECU 10 does not need to be divided into two or more. That is, according to the information processing system 1 of this embodiment, the calculation unit 105 can calculate the processing time of the measurement target program using the ECU 10, which is more versatile than conventional systems.
[0046] In this embodiment, the calculation unit 105 corrects the arrangement in the time direction of at least one of a plurality of start timer values sampled at a predetermined cycle and a plurality of end timer values sampled at a predetermined cycle.
[0047] If the calculation unit 105 does not change the data arrangement of the measurement start timer value buffered in the first ring buffer 1021 and the measurement end timer value buffered in the second ring buffer 1022, the data arrangement of the update data acquired by the calculation unit 105 by sampling the measurement start timer value and the measurement end timer value stored in the RAM 102 may not be aligned in a straight line if the sampling timing is delayed. If the data arrangement is not aligned in a straight line, the processing speed of the calculation unit 105 decreases.
[0048] On the other hand, the information processing system 1 of this embodiment corrects the arrangement in the time direction of at least one of a plurality of start timer values sampled at a predetermined cycle and a plurality of end timer values sampled at a predetermined cycle. Therefore, when the timing of sampling by the calculation unit 105 is delayed and the data arrangement of the update data is not aligned in a straight line, the information processing system 1 can correct the data arrangement to be aligned in a straight line, thereby improving the processing speed of the calculation unit 105.
[0049] Furthermore, in this embodiment, the calculation unit 105 corrects the arrangement in the time direction of the multiple start timer values sampled at a predetermined cycle so that the update cycle of the start timer values in each array in the first ring buffer 1021 becomes uniform. The calculation unit 105 corrects the arrangement in the time direction of the multiple end timer values sampled at a predetermined cycle so that the update cycle of the end timer values in each array in the second ring buffer 1022 becomes uniform.
[0050] In the data arrangement of the update data obtained by the calculation unit 105 by sampling the measurement start timer value and the measurement end timer value of the first ring buffer 1021 stored in the RAM 102, if there are two or more measurement start timer values that are updated at the same time, the processing speed of the calculation unit 105 will decrease.
[0051] However, in the information processing system 1 of this embodiment, the calculation unit 105 corrects the arrangement in the time direction of multiple start timer values sampled at a predetermined period so that the update periods of the start timer values in each arrangement in the first ring buffer 1021 become uniform. That is, the data arrangement of the update data in the first ring buffer 1021 rearranged and corrected by the calculation unit 105 is aligned diagonally in a straight line. Therefore, when the timing of sampling by the calculation unit 105 is delayed and the data arrangement of the update data is not aligned in a straight line, the information processing system 1 can perform a correction to rearrange the data arrangement in a straight line, thereby improving the processing speed of the calculation unit 105.
[0052] In this embodiment, the number of arrays in each of the first ring buffer 1021 and the second ring buffer 1022 can be changed depending on at least one of the sampling period of the calculation unit 105 and the processing speed of the program to be measured.
[0053] When sampling by the calculation unit 105, if the number of arrays in each of the first ring buffer 1021 and the second ring buffer 1022 is small compared to the sampling period and the execution speed of the program to be measured, there is a risk that part of the measurement start timer value or the measurement end timer value will be overwritten and updated.
[0054] However, in the information processing system 1 of this embodiment, the number of arrays in each of the first ring buffer 1021 and the second ring buffer 1022 can be changed according to at least one of the sampling period of the calculation unit 105 and the processing speed of the measurement target program. Therefore, the information processing system 1 can prevent a portion of the measurement start timer value or the measurement end timer value from being overwritten and updated, thereby improving the accuracy of analysis of the processing time of the measurement target program.
[0055] Although the embodiments of the present invention have been described above, the above-described embodiments are presented as examples and are not intended to limit the scope of the present invention. This novel embodiment can be embodied in various other forms. Furthermore, various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. Furthermore, this embodiment is included within the scope and spirit of the invention, and is also included in the inventions and their equivalents described in the claims. [Explanation of symbols]
[0056] 1. Information Processing Systems 10 ECU 101 MCU 102 RAM 105 Calculation Unit 1021 1st ring buffer 1022 Second ring buffer A1,A2,A3,A4,A5,A6,A7,A8 array T1,T2,T3,T4,T5,T6,T7,T8,T9 Time D1,D2 Measurement start timer value
Claims
1. a first processor that processes a measurement target program, measures a start timer value at a timing when the processing of the measurement target program starts, and measures an end timer value at a timing when the processing of the measurement target program ends; a first ring buffer that stores the measured start timer value; a second ring buffer that stores the measured end timer value; An information processing device comprising:
2. a first processor that processes a measurement target program, measures a start timer value at a timing when the processing of the measurement target program starts, and measures an end timer value at a timing when the processing of the measurement target program ends; a first ring buffer that stores the measured start timer value; a second ring buffer that stores the measured end timer value; a second processor that samples the plurality of start timer values held in the first ring buffer at a predetermined cycle and samples the plurality of end timer values held in the second ring buffer at the predetermined cycle; An information processing system comprising:
3. the second processor corrects an arrangement in the time direction of at least one of the plurality of start timer values sampled at the predetermined period and the plurality of end timer values sampled at the predetermined period; The information processing system according to claim 2 .
4. The second processor correcting an arrangement of the plurality of start timer values sampled at the predetermined period in the time direction so that the update period of the start timer value in each arrangement of the first ring buffer becomes uniform; correcting the arrangement of the plurality of end timer values sampled at the predetermined period in the time direction so that the update period of the end timer values in each arrangement of the second ring buffer becomes uniform; The information processing system according to claim 3 .
5. the number of arrays included in each of the first ring buffer and the second ring buffer is changeable according to at least one of a sampling period of the second processor and a processing speed of the measurement target program; 5. The information processing system according to claim 2.
Citation Information
Patent Citations
Information processor
JP2015148864A