JPH0635727A - Cpu load factor calculating method - Google Patents

Cpu load factor calculating method

Info

Publication number
JPH0635727A
JPH0635727A JP4212147A JP21214792A JPH0635727A JP H0635727 A JPH0635727 A JP H0635727A JP 4212147 A JP4212147 A JP 4212147A JP 21214792 A JP21214792 A JP 21214792A JP H0635727 A JPH0635727 A JP H0635727A
Authority
JP
Japan
Prior art keywords
load factor
value
cpu
interrupt
processing
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.)
Pending
Application number
JP4212147A
Other languages
Japanese (ja)
Inventor
Wataru Matsumoto
渉 松本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Signal Co Ltd
Original Assignee
Nippon Signal Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nippon Signal Co Ltd filed Critical Nippon Signal Co Ltd
Priority to JP4212147A priority Critical patent/JPH0635727A/en
Publication of JPH0635727A publication Critical patent/JPH0635727A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To properly operate a control system by always calculating and using the CPU load factor of the control system by a software processing without using an outside tool or device. CONSTITUTION:A time required for the repetition of the least significant processing corresponding to an idle state is successively added to the first held value Ta stored in the prescribed address of an RAM 3, and an idle time is integrated by a CPU 1. And also, a prescribed cycle is successively added to the second held value (tb) by one of interruption processings by a timer interruption controlled by an interruption controller 4, and the lapse of time is integrated. Then, the second held value (tb) is compared with a load factor calculation cycle value, the load factor is calculated as (tb-ta)/tb, and the first held value (ta) and the second held value (tb) are initialized to a numeric value 0 for the next calculation. Therefore, the CPU load factor can be successively searched in each almost set load factor calculation cycle.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、マイクロプロセツサ
(CPU)に対する割込み制御を用いて構成された、C
PUを用いたマルチジョブ制御システムにおいて、CP
Uが割込みにより稼動している状態(割合)を示すCP
U負荷率を算出する方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention comprises a C, which is constructed by using interrupt control for a microprocessor (CPU).
In a multi-job control system using PU, CP
CP indicating the state (percentage) that U is operating due to an interrupt
The present invention relates to a method of calculating a U load factor.

【0002】[0002]

【従来の技術】マイクロプロセツサ(以下CPUとも記
述する)を用いた多様な制御機器が各種分野にて使用さ
れているが、中にCPUに対するハードウェア割込みを
使用して複数の処理を行うように構成された制御システ
ムも数多く使われている。この様な、割込みを用いた制
御システムの構成の一例を図4に示す。
2. Description of the Related Art Various control devices using a microprocessor (hereinafter also referred to as a CPU) are used in various fields, but a hardware interrupt to the CPU is used to perform a plurality of processes. There are also many control systems configured in. FIG. 4 shows an example of the configuration of a control system using such an interrupt.

【0003】図4に示す例は交通信号制御に用いて好適
な制御システム10で、その制御部は、CPU(符号
1)、このCPU1にバス結合されたプログラムや定数
を記憶したROM2及びワークエリアとなるRAM3、
前記CPU1に割込み制御をかける割込みコントローラ
4、この割込みコントローラ4にタイマー割込み信号を
入力するとともにCPU1にクロック信号を供給するタ
イマー回路5を含んでおり、更に前記CPU1にはI/
O回路6がバス結合されている。
The example shown in FIG. 4 is a control system 10 suitable for use in traffic signal control, the control unit of which is a CPU (reference numeral 1), a ROM 2 for storing programs and constants bus-coupled to the CPU 1 and a work area. RAM3, which becomes
The CPU 1 includes an interrupt controller 4 for performing interrupt control on the CPU 1, and a timer circuit 5 for inputting a timer interrupt signal to the interrupt controller 4 and supplying a clock signal to the CPU 1.
The O circuit 6 is bus-coupled.

【0004】このI/O回路6には、外部のセンサーや
アクチュエータ7が接続されている。また、前記割込み
コントローラ4には、外部の操作盤(図示せず)からの
出力や信号機の歩行者用押ボタン(図示せず)の信号が
割込み信号として入力されている。なお、同じくI/O
回路6に接続された20は、7セグメント表示器で、制
御システムの状態を外部から知るために用いたり、後述
する本願発明により算出されたCPU負荷率を常時ある
いは要求に応じて外部に数値で表示するために用いる。
External sensors and actuators 7 are connected to the I / O circuit 6. Further, an output from an external operation panel (not shown) and a signal of a pedestrian push button (not shown) of a traffic signal are input to the interrupt controller 4 as interrupt signals. In addition, I / O
Reference numeral 20 connected to the circuit 6 is a 7-segment display, which is used for knowing the state of the control system from the outside, or the CPU load factor calculated by the invention of the present application described later is constantly or numerically given externally in response to a request. Used to display.

【0005】上述システムは、割込みにより制御され例
えば図2に表として示すように主としてJ′0 〜J′4
の複数の割込みによるジョブ(以下、主要処理と記述す
る)を行い、これらのジョブの要求がないときにはアイ
ドル状態、即ち優先度が最下位の処理J′5 (以下、最
下位処理と記述する)を行っている。
[0005] The above described system is primarily J to be controlled by an interrupt for example 2, as shown as a table '0 through J' 4
Job by a plurality of interrupt (hereinafter, main processing and describes) performs idle when there is no demand for these job status, i.e. priority lowest processing J '5 (hereinafter, referred to as the least significant process) It is carried out.

【0006】前記主要割込処理(J′0 〜J′4 )は、
いづれも最下位処理J′5 に優先しており、各処理同士
はデイジーチェーン接続の関係にあり各主要処理の相互
間の切り替わりは全て割込みによって行われていて、図
2の表に示す様な優先度が設けられて割込みコントロー
ラ4により各処理の切換えが行われている。例えば、パ
ネルからの操作入力を処理する処理J′4 は5番目の優
先度を持ち、200ms周期のタイマー割込みで処理を
開始するが、優先度のより高い処理が行われている場合
には、その開始は抑制され上位の処理が終了するのを待
って開始される。また、処理実行中であっても優先度が
より高い例えばJ′2 に対応する割込みが発生した場合
には処理は中断され制御は優先度の高い処理J′2 に移
る。
The main interrupt processing (J ' 0 to J' 4 ) is
Izure also in preference to the lowest process J '5, each processing one another is done by all switches are mutual of the main processes is in the relationship of daisy chain interrupt, such as shown in the table of FIG. 2 The priority is provided and the interrupt controller 4 switches each process. For example, the process J ′ 4 for processing the operation input from the panel has the fifth priority, and the process is started by the timer interrupt of the 200 ms cycle, but when the higher priority process is performed, The start is suppressed and is started after waiting for the upper processing to be completed. Also, priority even during processing execution is higher for example J 'process when the interrupt corresponding to 2 occur is interrupted control is high priority processing J' moves to 2.

【0007】全ての主要処理が終了して全ての割込みが
解除された状態では、上述した最下位処理J′5 が行わ
れる。この最下位処理には、特別な処理をさせないか緊
急を要さず重要でない処理内容を割り当て、発生する割
込み処理に対して待機するいわゆるアイドル状態として
おく。
[0007] In all conditions main processing all interrupt ends is released, the lowest processing J '5 described above is performed. For this lowest level process, no special process is performed, or urgently required non-important process contents are assigned, and a so-called idle state for waiting for an interrupt process that occurs is set.

【0008】ところで、上述システムを含め、割込みを
利用したシステムでは、諸々の主要ジョブ(処理)にC
PUが要する実稼動時間とCPUが待機状態にある待機
時間とが混在し、外部条件によって実稼動時間従って待
機時間が変動している。所定時間内での全時間に対する
CPUの実稼動時間を以下ではCPU負荷率Rtと記述
する。即ち、CPU負荷率Rtは、 CPU負荷率(Rt)=実稼動時間/(実稼動時間+待
機時間) として定義され、CPUが割込により稼動している状態
(割合)、即ち主要な処理が全体に占める割合を示して
いる。
By the way, in systems using interrupts, including the above system, C is used for various main jobs (processes).
The actual operating time required by the PU and the standby time in which the CPU is in the standby state are mixed, and the actual operating time and the standby time vary depending on external conditions. The actual operating time of the CPU with respect to the total time within the predetermined time will be described below as a CPU load factor Rt. That is, the CPU load factor Rt is defined as: CPU load factor (Rt) = actual operating time / (actual operating time + standby time), and the state (percentage) in which the CPU is operating by interruption, that is, the main processing is It shows the percentage of the whole.

【0009】このCPU負荷率が高いことは、CPUが
レベルの高い主要割込処理群に稼動時間を多く占有され
て、割込みレベルのより低い主要割込処理が発生しても
長時間待機させられ適切な時点で必要な処理が行われな
い等の不都合を生じる確率が高いことを意味しており、
装置の信頼性が悪化する。負荷率が100%となれば、
行われない割込処理がでる。反対にCPU負荷率が極端
に低いことも、CPUの処理能力を有効に用いていない
こととなり、価格等も考慮すれば適切なシステム設計と
はいえない。
The high CPU load factor means that the CPU is occupied by a high-level main interrupt processing group for a large amount of operating time, and even if a main interrupt processing with a lower interrupt level occurs, it is kept waiting for a long time. It means that there is a high probability that inconvenience such as necessary processing will not be performed at an appropriate time,
The reliability of the device deteriorates. If the load factor is 100%,
There is an interrupt process that is not performed. On the other hand, the CPU load factor is extremely low, which means that the processing capacity of the CPU is not effectively used, and it cannot be said that the system design is appropriate considering the price and the like.

【0010】制御システムの設計に当たっては、システ
ム運用時において上記CPU負荷率が適正な値(システ
ムによるが通常約60%〜70%程度に設定される)と
なる様に設計される。従来は、このようなCPU負荷率
の評価には、一時的に外部からロジックアナライザやイ
ンサーキットエミュレータ(ICE)等のツールを接続
して評価していた。
In designing the control system, the CPU load factor is designed to be an appropriate value (usually set to about 60% to 70% depending on the system) during system operation. Conventionally, such a CPU load factor has been evaluated by temporarily connecting a tool such as a logic analyzer or an in-circuit emulator (ICE) from the outside.

【0011】[0011]

【発明が解決しようとする課題】ところで、上述のよう
にシステムのCPU負荷率が適切となるように設定し設
計されたシステムであっても、実際の運用時には運用環
境と適合していなかったり、また当初は適切であても運
用環境自体が変化して上述負荷率が変化し設計時に意図
したCPU負荷率で稼動しない事態も起こる。
By the way, even a system designed and set so that the CPU load factor of the system is appropriate as described above, is not compatible with the operating environment during actual operation, In addition, even if initially appropriate, the operating environment itself may change and the above-mentioned load factor may change, resulting in a situation where the CPU does not operate at the CPU load factor intended at the time of design.

【0012】このような不適切な実態を発見するために
は、従来にあっては上述の外部ツール(測定装置)を用
いる他に手段は無く、煩雑で大掛りな作業となることか
ら運用中での再評価は実際にはなかなか行い難いもので
あった。従って、CPU負荷率を随時簡易に得る方法が
求められていた。
In order to find such an inappropriate actual condition, there is no means other than using the above-mentioned external tool (measuring device) in the past, and it is a complicated and large-scale work, and therefore it is in operation. In reality, it was very difficult to re-evaluate. Therefore, there has been a demand for a method of easily obtaining the CPU load factor at any time.

【0013】このような事情以外にも、極めて複雑な制
御システムではプログラムの過誤(バグ)も含まれる虞
もあり、事前には発見できず運用中の特殊条件下で初め
て顕在化し、例えばプログラムがループを構成して単一
のジョブが終了しない等の不測の事態が生じることもあ
る。しかし、故障原因がプログラムであるかは容易に特
定できず対応に多くの時間と労力を費やしていた。しか
しこのようなケースでは、CPU負荷率Rtは100%
となるから、もし負荷率を簡易に常時得ることができれ
ばこうした原因の特定は容易となる。
In addition to the above circumstances, an extremely complicated control system may include an error (bug) in the program, which cannot be detected in advance and becomes apparent only under special conditions during operation. An unforeseen situation may occur in which a single job is not completed by forming a loop. However, it was not possible to easily identify whether the cause of the failure was a program, and a lot of time and effort was spent on dealing with it. However, in such a case, the CPU load factor Rt is 100%.
Therefore, if the load factor can be easily and constantly obtained, it is easy to identify such a cause.

【0014】本願発明は、このような事情に鑑みて成さ
れたもので、システム設計時に有用なばかりか、運用中
には自動的に負荷率を算出し、必要に応じて検定したり
常時表示したり必要であれば警告出力を得ることもでき
る、簡易なCPU負荷率算出方法を新規に提案すること
を目的とする。
The present invention has been made in view of the above circumstances, and is not only useful when designing a system, but also automatically calculates the load factor during operation, and verifies it as necessary or constantly displays it. It is an object of the present invention to newly propose a simple CPU load factor calculation method that can obtain a warning output if necessary.

【0015】[0015]

【課題を解決するための手段】上記課題を解決するため
に本願発明では、CPUへのハードウェア割込みを使用
して複数の処理を優先度順に行う制御システムにおいて
CPU負荷率算出方法を、システム制御各過程の中で、
優先度が最下位で全ての割込みが無い時に行われる最下
位処理(Jc)が、当該最下位処理の繰返しに要する時
間(Ts)を第一保持値(ta)に順次加算する過程を
含み、また、前記最下位処理(Jc)よりも優先度が高
く、主要割込処理(Ja、Jb1 、Jb2 、…)の中で
所定周期(Ti)のタイマー割込みによる処理の一つ
が、前記所定周期(Ti)を第二保持値(tb)に順次
加算する過程と、この第二保持値(tb)を負荷率算出
周期値(Tc)と比較する過程と、この比較の結果、前
記第二保持値(tb)が負荷率算出周期値(Tc)以上
である場合に、CPU負荷率(Rt)として値(tb−
ta)/tbを算出する過程及びこれに続き前記第一保
持値(ta)と前記第二保持値(tb)とを値“0”に
初期化する過程とを含む構成とする。
In order to solve the above problems, the present invention provides a CPU load factor calculation method in a control system for performing a plurality of processes in order of priority by using a hardware interrupt to a CPU. In each process,
The lowest processing (Jc), which is performed when the priority is the lowest and there is no interrupt, includes a step of sequentially adding the time (Ts) required for repeating the lowest processing to the first holding value (ta), In addition, one of the main interrupt processes (Ja, Jb 1 , Jb 2 , ...) With a predetermined period (Ti) of timer interruption has a higher priority than the lowest process (Jc). The process of sequentially adding the period (Ti) to the second holding value (tb), the process of comparing the second holding value (tb) with the load factor calculation period value (Tc), and the result of the comparison, the second When the holding value (tb) is equal to or greater than the load factor calculation cycle value (Tc), the value (tb-
The configuration includes a process of calculating ta) / tb and a process of subsequently initializing the first holding value (ta) and the second holding value (tb) to a value “0”.

【0016】[0016]

【作用】アイドル状態に対応する最下位処理(Jc)
で、当該処理の繰返しに要する時間(Ts)を第一保持
値(ta)に“0”から順次加算しアイドル時間を積算
するとともに、所定周期(Ti)のタイマー割込みによ
る割込み処理(Ja、Jb1 、Jb2 、…)の一つで、
前記所定周期(Ti)を第二保持値(tb)に順次加算
して経過時間を積算しており、この処理の中で負荷率算
出周期を越えて最初に発生した処理中では前述処理に加
えて第二保持値(tb)を負荷率算出周期値(Tc)と
の比較の結果、負荷率(Rt)を(tb−ta)/tb
として算出し、次の算出に備えて第一保持値(ta)と
前記第二保持値(tb)とを数値“0”に初期化する。
従って、ほぼ設定された負荷率算出周期毎にCPU負荷
率Rtが順次求められる。このCPU負荷率は、必要に
応じて参照したり、或いは警報の送出やシステムの停止
等に利用することができる。
[Function] The lowest processing (Jc) corresponding to the idle state
Then, the time (Ts) required for repeating the process is sequentially added to the first hold value (ta) from "0" to integrate the idle time, and the interrupt process (Ja, Jb) by the timer interrupt of the predetermined cycle (Ti) is performed. 1 , Jb 2 , ...)
The predetermined period (Ti) is sequentially added to the second holding value (tb) to integrate the elapsed time. In this process, in addition to the above process during the process that first occurs beyond the load factor calculation period. As a result of comparing the second holding value (tb) with the load factor calculation cycle value (Tc), the load factor (Rt) is (tb-ta) / tb.
Then, the first holding value (ta) and the second holding value (tb) are initialized to the numerical value “0” in preparation for the next calculation.
Therefore, the CPU load factor Rt is sequentially obtained for each set load factor calculation cycle. This CPU load factor can be referred to as necessary, or can be used for issuing an alarm or stopping the system.

【0017】[0017]

【実施例】以下、本発明を詳細に説明する。本願発明の
CPU負荷率算出方法は、例えば既に挙げた図4の装置
にて実施することができる。図4の制御システム10
は、既に説明したようにCPU1、ROM2、RAM
3、割込みコントローラ4、タイマー回路5、I/O回
路6を含み構成されている。I/O回路6には、外部の
センサーやアクチュエータ7と7セグメント表示器20
が接続されている。7セグメント表示器20は、制御シ
ステムの状態を外部から知るために用いる他、算出した
CPU負荷率を常時あるいは要求に応じて外部に数値で
表示するために用いる。前記割込みコントローラ4に
は、外部の操作盤(図示せず)からの出力や信号機の歩
行者用押ボタン(図示せず)の信号が割込み信号として
入力されている。
The present invention will be described in detail below. The CPU load factor calculation method of the present invention can be implemented, for example, by the device shown in FIG. Control system 10 of FIG.
Is the CPU1, ROM2, RAM as described above.
3, an interrupt controller 4, a timer circuit 5, and an I / O circuit 6 are included. The I / O circuit 6 includes an external sensor or actuator 7 and a 7-segment display 20.
Are connected. The 7-segment display 20 is used not only to know the state of the control system from the outside, but also to display the calculated CPU load factor as a numerical value outside or at all times in response to a request. An output from an external operation panel (not shown) or a signal from a pedestrian push button (not shown) of a traffic signal is input to the interrupt controller 4 as an interrupt signal.

【0018】以下、本願発明のCPU負荷率算出方法の
一実施例について詳述する。本願発明に係る上述システ
ムの割込みによる制御の一実施例を図1のフローチャー
トと図2の表に示す。この制御は概略図4に示し既述し
たものと同様で、再度略記すると、主としてJ0 〜J4
の複数のジョブ(主要割込処理)を行うもので、全ての
主要処理が終了して全ての割込みが解除された状態で
は、最下位処理J5 が行われる(アイドル状態)。最下
位処理J5 に優先する各主要処理J0 〜J4 はデイジー
チェーン接続され相互の切り替えは全て割込みによって
行われ、図2の表に示す優先度が設けられて割込みコン
トローラ4により制御されている。そして、本実施例に
おいては、特に最下位処理J5 (Jc)と主要処理中の
0 (Ja)に特徴を有している。
An embodiment of the CPU load factor calculation method of the present invention will be described in detail below. An embodiment of control by interruption of the above system according to the present invention is shown in the flowchart of FIG. 1 and the table of FIG. When this control is the same as that described above are shown in schematic 4, abbreviated again, mainly J 0 through J 4
In the state in which all the main processes have been completed and all the interrupts have been released, the lowest process J 5 is performed (idle state). The main processes J 0 to J 4 prior to the lowest process J 5 are daisy-chained, and switching between them is performed by interrupts. The priority shown in the table of FIG. 2 is provided and controlled by the interrupt controller 4. There is. The present embodiment is characterized by the lowest processing J 5 (Jc) and the main processing J 0 (Ja).

【0019】即ち、本願発明のCPU負荷率算出方法で
は、図1のフローチャートに示すように、先ず第一に、
最下位処理Jc(処理J5 )が、全割込みが解除されて
いること(全ての主要処理J0 〜J4 が完了している場
合)を確認し(S21:実際にはハードウェア的に行わ
れる)、最下位処理Jcの1サイクルに要する時間Ts
を第一保持値taに順次加算する過程(S22)と、必
要に応じては、適宜の任意の過程(S23)を経て、再
度上述(S21)過程から繰返す、という各過程から構
成されている。
That is, in the CPU load factor calculation method of the present invention, as shown in the flow chart of FIG.
The lowest process Jc (process J 5 ) confirms that all interrupts have been released (when all main processes J 0 to J 4 have been completed) (S21: actually performed by hardware). , The time Ts required for one cycle of the lowest processing Jc
Is sequentially added to the first holding value ta (S22), and if necessary, an appropriate arbitrary step (S23) is performed, and the above step (S21) is repeated again. .

【0020】上述の、1サイクルに要する時間Tsは、
制御システムのクロック周波数とプログラム内容に依存
した一定の値となる。また、第一保持値taは適宜のレ
ジスタの記憶内容あるいは前出のRAM3の所定アドレ
スの記憶内容であり、値Tsが1サイクル毎に順次加
算、累積される。なお、第一保持値taはシステムの起
動時に例えば図1の最下位処理Jcの過程S1として示
すように適宜プログラムで後述する第二保持値tbとと
もに値“0”が代入され初期化される。また、システム
稼動中には後述するように、タイマー割込みによる主要
処理中の何れかにより所定間隔で初期化される。
The time Ts required for one cycle described above is
It is a constant value that depends on the clock frequency of the control system and the program contents. The first holding value ta is the storage content of an appropriate register or the storage content of a predetermined address of the RAM 3 described above, and the value Ts is sequentially added and accumulated for each cycle. Note that the first holding value ta is initialized by substituting the value "0" together with the second holding value tb, which will be described later, in a program as appropriate, for example, as shown as step S1 of the lowest process Jc in FIG. 1 when the system is activated. Further, during system operation, as will be described later, initialization is performed at predetermined intervals by any of the main processes by the timer interrupt.

【0021】また、本願発明のCPU負荷率算出方法に
おいては、第二の条件として前記最下位処理Jcよりも
優先度が高く、且つ所定周期Tiの対割込みにより開始
される主要処理の一つJa(図1の実施例では、最高優
先度の主要処理J0 が選択されている)が、所定周期T
i(例えば10ms)のタイマ割込みにより処理を開始
し、前記所定周期Tiを、第二保持値tbに順次加算す
る過程(S11)と、この第二保持値tbを予め設定さ
れた一定値である負荷率算出周期値Tcと比較する過程
(S12)と、この比較の結果、もし第二保持値tb
が、負荷率算出周期値Tc以上である場合に前記第一保
持値taを参照して、 (tb−ta)/tb として負荷率Rtを算出する過程(S13)、これに続
き、前記第一保持値ta及び第二保持値tbに値“0”
を代入し初期化し全処理を終了する(S11)、との、
この順の各過程を含み構成されている。また、前記比較
(S12)の結果、もし第二保持値tbが、負荷率算出
周期値Tcに満たない場合には全処理終了とする、或い
は、必要に応じては適宜の任意の過程(S15)を経て
全処理終了とする。
Further, in the CPU load factor calculation method of the present invention, as the second condition, the priority is higher than the lowest processing Jc, and one of the main processing Ja started by the interruption of the predetermined cycle Ti. (In the embodiment of FIG. 1, the main process J 0 having the highest priority is selected) but the predetermined period T
The process is started by a timer interrupt of i (for example, 10 ms) and the predetermined period Ti is sequentially added to the second holding value tb (S11), and the second holding value tb is a preset constant value. The process of comparing with the load factor calculation cycle value Tc (S12) and the result of this comparison, if the second holding value tb
Is a load factor calculation cycle value Tc or more, the process (S13) of referring to the first holding value ta to calculate the load factor Rt as (tb-ta) / tb, and then the first The value "0" is set in the holding value ta and the second holding value tb.
, And completes all processing (S11).
It is configured to include each process in this order. Further, as a result of the comparison (S12), if the second holding value tb is less than the load factor calculation cycle value Tc, the whole process is ended, or if necessary, an appropriate arbitrary process (S15). ) And all processing is completed.

【0022】先に、CPU負荷率を、実稼動時間/(実
稼動時間+待機時間)として示したが、本願発明ではこ
れと等価なものとして、 (tb−ta)/tb、即ち、(全時間−待機時間)/
全時間 なる演算よりCPU負荷率Rtを求めている。
The CPU load factor is shown as the actual operating time / (actual operating time + standby time), but in the present invention, it is equivalent to (tb-ta) / tb, that is, (total Time-standby time) /
The CPU load factor Rt is calculated from the calculation of the total time.

【0023】本願発明に係る制御システムではその制御
は、以上挙げた各過程を含み、一般にはその他の中間割
込みレベルのタイマ割込みによる或いはタイマ割込みで
ない通常割込みの各主要処理(図1ではJb1 、J
2 、…として表す)を含み構成される。なお、一定間
隔で算出されるCPU負荷率Rtを利用するために、7
セグメント表示器20に数値でCPU負荷率Rtを表示
する処理、或いは一定間隔で算出されるCPU負荷率R
tを常時監視し、設定値以上の異常値となった場合には
適宜手段で警告したりシステムの稼動を停止する処理等
は、この中間割込み処理を用いれば良い。もっとも、上
記CPU負荷率利用のための制御過程は、もし速度的に
余裕があれば負荷率を算出する過程(S13)と同一の
処理中等に含ませても良い。
In the control system according to the present invention, the control includes the above-mentioned processes, and in general, each main process of a normal interrupt by a timer interrupt of other intermediate interrupt level or not a timer interrupt (Jb 1 in FIG. 1 , J
b 2 , ...). In order to utilize the CPU load factor Rt calculated at regular intervals, 7
A process of displaying the CPU load factor Rt numerically on the segment display 20, or a CPU load factor R calculated at regular intervals
This intermediate interrupt process may be used for the process of constantly monitoring t, and when an abnormal value equal to or larger than the set value is given, a warning is issued by an appropriate means or the operation of the system is stopped. However, the control process for using the CPU load factor may be included in the same process as the process of calculating the load factor (S13) if there is a margin in speed.

【0024】以上説明したごとき構成の本願発明のCP
U負荷率算出方法によれば、例えば図3に示すタイミン
グチャートに於いて、最下位処理J5 (Jc)に於いて
常にアイドル時間(待機時間)を積算しており、最上位
処理J0 に於いて全体の時間をtbとして加算してお
り、ほぼ所定周期Tc毎にCPU負荷率が算出されて必
要に応じて参照したり警報等に利用したりすることがで
きる。従って、制御システムの設計時や、運用中の点検
や状態監視にCPU負荷率を有効に利用し制御システム
をより良いものとすることができる。勿論、必要であれ
ば第一保持値ta(アイドル時間)及び第二保持値tb
(全動作時間)より実稼動時間を求めることもできる。
The CP of the present invention having the structure as described above
According to the U load factor calculation method, for example, in the timing chart shown in FIG. 3, the idle time (standby time) is always integrated in the lowest process J 5 (Jc), and the highest process J 0 is calculated. In this case, the total time is added as tb, and the CPU load factor is calculated almost every predetermined period Tc so that the CPU load factor can be referred to as needed or used for an alarm or the like. Therefore, the CPU load factor can be effectively used for designing the control system, for inspection during operation, and for monitoring the state, thereby improving the control system. Of course, if necessary, the first holding value ta (idle time) and the second holding value tb
The actual operating time can also be obtained from (total operating time).

【0025】上述の実施例では、CPU負荷率算出過程
を含む処理Jaの優先度を最上位としたが、最上位でな
くとも良いがあまり下位レベルとするのは不都合で、な
るべく高く設定することが望ましい。もし、更に優先度
の高い処理が設定されている場合にはこの優先度の高い
処理の発生具合によっては、CPU負荷率算出過程を含
む処理の周期Ti中に時間割当てが無く、稼動時間の積
算に欠落を生じCPU負荷率にマイナス方向の誤差が発
生するし、CPU負荷率算出の間隔が変動し好ましくな
い。実施例のようにCPU負荷率算出過程のための処理
の優先度を最上位とすれば、誤差や変動を最も少なくで
きる。
In the above-described embodiment, the priority of the process Ja including the CPU load factor calculation process is set to the highest level, but it is not necessary to set it to the highest level, but it is inconvenient to set it to a lower level, and it is set as high as possible. Is desirable. If a process with a higher priority is set, depending on the occurrence of the process with a higher priority, there is no time allocation during the cycle Ti of the process including the CPU load factor calculation process, and the operating time is integrated. Is caused, a negative error occurs in the CPU load factor, and the CPU load factor calculation interval fluctuates, which is not preferable. If the priority of the processing for the CPU load factor calculation process is set to the highest level as in the embodiment, the error and the fluctuation can be minimized.

【0026】以上例示し説明した交通制御システムに限
らず、本願発明のCPU負荷率算出方法は、割込み制御
を用いたシステムであれば特に用途を限定されるもので
はなく、ひろく種々の装置、システムに適用することが
可能で、システム等の設計時或いは実際の運用時のCP
U負荷率の検定や監視等に用いて有用である。
Not limited to the traffic control system illustrated and described above, the CPU load factor calculation method of the present invention is not particularly limited in its application as long as it is a system using interrupt control, and a wide variety of devices and systems are available. Can be applied to the CP when designing the system or during actual operation.
It is useful for verification and monitoring of U load factor.

【0027】[0027]

【発明の効果】以上詳述したとおり本願発明では、CP
Uへのハードウェア割込みを使用して複数の処理を優先
度順に行う制御システムにおけるCPU負荷率算出方法
を、優先度が最下位で全ての割込みが無い時に行われる
最下位処理(Jc)が、当該最下位処理の繰返しに要す
る時間(Ts)を第一保持値(ta)に順次加算する過
程を含み、また、前記最下位処理(Jc)よりも優先度
が高く、主要割込処理(Ja、Jb1 、Jb2 、…)の
中で所定周期(Ti)のタイマー割込みによる処理の一
つが、前記所定周期(Ti)を第二保持値(tb)に順
次加算する過程と、この第二保持値(tb)を負荷率算
出周期値(Tc)と比較する過程と、この比較の結果、
前記第二保持値(tb)が負荷率算出周期値(Tc)以
上である場合に、CPU負荷率(Rt)として値(tb
−ta)/tbを算出する過程及びこれに続き前記第一
保持値(ta)と前記第二保持値(tb)とを値“0”
に初期化する過程とを含む構成としたので、制御システ
ムのCPU負荷率を、外部のツールや装置を使用するこ
となく、ソフトウェア的処理で常時算出し利用すること
ができる。この結果、従来には実施困難であった制御シ
ステム運用中でのCPU負荷率の検証やCPU負荷率の
監視することによりCPU負荷率が上がりシステムが機
能しない事態を放置する等の不都合を回避して制御シス
テムを適正に運用することを可能とならしめる。その他
にも、制御システムの設計時にCPU負荷率が適正であ
るかを簡易に常時検証することができる効果もある。
As described above in detail, in the present invention, the CP
A CPU load factor calculation method in a control system in which a plurality of processes are performed in order of priority using a hardware interrupt to U is performed by the lowest processing (Jc) performed when the priority is the lowest and there is no interrupt. It includes a process of sequentially adding the time (Ts) required for repeating the lowest processing to the first holding value (ta), and has a higher priority than the lowest processing (Jc), and the main interrupt processing (Ja). , Jb 1 , Jb 2 , ...) Of one of the processes by the timer interruption of a predetermined period (Ti), the process of sequentially adding the predetermined period (Ti) to the second holding value (tb) and the second The process of comparing the holding value (tb) with the load factor calculation cycle value (Tc), and the result of this comparison,
When the second holding value (tb) is equal to or greater than the load factor calculation cycle value (Tc), the value (tb) is set as the CPU load factor (Rt).
-Ta) / tb is calculated, and subsequently, the first holding value (ta) and the second holding value (tb) are set to the value "0".
Since the configuration including the initialization process is performed, the CPU load factor of the control system can always be calculated and used by software processing without using an external tool or device. As a result, it is possible to avoid the inconvenience such as leaving the situation where the CPU load rate rises and the system does not function by verifying the CPU load rate or monitoring the CPU load rate during operation of the control system, which has been difficult to implement in the past. To enable proper operation of the control system. In addition, there is an effect that it is possible to easily always verify whether or not the CPU load factor is appropriate when designing the control system.

【図面の簡単な説明】[Brief description of drawings]

【図1】本願発明のCPU負荷率算出方法を含む制御シ
ステムの制御過程を示すフローチャートである。
FIG. 1 is a flowchart showing a control process of a control system including a CPU load factor calculation method of the present invention.

【図2】本願発明のCPU負荷率算出方法に係る制御シ
ステムの一例を示すブロック図である。
FIG. 2 is a block diagram showing an example of a control system according to a CPU load factor calculation method of the present invention.

【図3】本願発明のCPU負荷率算出方法を含む制御過
程の一実施例の各処理を説明する図である。
FIG. 3 is a diagram illustrating each process of an embodiment of a control process including the CPU load factor calculation method of the present invention.

【図4】図3に対応する処理の流れを説明するタイミン
グチャートである。
FIG. 4 is a timing chart illustrating the flow of processing corresponding to FIG.

【符号の説明】[Explanation of symbols]

1…CPU(マイクロプロセツサ)、 4…割込みコントローラ、 5…タイマ、 (Ja、Jb1 、Jb2 、…、…)…主要割込処理、 (Jc)…最下位処理、 ta…第一保持値、 tb…第二保持値、Ts…最下位
処理の繰返し周期、 Tc…負荷率算出周期、Ti…タ
イマ割込周期、 Rt…CPU負荷率。
1 ... CPU (microprocessor), 4 ... interrupt controller, 5 ... timer, (Ja, Jb 1, Jb 2, ..., ...) ... main interrupt process, (Jc) ... lowest processing, ta ... first holding Value, tb ... second hold value, Ts ... repetition cycle of lowest processing, Tc ... load factor calculation cycle, Ti ... timer interrupt period, Rt ... CPU load factor.

─────────────────────────────────────────────────────
─────────────────────────────────────────────────── ───

【手続補正書】[Procedure amendment]

【提出日】平成5年3月11日[Submission date] March 11, 1993

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】図面の簡単な説明[Name of item to be corrected] Brief description of the drawing

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【図面の簡単な説明】[Brief description of drawings]

【図1】本願発明のCPU負荷率算出方法を含む制御シ
ステムの制御過程を示すフローチャートである。
FIG. 1 is a flowchart showing a control process of a control system including a CPU load factor calculation method of the present invention.

【図2】本願発明のCPU負荷率算出方法を含む制御過
程の一実施例の各処理を説明する図である。
FIG. 2 is a diagram illustrating each process of an embodiment of a control process including the CPU load factor calculation method of the present invention.

【図3】図2に対応する処理の流れを説明するタイミン
グチャートである。
FIG. 3 is a timing chart illustrating the flow of processing corresponding to FIG.

【図4】本願発明のCPU負荷率算出方法に係る制御シ
ステムの一例を示すブロック図である。
FIG. 4 is a block diagram showing an example of a control system according to a CPU load factor calculation method of the present invention.

【図5】従来の制御過程の一例の各処理を説明する図で
ある。
FIG. 5 is a diagram illustrating each process of an example of a conventional control process.

【図6】図5に対応する処理の流れを説明するタイミン
グチャートである。
FIG. 6 is a timing chart illustrating the flow of processing corresponding to FIG.

【符号の説明】 1…CPU(マイクロプロセツサ)、 4…割込みコントローラ、 5…タイマ、 (Ja、Jb1 、Jb2 、…、…)…主要割込処理、 (Jc)…最下位処理、 ta…第一保持値、 tb…第二保持値、Ts…最下位
処理の繰返し周期、 Tc…負荷率算出周期、Ti…タ
イマ割込周期、 Rt…CPU負荷率。 ─────────────────────────────────────────────────────
[Description of Reference Numerals] 1 ... CPU (microprocessor), 4 ... interrupt controller, 5 ... timer, (Ja, Jb 1, Jb 2, ..., ...) ... main interrupt process, (Jc) ... lowest processing, ta ... 1st hold value, tb ... 2nd hold value, Ts ... Repetition period of lowest processing, Tc ... Load factor calculation period, Ti ... Timer interrupt period, Rt ... CPU load factor. ─────────────────────────────────────────────────── ───

【手続補正書】[Procedure amendment]

【提出日】平成5年3月11日[Submission date] March 11, 1993

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0005[Name of item to be corrected] 0005

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0005】上述システムは、割込みにより制御され例
えば図5に表として示すように主としてJ′0 〜J′4
の複数の割込みによるジョブ(以下、主要処理と記述す
る)を行い、これらのジョブの要求がないときにはアイ
ドル状態、即ち優先度が最下位の処理J′5 (以下、最
下位処理と記述する)を行っている。
[0005] The above described system is primarily J to be controlled by an interrupt for example 5, as shown as a table '0 through J' 4
Job by a plurality of interrupt (hereinafter, main processing and describes) performs idle when there is no demand for these job status, i.e. priority lowest processing J '5 (hereinafter, referred to as the least significant process) It is carried out.

【手続補正2】[Procedure Amendment 2]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0006[Correction target item name] 0006

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0006】前記主要割込処理(J′0 〜J′4 )は、
いづれも最下位処理J′5 に優先しており、各処理同士
はデイジーチェーン接続の関係にあり各主要処理の相互
間の切り替わりは全て割込みによって行われていて、図
5の表に示す様な優先度が設けられて割込みコントロー
ラ4により各処理の切換えが行われている。図6は対応
する処理の流れの一例を示すタイミングチャートであ
る。例えば、パネルからの操作入力を処理する処理J′
4 は5番目の優先度を持ち、200ms周期のタイマー
割込みで処理を開始するが、優先度のより高い処理が行
われている場合には、その開始は抑制され上位の処理が
終了するのを待って開始される。また、処理実行中であ
っても優先度がより高い例えばJ′2 に対応する割込み
が発生した場合には処理は中断され制御は優先度の高い
処理J′2 に移る。
The main interrupt processing (J ' 0 to J' 4 ) is
Izure also in preference to the lowest process J '5, each processing one another is done by all switches are mutual of the main processes is in the relationship of daisy chain interrupt, such as shown in the table of FIG. 5 The priority is provided and the interrupt controller 4 switches each process. FIG. 6 is a timing chart showing an example of the flow of corresponding processing. For example, a process J ′ for processing an operation input from the panel
4 has the 5th priority, and the processing is started by the timer interrupt of the 200 ms cycle, but when the processing with the higher priority is being performed, the start is suppressed and the upper processing is terminated. Wait and get started. Also, priority even during processing execution is higher for example J 'process when the interrupt corresponding to 2 occur is interrupted control is high priority processing J' moves to 2.

【手続補正3】[Procedure 3]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0018[Correction target item name] 0018

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0018】以下、本願発明のCPU負荷率算出方法の
一実施例について詳述する。本願発明に係る上述システ
ムの割込みによる制御の一実施例を図1のフローチャー
トと図2の表に示す。また、図3は対応する処理の流れ
の一例を示すタイミングチャートである。この制御は概
略図5に示し既述したものと同様で、再度略記すると、
主としてJ0 〜J4 の複数のジョブ(主要割込処理)を
行うもので、全ての主要処理が終了して全ての割込みが
解除された状態では、最下位処理J5が行われる(アイ
ドル状態)。最下位処理J5 に優先する各主要処理J0
〜J4はデイジーチェーン接続され相互の切り替えは全
て割込みによって行われ、図2の表に示す優先度が設け
られて割込みコントローラ4により制御されている。そ
して、本実施例においては、特に最下位処理J5 (J
c)と主要処理中のJ0 (Ja)に特徴を有している。
An embodiment of the CPU load factor calculation method of the present invention will be described in detail below. An embodiment of control by interruption of the above system according to the present invention is shown in the flowchart of FIG. 1 and the table of FIG. Further, FIG. 3 is a timing chart showing an example of the flow of corresponding processing. This control is the same as that shown in the schematic diagram 5 and described above.
It mainly performs a plurality of jobs (main interrupt processing) of J 0 to J 4 , and when all the main processing is completed and all interrupts are released, the lowest processing J 5 is executed (idle state). ). Each main process J 0 prior to the lowest process J 5
J 4 are connected in a daisy chain, and switching between them is performed by interrupts. The interrupt controller 4 controls the priorities shown in the table of FIG. In the present embodiment, the lowest processing J 5 (J
It is characterized by c) and J 0 (Ja) during main processing.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 CPUへのハードウェア割込みを使用し
て複数の処理を優先度順に行う制御システムにおいてC
PU負荷率を求めるための方法であって、 優先度が最下位で全ての割込みが無い時に行われる最下
位処理(Jc)が、当該最下位処理の繰返しに要する時
間(Ts)を第一保持値(ta)に順次加算する過程を
含み、 前記最下位処理(Jc)よりも優先度が高く、主要割込
処理(Ja、Jb1 、Jb2 、…)の中で所定周期(T
i)のタイマー割込みによる処理の一つが、前記所定周
期(Ti)を第二保持値(tb)に順次加算する過程
と、この第二保持値(tb)を負荷率算出周期値(T
c)と比較する過程と、この比較の結果、前記第二保持
値(tb)が負荷率算出周期値(Tc)以上である場合
に、CPU負荷率(Rt)として値(tb−ta)/t
bを算出する過程及びこれに続き前記第一保持値(t
a)と前記第二保持値(tb)とを値“0”に初期化す
る過程とを含むことを特徴とする CPU負荷率算出方法。
1. A C in a control system for performing a plurality of processes in order of priority using a hardware interrupt to a CPU.
A method for obtaining a PU load factor, wherein the lowest processing (Jc) performed when the priority is the lowest and there are no interrupts first holds the time (Ts) required to repeat the lowest processing. It includes a process of sequentially adding to the value (ta), has a higher priority than the lowest processing (Jc), and has a predetermined cycle (T) in the main interrupt processing (Ja, Jb 1 , Jb 2 , ...).
One of the processes by the timer interrupt of i) is a process of sequentially adding the predetermined period (Ti) to the second holding value (tb) and the second holding value (tb) of the load factor calculation period value (T).
c) and the result of this comparison, when the second holding value (tb) is greater than or equal to the load factor calculation cycle value (Tc), the CPU load factor (Rt) is the value (tb-ta) / t
The process of calculating b and subsequently the first holding value (t
a) and a step of initializing the second holding value (tb) to a value "0".
JP4212147A 1992-07-16 1992-07-16 Cpu load factor calculating method Pending JPH0635727A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4212147A JPH0635727A (en) 1992-07-16 1992-07-16 Cpu load factor calculating method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4212147A JPH0635727A (en) 1992-07-16 1992-07-16 Cpu load factor calculating method

Publications (1)

Publication Number Publication Date
JPH0635727A true JPH0635727A (en) 1994-02-10

Family

ID=16617671

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4212147A Pending JPH0635727A (en) 1992-07-16 1992-07-16 Cpu load factor calculating method

Country Status (1)

Country Link
JP (1) JPH0635727A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999034292A1 (en) * 1997-12-24 1999-07-08 Robert Bosch Gmbh Method for determining the load of a computing device
KR100295956B1 (en) * 1996-05-18 2001-10-24 박종섭 Method for measuring sensibility idle degree of microprocessor
JP2002318713A (en) * 2001-04-19 2002-10-31 Yaskawa Electric Corp Cpu occupancy time measuring method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100295956B1 (en) * 1996-05-18 2001-10-24 박종섭 Method for measuring sensibility idle degree of microprocessor
WO1999034292A1 (en) * 1997-12-24 1999-07-08 Robert Bosch Gmbh Method for determining the load of a computing device
US6477484B1 (en) 1997-12-24 2002-11-05 Robert Bosch Gmbh Method for determining the load of a computing device
JP2002318713A (en) * 2001-04-19 2002-10-31 Yaskawa Electric Corp Cpu occupancy time measuring method

Similar Documents

Publication Publication Date Title
US5796941A (en) Method for supervising software execution in a license restricted environment
US7890800B2 (en) Method, operating system and computing hardware for running a computer program
JP2004504667A (en) Method and apparatus for measuring the run time of a task in a real-time system
JPH0635727A (en) Cpu load factor calculating method
EP1889163A1 (en) System and method for bypassing execution of an algorithm
JPS63163932A (en) System monitoring system for control computer
JP3243849B2 (en) Task scheduling device
JP3015793B1 (en) Programmable controller
JP6788145B2 (en) Processing equipment, traffic signal equipment and information display equipment
JP2535664B2 (en) Waiting method for satisfying processing conditions
JP2000076048A (en) Install controller
JPS6118045A (en) Detecting system of program runaway
JPH07114517A (en) Program execution control system of multiprocessor system
JP2001076269A (en) Operation managing device and operation managing method
JPH0259801A (en) Optimization controller
JP3331235B2 (en) Power saving control method and apparatus for computer system
JPS6339047A (en) Test program scheduler
JPH0683652A (en) Microcomputer system
JPS63251845A (en) Device for detecting program abnormality
JP3361949B2 (en) Program verification device
JPH0378034A (en) Program parallel execution device
JPS6353653A (en) Scheduler for text program
JPH05181711A (en) System for charging equipment normality confirming job
JPH03219352A (en) I/o controller
JP2002251299A (en) Program tracing device