JP7230511B2 - SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER - Google Patents
SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER Download PDFInfo
- Publication number
- JP7230511B2 JP7230511B2 JP2019001833A JP2019001833A JP7230511B2 JP 7230511 B2 JP7230511 B2 JP 7230511B2 JP 2019001833 A JP2019001833 A JP 2019001833A JP 2019001833 A JP2019001833 A JP 2019001833A JP 7230511 B2 JP7230511 B2 JP 7230511B2
- Authority
- JP
- Japan
- Prior art keywords
- execution
- interrupt
- software
- global variable
- load factor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Description
本発明は、電動車両のモータ駆動装置のように高速定周期でソフトウェアを動作させる制御装置においてソフトウェアの実行負荷率を測定する技術に関する。 The present invention relates to a technique for measuring an execution load factor of software in a control device that operates software in a high-speed periodic cycle, such as a motor drive device for an electric vehicle.
ソフトウェアの実行時間や単位時間当たりの実行時間である実行負荷率を測定する方法として、対象とするソフトウェアに属するタスクや割込み処理の実行開始時および終了時にCPU内蔵タイマのカウンタ値を記録し、開始時と終了時の差分から実行時間と実行負荷率を算出する技術が知られている。 As a method of measuring the execution time of software and the execution load factor, which is the execution time per unit time, the counter value of the CPU built-in timer is recorded at the start and end of execution of tasks and interrupts belonging to the target software, A technique for calculating the execution time and the execution load factor from the difference between the time and the end is known.
この技術において、対象とするソフトウェアに属するタスクや割込み処理の実行中、当該ソフトウェアに属さないタスクや割込み処理が優先的に実行される場合はそれらの実行時間を差し引く必要がある。 In this technique, when a task or interrupt process belonging to the target software is being executed, if a task or interrupt process not belonging to the software is preferentially executed, it is necessary to deduct the execution time of those tasks.
特許文献1に記載された制御装置におけるタスク等の実行時間測定方法では、測定対象より優先順位の高いタスクや割込み処理が多重に実行される場合、スタックを操作することでそれらの実行時間を差し引いている。
In the method of measuring the execution time of a task or the like in a control device described in
具体的には、制御装置がオペレーティングシステム用に備えたフリーランカウンタを利用し、タスクや割込み処理の開始時点でフリーランカウンタの時刻値を読み出してプッシュ操作によりスタックデータとして記憶しておき、終了時点のフリーランカウンタの時刻値とプル操作で呼び戻したスタックデータから各タスクや割込み処理の実行時間を算出している。 Specifically, the control device uses a free-running counter provided for the operating system, reads the time value of the free-running counter at the start of a task or interrupt processing, stores it as stack data by a push operation, and ends the operation. The execution time of each task and interrupt processing is calculated from the time value of the free-running counter at that time and the stack data recalled by the pull operation.
しかしながら特許文献1の方法には以下のような課題がある。
However, the method of
まず、各タスクや割込み処理の実行時間を算出する処理、および測定対象より高い優先順位で実行されたタスクや割込み処理の実行時間を差し引く処理自体に時間を要する。また、割込み処理の実行や実行時間の算出に伴う割込みマスクや符号付き演算といったスタック操作にさらに時間を要する。このため性能が低いCPUでは、ソフトウェアの実行と実行時間の測定に要する時間が、制御対象や制御内容で決まる許容時間を超過するおそれがある。 First, it takes time to calculate the execution time of each task and interrupt processing, and to subtract the execution time of tasks and interrupt processing executed at a higher priority than those to be measured. In addition, more time is required for stack operations such as interrupt masking and signed operations associated with execution of interrupt processing and calculation of execution time. For this reason, in a CPU with low performance, the time required for executing software and measuring the execution time may exceed the allowable time determined by the control target and control details.
次に、この方法では実行時間に測定時間が含まれることになる。電動車両のモータ駆動装置のように数百μs以下の高速定周期でソフトウェアを動作させる制御装置ではこれが無視できない誤差となり、実行時間から算出する実行負荷率にも大きな誤差が生じる。 The method then includes the measurement time in the execution time. In a control device such as a motor drive device for an electric vehicle that operates software at a high-speed constant cycle of several hundred microseconds or less, this error cannot be ignored, and a large error occurs in the execution load factor calculated from the execution time.
本発明は上記の課題を解決するためのものであり、実行負荷率測定用の処理を必要最小限にして所要時間を100ns以下程度に抑え、容易にかつ小さい誤差でソフトウェアの実行負荷率を測定する方法を提供する。 The present invention is intended to solve the above problems, and minimizes the processing for measuring the execution load factor, suppresses the required time to about 100 ns or less, and easily measures the execution load factor of software with small errors. provide a way to
Highレベル電圧もしくはLowレベル電圧が出力されるディジタル端子を有する制御装置において、優先順位の異なる複数の割込み処理と、いずれの割込み処理も実行されていないときに実行されるアイドリング処理と、から成るソフトウェアを実行したときに、各割込み処理の実行中にはディジタル端子にHighレベル電圧を、アイドリング処理の実行中にはLowレベル電圧を出力する。 Software consisting of a plurality of interrupt processes with different priorities and an idling process executed when none of the interrupt processes is executed in a control device having a digital terminal that outputs a high level voltage or a low level voltage. is executed, a High level voltage is output to the digital terminal during execution of each interrupt process, and a Low level voltage is output during execution of the idling process.
このディジタル端子の電圧をオシロスコープやメモリハイコーダ等の機器で測定し、所定の期間における平均電圧とHighレベル電圧との比率、もしくは所定の期間においてHighレベル電圧が出力されていた期間の割合を算出することで、ソフトウェアの実行負荷率を求めることができる。 The voltage of this digital terminal is measured with a device such as an oscilloscope or a memory HiCorder, and the ratio between the average voltage and the high level voltage in a predetermined period, or the ratio of the period during which the high level voltage is output in the predetermined period is calculated. By doing so, the execution load factor of the software can be obtained.
割込み処理単位での実行負荷率を測定する場合には、測定対象の割込み処理開始時にディジタル端子にHighレベル電圧を、終了時にLowレベル電圧を出力するとともに、測定対象外の割込み処理開始時にLowレベル電圧を、終了時に測定対象の割込み処理が発生中かつ測定対象の割込み処理より優先順位の高い割込み処理が発生中でない場合にHighレベル電圧を出力し、上記と同様にディジタル端子の電圧を測定することで、対象とした割込み処理の実行負荷率を求めることができる。 When measuring the execution load factor for each interrupt process, a high level voltage is output to the digital terminal at the start of the interrupt process to be measured, and a low level voltage is output at the end of the process. At the end of the measurement, when the interrupt process to be measured is occurring and the interrupt process with higher priority than the interrupt process to be measured is not occurring, a high level voltage is output, and the voltage of the digital terminal is measured in the same manner as above. Thus, the execution load factor of the target interrupt process can be obtained.
また、ソフトウェアにグローバル変数を設け、上記のディジタル端子,Highレベル電圧,Lowレベル電圧をそれぞれグローバル変数,“1”,“0”に置き換えた処理を実行してグローバル変数の状態をRAMモニタ等の機器で計測することでもソフトウェアや割込み処理の実行負荷率を求めることができる。 Further, global variables are provided in software, and processing is executed by replacing the above-mentioned digital terminal, High level voltage, and Low level voltage with global variables "1" and "0", respectively, and the state of the global variables is monitored by a RAM monitor or the like. The execution load factor of software and interrupt processing can also be obtained by measuring with equipment.
本発明によれば、優先順位の異なる複数の割込み処理から成るソフトウェアを高速定周期で動作させる制御装置において、ソフトウェアやこれを構成する割込み処理の実行負荷率測定処理を必要最小限とすることができ、測定に要する時間が短く、誤差の小さい実行負荷率測定が可能となる。 According to the present invention, in a control device that operates software consisting of a plurality of interrupt processes with different priorities in a high-speed fixed cycle, it is possible to minimize the execution load factor measurement processing of the software and the interrupt processes that constitute the software. Therefore, it is possible to measure the effective load factor in a short time and with a small error.
以下、図を参照して発明の実施形態について説明する。
[システムおよびソフトウェア構成]
図1は本発明の方法でソフトウェアの実行時間および実行負荷率を測定するシステムの構成例である。試験装置10,駆動装置20,モータ30,測定器40から成る。
Embodiments of the invention will be described below with reference to the drawings.
[System and software configuration]
FIG. 1 shows an example of the configuration of a system for measuring the execution time and execution load factor of software according to the method of the present invention. It consists of a
試験装置10はツイストペア等の通信用のケーブルで駆動装置20と接続され、駆動装置20に指令を与える。駆動装置20は試験装置10からの指令に応じてモータ30を制御する制御装置であって、モータ30に指令を与えるとともに、試験装置10に指令の実行結果や自身およびモータ30の状態等を応答として返す。モータ30に駆動力を供給する電源や電力変換装置、モータ30の電流や回転状態を検出する機器は図示を省略している。測定器40は駆動装置20が有するディジタル端子やメモリの状態を駆動装置20のI/Oポートを通じて計測するもので、具体的にはオシロスコープ,メモリハイコーダ,RAMモニタ等を使用する。
The
図2は駆動装置20で動作するソフトウェア(以下、制御プログラムと呼ぶ)の構成例である。制御プログラムは割込み処理A(201),割込み処理B(202),割込み処理C(203),アイドリング処理204から成る。
FIG. 2 is a configuration example of software (hereinafter referred to as a control program) that operates in the
割込み処理の優先順位は割込み処理A(201)>割込み処理B(202)>割込み処理C(203)で、いずれの割込み処理も実行されていない時はアイドリング処理204が実行される。各処理の機能は本発明の実行負荷率測定とは関係ないため説明を省略する。
The priority of interrupt processing is interrupt processing A (201)>interrupt processing B (202)>interrupt processing C (203), and when none of the interrupt processing is being executed,
図1のシステム構成および図2の制御プログラム構成において、実行負荷率測定用の処理として駆動装置20は割込み処理A(201),割込み処理B(202),割込み処理C(203),アイドリング処理204の実行状態に応じてディジタル端子にHighレベル電圧もしくはLowレベル電圧を出力する。 In the system configuration shown in FIG. 1 and the control program configuration shown in FIG. A high level voltage or a low level voltage is output to a digital terminal according to the execution state of .
出力された電圧は逆レベルの電圧(Highレベル電圧に対するLowレベル電圧、Lowレベル電圧に対するHighレベル電圧)が出力されるまで保持される。このような機構はフリップフロップ回路やこれを内蔵したロジックICにより容易にかつ安価で実現することができる。 The output voltage is held until the opposite level voltage (Low level voltage for High level voltage, High level voltage for Low level voltage) is output. Such a mechanism can be easily and inexpensively realized by a flip-flop circuit or a logic IC incorporating the flip-flop circuit.
なお、以下ではHighレベル電圧およびLowレベル電圧をそれぞれ単にHighおよびLowとも書き、ディジタル端子出力電圧をディジタル端子出力信号もしくはディジタル端子出力状態とも呼ぶ。
[第1実施形態]
第1実施形態では図2に示した制御プログラム全体を測定対象とする。
In the following description, the High level voltage and Low level voltage are also simply referred to as High and Low, respectively, and the digital terminal output voltage is also referred to as a digital terminal output signal or a digital terminal output state.
[First embodiment]
In the first embodiment, the entire control program shown in FIG. 2 is to be measured.
実行負荷率測定用の処理として、割込み処理A(201),割込み処理B(202),割込み処理C(203)それぞれの開始時にディジタル端子にHighレベル電圧を、アイドリング処理204の開始時にLowレベル電圧を出力する。
As a process for measuring the execution load factor, a High level voltage is applied to the digital terminal at the start of each of the interrupt process A (201), the interrupt process B (202), and the interrupt process C (203), and a Low level voltage is applied at the start of the
図3は制御プログラムの動作例と、これに第1実施形態を適用したときのディジタル端子出力信号のタイミングチャートである。以下、図中の丸囲み数字を括弧つき数字で表す。 FIG. 3 is an operation example of the control program and a timing chart of digital terminal output signals when the first embodiment is applied to this. In the following, numbers enclosed in circles in the drawings are represented by numbers in parentheses.
割込み処理A(301)が開始された(1)の時点でディジタル端子出力信号305をLowからHighにする。続いて割込み処理B(302),割込み処理C(303),割込み処理A(301),割込み処理C(303)が順に実行される。
The digital
割込み処理C(303)が終了した(2)の時点でいずれの割込み処理も実行されておらずアイドリング処理304が開始されるので、ディジタル端子出力信号305をHighからLowにする。(1)-(2)の期間をT1とする。
Since the
同様に、いずれかの割込み処理が実行されている(3)-(4),(5)-(6),(7)-(8)の期間をそれぞれT2,T3,T4とする。(1)-(9)の期間を測定期間とし、その長さを全体時間Tallとする。 Similarly, the periods (3)-(4), (5)-(6), and (7)-(8) during which any interrupt process is executed are T2, T3, and T4, respectively. The period from (1) to (9) is the measurement period, and its length is the total time Tall.
測定期間(1)-(9)における制御プログラムの実行負荷率は、割込み処理時間の合計をTsum=T1+T2+T3+T4とするとTsum÷Tall×100%である。 The execution load factor of the control program in the measurement period (1)-(9) is Tsum÷Tall×100%, where Tsum=T1+T2+T3+T4 is the total interrupt processing time.
このときディジタル端子の平均電圧VAは、Highレベル電圧をVH、Lowレベル電圧をVLとするとVA=(VH-VL)×Tsum÷Tallであるから、オシロスコープ等の測定器でこれを測定すればVA÷(VH-VL)×100%により実行負荷率を算出することができる。 At this time, the average voltage VA of the digital terminal is VA = (VH - VL) × Tsum ÷ Tall, where VH is the High level voltage and VL is the Low level voltage. The effective load factor can be calculated by ÷(VH−VL)×100%.
例えば図4のようなディジタル端子出力信号でHighレベル電圧が5.0V、Lowレベル電圧が0.0Vの場合、平均電圧を測定すると3.75Vとなる。この平均電圧から制御プログラムの実行負荷率を算出すると3.75V÷(5.0V-0.0V)×100%=75%となる。
[第2実施形態]
第2実施形態では制御プログラムを構成する処理のうち特定の割込み処理を測定対象とする。
For example, if the digital terminal output signal as shown in FIG. 4 has a High level voltage of 5.0V and a Low level voltage of 0.0V, the measured average voltage is 3.75V. When the execution load factor of the control program is calculated from this average voltage, it becomes 3.75V/(5.0V-0.0V)×100%=75%.
[Second embodiment]
In the second embodiment, a specific interrupt process among the processes constituting the control program is to be measured.
実行負荷率測定用の処理として、測定対象の割込み処理開始時にディジタル端子にHighレベル電圧を、終了時にLowレベル電圧を出力するとともに、測定対象外の割込み処理開始時にLowレベル電圧を、終了時に測定対象の割込み処理が発生中(開始後かつ終了前)かつ測定対象の割込み処理より優先順位の高い割込み処理が発生中でない場合Highレベル電圧を出力する。アイドリング処理開始時にはディジタル端子にLowレベル電圧を出力する。 As a process for measuring the execution load factor, a high level voltage is output to the digital terminal at the start of the interrupt processing to be measured, and a low level voltage is output at the end of the interrupt processing. A high level voltage is output when the target interrupt process is occurring (after the start and before the end) and no interrupt process with a higher priority than the measurement target interrupt process is occurring. At the start of the idling process, a Low level voltage is output to the digital terminal.
図5は、図2に示した制御プログラムに割込み処理D(404)を追加した制御プログラムの動作例と、これに第2実施形態を適用したときのディジタル端子出力信号のタイミングチャートである。 FIG. 5 is an operation example of a control program obtained by adding interrupt processing D (404) to the control program shown in FIG. 2, and a timing chart of digital terminal output signals when the second embodiment is applied to this.
割込み処理の優先順位は割込み処理A(401)>割込み処理B(402)>割込み処理C(403)>割込み処理D(404)で、いずれの割込み処理も実行されていない時はアイドリング処理204が実行される。
[第2実施形態:割込み処理Bを測定対象とした場合]
割込み処理B(402)を測定対象とした場合、割込み処理B(402)が開始された(3),(10),(15)の時点でディジタル端子出力信号406をHighに、終了した(4),(11),(18)の時点でLowにするとともに、測定対象外の割込み処理A(401),C(403),D(404)が開始された(1),(2),(4),(5),(9),(11),(12),(16)の時点でディジタル端子出力信号406をLowに、終了した(3),(6),(7),(8),(10),(13),(14),(17)の時点で割込み処理B(402)が発生中の場合ディジタル端子出力信号406をHighにする。
The priority of interrupt processing is interrupt processing A (401)>interrupt processing B (402)>interrupt processing C (403)>interrupt processing D (404). executed.
[Second embodiment: When interrupt processing B is the object of measurement]
When the interrupt process B (402) is to be measured, the digital
(3)-(4)および(10)-(11)の期間には割込み処理B(402)の実行中にこれより優先順位の高い割込み処理が発生していない。このため当該期間がそのままディジタル端子出力信号406がHighの期間となる。
During periods (3)-(4) and (10)-(11), no interrupt process with a higher priority occurs during the execution of interrupt process B (402). Therefore, this period is the period in which the digital
(15)-(18)の期間には割込み処理B(402)より優先順位の高い割込み処理A(401)が発生している。そこで、割込み処理A(401)が開始された(16)の時点でディジタル端子出力信号406をLowにし、終了した(17)の時点では割込み処理Bが発生中のためディジタル端子出力信号406をHighにする。すると(15)-(18)の期間のうち(15)-(16)および(17)-(18)の期間でディジタル端子出力信号406がHighになる。
During the period from (15) to (18), interrupt process A (401) having a higher priority than interrupt process B (402) occurs. Therefore, the digital
ここで(3)-(4),(10)-(11),(15)-(16),(17)-(18)の期間をそれぞれTb1,Tb2,Tb3,Tb4とする。(1)-(19)の期間を測定期間とし、その長さを全体時間Tallとする。 Here, the periods (3)-(4), (10)-(11), (15)-(16), and (17)-(18) are Tb1, Tb2, Tb3, and Tb4, respectively. Let the period (1)-(19) be the measurement period, and let its length be the total time Tall.
測定期間(1)-(19)における割込み処理B(402)の実行負荷率は、割込み処理時間の合計をTsum=Tb1+Tb2+Tb3+Tb4とするとTsum÷Tall×100%であり、これは第1実施形態と同様にディジタル端子の平均電圧の測定値から算出することができる。
[第2実施形態:割込み処理Dを測定対象とした場合]
割込み処理D(404)を測定対象とした場合、割込み処理D(404)が開始された(1)の時点でディジタル端子出力信号407をHighに、終了した(8)の時点でLowにするとともに、測定対象外の割込み処理A(401),B(402),C(403)が開始された(2),(3),(4),(5),(9),(10),(11),(12),(15),(16)の時点でディジタル端子出力信号407をLowに、終了した(3),(4),(6),(7),(10),(11),(13),(14),(17),(18)の時点で割込み処理D(404)が発生中かつこれより優先順位の高い割込み処理が発生中でない場合ディジタル端子出力信号407をHighにする。
The execution load factor of the interrupt process B (402) in the measurement period (1)-(19) is Tsum/Tall×100% where Tsum=Tb1+Tb2+Tb3+Tb4, which is the total interrupt process time, which is the same as in the first embodiment. can be calculated from the measured value of the average voltage at the digital terminals.
[Second embodiment: When interrupt process D is measured]
When the interrupt process D (404) is to be measured, the digital
(1)-(8)の期間には割込み処理D(404)より優先順位の高い割込み処理A(401),B(402),C(403)が発生している。 During the period from (1) to (8), interrupt processes A (401), B (402), and C (403) with higher priority than interrupt process D (404) occur.
そこでまず、割込み処理A(401)が開始された(2)の時点でディジタル端子出力信号407をHighからLowにする。割込み処理A(401)が終了した(3)の時点では測定対象である割込み処理D(404)が実行中であるが、割込み処理A(401)の実行中に順番待ちとなった割込み処理B(402)が続けて開始されるためディジタル端子出力信号407はLowのままとなる。割込み処理B(402)が終了して割込み処理C(403)が開始される(4)の時点も同様で、(2)-(4)の期間においてディジタル端子出力信号407はLowに保たれることになる。
Therefore, first, the digital
続いて、再び割込み処理A(401)が開始された(5)の時点でもディジタル端子出力信号407はLowのままとなる。割込み処理A(401)が終了した(6)の時点では依然として測定対象の割込み処理D(404)が実行中であるが、これより優先順位の高い割込み処理C(403)が実行中のためディジタル端子出力信号407はLowのままとなる。割込み処理C(403)が終了した(7)の時点では測定対象の割込み処理D(404)が実行中かつこれより優先順位の高い割込み処理は実行中でないためディジタル端子出力信号407をLowからHighにする。
Subsequently, the digital
その後、割込み処理D(404)が再開され、終了した(8)の時点でディジタル端子出力信号をHighからLowにする。これ以降は割込み処理D(404)が実行されないためディジタル端子出力信号はLowに保たれる。 After that, the interrupt process D (404) is resumed, and at the time of completion (8), the digital terminal output signal is changed from High to Low. Since the interrupt process D (404) is not executed thereafter, the digital terminal output signal is kept Low.
従って(1)-(19)の期間のうち(1)-(2)および(7)-(8)の期間でディジタル端子出力信号407がHighになる。
Therefore, the digital
ここで(1)-(2)および(7)-(8)の期間をそれぞれTd1およびTd2とする。(1)-(19)の期間を測定期間とし、その長さを全体時間Tallとする。 Let the periods (1)-(2) and (7)-(8) be Td1 and Td2, respectively. Let the period (1)-(19) be the measurement period, and let its length be the total time Tall.
測定期間(1)-(19)における割込み処理D(404)の実行負荷率は、割込み処理時間の合計をTsum=Td1+Td2とするとTsum÷Tall×100%であり、これも第1実施形態と同様にディジタル端子の平均電圧の測定値から算出することができる。 The execution load factor of the interrupt process D (404) in the measurement period (1)-(19) is Tsum/Tall×100% where Tsum=Td1+Td2 is the total interrupt process time, which is also the same as in the first embodiment. can be calculated from the measured value of the average voltage at the digital terminals.
上記のように各割込み処理の実行状態に応じてディジタル端子への出力を変える処理は、制御プログラムに割込み処理実行状態変数を設けることで実現することができる。 The process of changing the output to the digital terminal according to the execution state of each interrupt process as described above can be realized by providing an interrupt process execution state variable in the control program.
各割込み処理ごとに実行状態を示す割込み処理実行状態変数を設け、割込み処理開始時に割込み処理実行状態変数をON(実行中)にし、終了時にOFF(実行中でない)にする。割込み処理実行状態=ONは実行再開待ち状態を含み、割込み処理を開始してから終了するまでの期間とする。 An interrupt processing execution state variable indicating the execution state is provided for each interrupt processing, and the interrupt processing execution state variable is turned ON (in execution) at the start of interrupt processing and turned OFF (not in execution) at the end. The interrupt processing execution state=ON includes the execution restart waiting state, and is the period from the start of the interrupt processing to the end thereof.
図6は図5における各割込み処理の割込み処理実行状態変数およびディジタル端子出力状態の推移を示したものである。 FIG. 6 shows the transition of the interrupt processing execution state variables and the digital terminal output state for each interrupt processing in FIG.
例えば第2実施形態で割込み処理D(404)を測定対象とした場合の(4)から(7)の期間では、割込み処理B(402)が終了した(4)の時点で他の割込み処理の実行状態変数を参照すると測定対象である割込み処理D(404)の実行状態変数はONであるがこれより優先順位の高い割込み処理C(403)の実行状態変数がONのためディジタル端子への出力はLowとなり、割込み処理A(401)が終了した(6)の時点では依然として測定対象の割込み処理D(404)の実行状態変数はONであるがこれより優先順位の高い割込み処理C(403)の実行状態変数がONのためディジタル端子への出力はやはりLowとなる。割込み処理C(403)が終了した(7)の時点で測定対象の割込み処理D(404)の実行状態変数がONかつこれより優先順位の高い割込み処理A(401),B(402),C(403)の実行状態変数がいずれもONでないためディジタル端子への出力はHighとなる。 For example, in the period from (4) to (7) when the interrupt process D (404) is to be measured in the second embodiment, when the interrupt process B (402) ends at (4), another interrupt process is started. When referring to the execution state variables, the execution state variable of the interrupt process D (404) to be measured is ON. becomes Low, and at the time (6) when the interrupt process A (401) ends, the execution state variable of the interrupt process D (404) to be measured is still ON, but the interrupt process C (403), which has a higher priority than this, is ON. is ON, the output to the digital terminal is also Low. When the interrupt process C (403) ends (7), the execution state variable of the interrupt process D (404) to be measured is ON, and the interrupt processes A (401), B (402), and C with higher priority than this. Since none of the execution state variables of (403) is ON, the output to the digital terminal is High.
このような処理はデータの比較と出力のみから成っており課題で挙げたような複雑な演算を必要としないため、所要時間を100ns以下程度に抑えることができる。
[第1実施形態および第2実施形態の応用]
第1実施形態および第2実施形態において、測定モードを記憶する変数を制御プログラムに設けることで、第1実施形態のように制御プログラム全体の実行負荷率を測定するモードと第2実施形態のように割込み処理単位での実行負荷率を測定するモードを試験装置10から指定できるようにしてもよい。
Since such processing consists only of data comparison and output, and does not require complicated calculations such as those mentioned in the subject, the required time can be suppressed to about 100 ns or less.
[Application of the first and second embodiments]
In the first and second embodiments, by providing the control program with a variable for storing the measurement mode, the mode for measuring the execution load factor of the entire control program as in the first embodiment and the mode for measuring the execution load factor of the entire control program as in the second embodiment. Alternatively, the
また第2実施形態において、各割込み処理を区別する識別子を定義しておき、測定対象とする割込み処理の識別子を記憶する変数を制御プログラムに設けることで、測定対象とする割込み処理を試験装置10から指定できるようにしてもよい。 In the second embodiment, an identifier for distinguishing each interrupt process is defined, and a variable for storing the identifier of the interrupt process to be measured is provided in the control program. can be specified from
このほか第1実施形態および/もしくは第2実施形態において、ディジタル端子を複数設けておき、制御プログラム全体を測定対象とした処理および割込み処理のいずれかを測定対象とした処理のうち複数の処理を各割込み処理の開始時および終了時に実施して、各処理の出力を複数のディジタル端子に割り付けるようにしてもよい。
[第3実施形態]
第3実施形態ではディジタル端子に代えて制御プログラムに設けたグローバル変数を用いる。
In addition, in the first embodiment and/or the second embodiment, a plurality of digital terminals are provided, and a plurality of processing out of the processing for measuring the entire control program and the processing for measuring any of the interrupt processing is performed. It may be performed at the start and end of each interrupt process to allocate the output of each process to a plurality of digital terminals.
[Third Embodiment]
In the third embodiment, global variables provided in the control program are used instead of digital terminals.
制御プログラムにグローバル変数を設け、第1実施形態および第2実施形態のディジタル端子,Highレベル電圧,Lowレベル電圧をそれぞれグローバル変数,“1”,“0”に置き換えた処理を実行する。 A global variable is provided in the control program, and processing is executed by replacing the digital terminal, High level voltage, and Low level voltage of the first and second embodiments with the global variables "1" and "0", respectively.
このグローバル変数の状態をRAMモニタ等の機器を用いて定周期でサンプリングすると、グローバル変数が“1”であった回数から測定対象の割込み処理時間がわかり、これより実行負荷率を算出することができる。 If the state of this global variable is periodically sampled using a device such as a RAM monitor, the interrupt processing time to be measured can be found from the number of times the global variable is "1", and the execution load factor can be calculated from this. can.
例えば第1実施形態でディジタル端子出力信号が図4のようになる制御プログラムを実行した場合、本実施形態ではTsum=T1+T2+T3+T4+T5=15msとTall=20msがわかり、これより実行負荷率は15ms÷20ms×100%=75%と算出される。 For example, in the first embodiment, when a control program is executed in which the digital terminal output signal is as shown in FIG. It is calculated as 100%=75%.
この方法を第1実施形態や第2実施形態と併用して算出結果を突き合わせることで実行負荷率測定の精度を上げることができる。また、この方法を単独で用いればディジタル端子やディジタル端子への電圧出力手段が無くても実行負荷率を測定することができる。 By using this method together with the first embodiment and the second embodiment and comparing the calculation results, the accuracy of the effective load factor measurement can be improved. Also, if this method is used alone, the effective load factor can be measured without a digital terminal or voltage output means for the digital terminal.
10 試験装置
20 駆動装置
30 モータ
40 測定器
201,301 割込み処理A
202,302 割込み処理B
203,303 割込み処理C
204,304 アイドリング処理
401 割込み処理A
402 割込み処理B
403 割込み処理C
404 割込み処理D
405 アイドリング処理
305,406,407 ディジタル端子出力信号
10
202, 302 Interrupt processing B
203, 303 Interrupt processing C
204, 304
402 Interrupt processing B
403 Interrupt processing C
404 Interrupt processing D
405
Claims (3)
優先順位の異なる複数割り込み処理と、いずれの前記割り込み処理も実行されていないときに実行されるアイドリング処理と、から成るソフトウェアを実行したときに、
前記各割り込み処理の実行状態に応じて前記ディジタル端子にHighレベル電圧もしくはLowレベル電圧を出力するとともに、
前記アイドリング処理の実行状態に応じて前記ディジタル端子にHighレベル電圧もしくはLowレベル電圧を出力し、
前記ソフトウェアにグローバル変数を設け、
前記各割り込み処理の実行状態に応じて前記グローバル変数に“1”もしくは“0”を出力し、
前記アイドリング処理の実行状態に応じて前記グローバル変数に“1”もしくは“0”を出力し、
前記ディジタル端子の電圧測定値及び前記グローバル変数を定周期でサンプリングすることにより前記ソフトウェアもしくは前記各割り込み処理の実行負荷率を算出する、
ソフトウェアの実行負荷率測定方法。 In a control device having a digital terminal that outputs a High level voltage or a Low level voltage,
When executing software consisting of multiple interrupt processes with different priorities and idling process executed when none of the interrupt processes is executed,
Outputting a High level voltage or a Low level voltage to the digital terminal according to the execution state of each interrupt process,
outputting a High level voltage or a Low level voltage to the digital terminal according to the execution state of the idling process;
providing a global variable in the software;
outputting "1" or "0" to the global variable according to the execution state of each of the interrupt processes;
outputting "1" or "0" to the global variable according to the execution state of the idling process;
calculating an execution load factor of the software or each of the interrupt processes by periodically sampling the voltage measurement value of the digital terminal and the global variable ;
Software execution load rate measurement method.
前記各割り込み処理の実行中には前記グローバル変数に“1”を出力し、
前記アイドリング処理の実行中には前記グローバル変数に“0”を出力し、
所定の期間において前記グローバル変数に“1”が出力されていた期間の長さから前記ソフトウェアの実行負荷率を算出する、
ソフトウェアの実行負荷率測定方法。 A software execution load factor measuring method according to claim 1 ,
outputting "1" to the global variable during execution of each of the interrupt processes;
outputting "0" to the global variable during execution of the idling process;
calculating the execution load factor of the software from the length of the period during which "1" was output to the global variable in a predetermined period;
Software execution load rate measurement method.
前記複数割り込み処理のうち一つの割り込み処理を測定対象とし、
測定対象の割り込み処理時間開始時に前記グローバル変数に“1”を出力してこれを保持し、終了時に前記グローバル変数に“0”を出力するとともに、
測定対象外の割り込み処理時間開始時に前記グローバル変数に“0”を出力してこれを保持し、終了時に前記測定対象の割り込み処理が発生中かつ前記測定対象の割り込み処理より優先順位の高い割り込み処理が発生中でない場合に前記グローバル変数に“1”を出力して、
所定の期間において前記グローバル変数に“1”が出力されていた期間の長さから前記ソフトウェアの実行負荷率を算出する、
ソフトウェアの実行負荷率測定方法。
A software execution load factor measuring method according to claim 1 ,
Measuring one interrupt process among the plurality of interrupt processes,
Outputting "1" to the global variable at the start of the interrupt processing time to be measured and holding it, and outputting "0" to the global variable at the end,
At the start of the interrupt processing time not subject to measurement, outputting "0" to the global variable and holding it, and at the end of the time, the interrupt processing to be measured is occurring and has a higher priority than the interrupt processing to be measured. is not occurring, outputting "1" to the global variable,
calculating the execution load factor of the software from the length of the period during which "1" was output to the global variable in a predetermined period;
Software execution load rate measurement method.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019001833A JP7230511B2 (en) | 2019-01-09 | 2019-01-09 | SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019001833A JP7230511B2 (en) | 2019-01-09 | 2019-01-09 | SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2020112918A JP2020112918A (en) | 2020-07-27 |
| JP7230511B2 true JP7230511B2 (en) | 2023-03-01 |
Family
ID=71667984
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2019001833A Active JP7230511B2 (en) | 2019-01-09 | 2019-01-09 | SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP7230511B2 (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008097093A (en) | 2006-10-06 | 2008-04-24 | Nec Electronics Corp | Processor system and communication device |
| JP2010244376A (en) | 2009-04-08 | 2010-10-28 | Fujitsu Ten Ltd | Software development device, and debugging method using the same |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS59116864A (en) * | 1982-12-22 | 1984-07-05 | Fujitsu Ltd | Measurement system for use rate of central processing unit |
-
2019
- 2019-01-09 JP JP2019001833A patent/JP7230511B2/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2008097093A (en) | 2006-10-06 | 2008-04-24 | Nec Electronics Corp | Processor system and communication device |
| JP2010244376A (en) | 2009-04-08 | 2010-10-28 | Fujitsu Ten Ltd | Software development device, and debugging method using the same |
Also Published As
| Publication number | Publication date |
|---|---|
| JP2020112918A (en) | 2020-07-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP2533114B1 (en) | Controller support device, controller support program to be executed in said device, recording medium storing said program, and method for estimating execution duration of control program | |
| CN113721144A (en) | Motor aging test method and device, storage medium and electronic equipment | |
| JP2015005189A (en) | Ecu evaluation device, computer program, and ecu evaluation method | |
| CN103164321A (en) | Occupancy rate measuring method and device of central processing unit | |
| JP5035997B2 (en) | A / D converter | |
| JP7230511B2 (en) | SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER | |
| JP5982845B2 (en) | Trace control apparatus and trace control method | |
| JP7004911B2 (en) | Information processing equipment, processor, and optical fiber inspection method | |
| JP6522550B2 (en) | Electronic control unit | |
| US20110264830A1 (en) | Measuring Direct Memory Access Throughput | |
| EP2788865B1 (en) | Method, device and computer program product for measuring user perception quality of a processing system comprising a user interface | |
| JP5962860B2 (en) | Monitoring method and computer apparatus | |
| JP6075234B2 (en) | Measuring method and computer apparatus | |
| CN118249698B (en) | Double-encoder motor position setting and motor control method and device and motor | |
| KR100207926B1 (en) | Pulse width measuring method and its apparatus | |
| CN118035059B (en) | Performance test method and device for real-time operating system | |
| JP7620146B1 (en) | Data processing device and data processing program | |
| CN116149968B (en) | Chip timer diagnostic method and device | |
| JP5092984B2 (en) | Semiconductor test equipment | |
| CN118584895A (en) | Servo function testing method, device, equipment and computer storage medium | |
| CN107799041B (en) | Screen refresh time testing method and device | |
| JP2008101921A (en) | Semiconductor test equipment | |
| JP6505482B2 (en) | Electronic control unit | |
| JPS6248866B2 (en) | ||
| US20190162810A1 (en) | Monitoring system and monitoring method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20211214 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20220920 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20221011 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20221209 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20230117 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230130 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 7230511 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |