JPH04349543A - Measuring system for program processing time - Google Patents

Measuring system for program processing time

Info

Publication number
JPH04349543A
JPH04349543A JP3121562A JP12156291A JPH04349543A JP H04349543 A JPH04349543 A JP H04349543A JP 3121562 A JP3121562 A JP 3121562A JP 12156291 A JP12156291 A JP 12156291A JP H04349543 A JPH04349543 A JP H04349543A
Authority
JP
Japan
Prior art keywords
program
counter
time
microprocessor
processing time
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
JP3121562A
Other languages
Japanese (ja)
Inventor
Tetsushige Kashima
鹿島 哲茂
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP3121562A priority Critical patent/JPH04349543A/en
Publication of JPH04349543A publication Critical patent/JPH04349543A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To easily and exactly measure how many percentages in the whole the processing time of a certain specific program occupies, in the case of controlling a device in accordance with a program by a microprocessor. CONSTITUTION:The system is provided with a counter 22 for measuring a specific program, and a counter 21 for measuring an execution time of the whole program. At the time of starting the measurement, the counters 21, 22 are reset from a microprocessor 26, and by inputting '1' to an EN1 terminal of the counter 21, it is operated. Only when a program 1 is being executed, '1' is inputted to an EN2 terminal of the counter 22, and the counter 22 is operated. When the measurement is finished, the operation of the counters 21, 22 is stopped by inputting '0' to the EN1 and the EN2, and by reading a result of counting of the counter 21 and the counter 22 by the microprocessor 26, a ratio of the execution time is calculated.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明はマイクロプロセッサによ
り制御される装置のプログラムの処理時間の測定方式に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for measuring the processing time of a program in a device controlled by a microprocessor.

【0002】0002

【従来の技術】従来、プログラムの実行時間のうち、あ
る特定のプログラムの実行時間が何%占めているかを測
定する場合は、図2に示すように以下のように行われる
。まず、ROM25に格納された測定対象のプログラム
1が起動されてから終了するまで、何秒かかるかをあら
かじめインサーキットテスター等で測定しておく。同様
にROM25に格納され、周期的に起動される周期プロ
グラムMが何回実行されるかは、周期プログラム実行ご
とにカウントするよう周期プログラムMに作り込んでお
き、結果はメモリ40のアドレス42に保持する。また
、プログラム1の実行回数も同様にカウントし、メモリ
40のアドレス43に保存しておく。周期プログラムは
、一定の時間間隔でパルスを発生するタィイマー回路3
0から、マイクロプロセッサ26の割り込み入力INT
31にパルスが入力され、マイクロプロセッサ26がこ
の割込み入力を受けると、ROM25に書かれている周
期プログラムMを実行することによりほぼ一定間隔で起
動される。従って、周期プログラムMの実行回数がわか
れば何秒経過したかわかる。たとえば100msごとに
起動される周期プログラムMが5回実行されれば100
×5=500ms経過したことになる。この間に、プロ
グラム1が5回実行され、プログラム1の起動から終了
まで10msかかるとすれば10×5=50ms間プロ
グラム1は実行され、全実行時間に占める割合は、50
/500×100=10%となる。こうして、、たとえ
ばプログラム1が、マイクロプロセッサ26が作業をし
ていないアイドル時に実行するプログラムであれば、1
00×(1−(プログラム1の時間×回数)/(周期プ
ログラムの時間×回数))によりマイクロプロセッサの
使用率が算出される。
2. Description of the Related Art Conventionally, measuring what percentage of the execution time of a particular program occupies the execution time of a program is carried out as follows, as shown in FIG. First, the number of seconds it takes from the time the program 1 to be measured stored in the ROM 25 is started until it ends is measured in advance using an in-circuit tester or the like. Similarly, the number of times the periodic program M, which is stored in the ROM 25 and is activated periodically, is executed is determined in advance by writing it into the periodic program M so as to count each time the periodic program is executed, and the result is stored at address 42 of the memory 40. Hold. Further, the number of executions of the program 1 is similarly counted and stored at address 43 of the memory 40. The periodic program uses a timer circuit 3 that generates pulses at regular time intervals.
0 to microprocessor 26 interrupt input INT
When a pulse is input to 31 and the microprocessor 26 receives this interrupt input, it is activated at approximately regular intervals by executing a periodic program M written in the ROM 25. Therefore, if you know the number of times the periodic program M has been executed, you can know how many seconds have passed. For example, if periodic program M that starts every 100ms is executed 5 times, 100
This means that ×5=500ms have passed. During this time, program 1 is executed 5 times, and if it takes 10 ms from start to finish of program 1, program 1 will be executed for 10 x 5 = 50 ms, and its proportion to the total execution time will be 50 ms.
/500×100=10%. Thus, for example, if program 1 is a program to be executed when microprocessor 26 is idle and not doing any work, 1
The usage rate of the microprocessor is calculated by 00×(1-(time of program 1×number of times)/(time of periodic program×number of times)).

【0003】0003

【発明が解決しようとする課題】この従来の、プログラ
ム処理時間の測定方式では、周期的に起動されるプログ
ラムは、他の割込み処理が起動された場合、必ずしも一
定間隔で起動されないため、正確なマイクロプロセッサ
の使用率が算出できない。また、プログラムの実行時間
をインサーキットテスタ等で測定しておかなければなら
ないため、プログラムの修正ごとに再測定が必要となり
、手間がかかるという問題点がある。
[Problem to be Solved by the Invention] In this conventional method of measuring program processing time, programs that are started periodically are not necessarily started at regular intervals when other interrupt processing is started, so it is difficult to accurately measure program processing time. Unable to calculate microprocessor usage rate. Furthermore, since the program execution time must be measured using an in-circuit tester or the like, re-measurement is required each time the program is modified, which is time consuming.

【0004】0004

【課題を解決するための手段】本発明のプログラム処理
時間の測定方式は、マイクロプロセッサがプログラムに
従い制御,データ処理を行う装置において、測定開始か
ら終了までのプログラムの全処理時間を測定する第1の
カウンタと、指定された特定のプログラムの実行時間を
測定する第2のカウンタと、前記第1のカウンタ及び前
記第2のカウンタのカウント値を読み取りプログラムの
全処理時間に対する前記特定のプログラム実行時間の割
合を算出する手段とを有している。
[Means for Solving the Problems] The method for measuring program processing time of the present invention is a method for measuring the total processing time of a program from the start to the end of measurement in a device in which a microprocessor performs control and data processing according to a program. a second counter that measures the execution time of a specified specific program; and a counter that reads the count values of the first counter and the second counter; and the execution time of the specific program relative to the total processing time of the program. and a means for calculating the ratio.

【0005】[0005]

【実施例】次に本発明について図面を参照して説明する
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be explained with reference to the drawings.

【0006】図1は本発明の一実施例のブロック図であ
る。マイクロプロセッサ26は、通常、装置内に組み込
まれ、たとえば伝送装置であれば、データーの送受信制
御,データ編集等の処理をプログラムの書かれたメモリ
(ROM25)の内容に従い、実行する。マイクロプロ
セッサ26は、ROM25に書かれたプログラム1〜N
および周期プログラムMを実行するが、これらの実行時
間のうち、特定のプログラム1の処理時間が何%を占め
るのかという測定は以下のように行われる。
FIG. 1 is a block diagram of one embodiment of the present invention. The microprocessor 26 is usually built into a device, and in the case of a transmission device, for example, it executes processing such as data transmission/reception control and data editing according to the contents of a memory (ROM 25) in which a program is written. The microprocessor 26 executes programs 1 to N written in the ROM 25.
and periodic program M are executed, and the measurement of what percentage of the processing time of the specific program 1 occupies of these execution times is performed as follows.

【0007】時間測定に用いるカウンタ(CNT)は、
カウンタ(CNT)21とカウンタ(CNT)22で、
CNT21は全処理時間測定、CNT22はプログラム
1の実行時間の測定に用いられる。たとえば周期プログ
ラムMが実行されてから次に周期プログラムMが実行さ
れる間に、プログラム1がどれくらいの割合で実行され
るかを測定する場合、まず周期プログラムMでCNT2
1のRST1,CNT22のRST2端子に、マイクロ
プロセッサ26のI/Oポートからリセットパルスを出
力し、CNT21,CNT22を‘0’にクリアする。 そして、CNT21のEN1に対しては‘1’を出力す
る。CNT21,CNT22には、クロック回路(CL
K)27からクロックパルスが供給されており、カウン
ト有効端子EN1およびEN2に‘1’が入力されてい
れば、クロックパルスのカウントを行う。EN1および
EN2入力が‘0’の場合、カウントは停止し、それま
でカウントした値を保持する。CNT2のEN2端子に
対しては、マイクロプロセッサ26は‘0’を出力し、
カウンタは‘0’のままにしておく。
[0007] The counter (CNT) used for time measurement is
With counter (CNT) 21 and counter (CNT) 22,
The CNT 21 is used to measure the total processing time, and the CNT 22 is used to measure the execution time of the program 1. For example, when measuring the rate at which program 1 is executed between the execution of periodic program M and the next execution of periodic program M, first
A reset pulse is output from the I/O port of the microprocessor 26 to the RST1 and RST2 terminals of CNT22, and CNT21 and CNT22 are cleared to '0'. Then, '1' is output to EN1 of CNT21. CNT21 and CNT22 are equipped with a clock circuit (CL).
If clock pulses are being supplied from K) 27 and '1' is input to the count valid terminals EN1 and EN2, the clock pulses are counted. When the EN1 and EN2 inputs are '0', counting stops and the values counted up to that point are held. The microprocessor 26 outputs '0' to the EN2 terminal of CNT2,
Leave the counter at '0'.

【0008】次に、プログラム1が起動された場合、マ
イクロプロセッサ26は、CNT22のEN2の端子に
‘1’を出力しCNT22のカウント動作を開始する。 マイクロプロセッサ26はプログラム1の終りに、CN
T22のEN2に‘0’を出力し、カウント動作を停止
する。次に再びプログラム1が起動された場合、同様に
して、CNT22のカウント動作を再開する。
Next, when the program 1 is activated, the microprocessor 26 outputs '1' to the EN2 terminal of the CNT 22 and starts the counting operation of the CNT 22. At the end of program 1, microprocessor 26
Output '0' to EN2 of T22 and stop the counting operation. When the program 1 is started again next time, the counting operation of the CNT 22 is restarted in the same manner.

【0009】こうして再び周期プログラムMが起動され
た時、CNT21とCNT22のEN1,EN2端子に
マイクロプロセッサ26から‘0’を出力し、カウント
動作を停止する。マイクロプロセッサ26は測定開始か
ら終了までの時間をCNT21のカウント出力端子OU
T1よりゲート23を通り読み込み、また、プログラム
1が測定時間中何秒間実行されたかCNT21のカウン
ト出力端子OUT2よりゲート24を通り読み込む。そ
して、CNT22から読んだ値をCNT1から読んだ値
で割れば、プログラム1がプログラムの実行時間のうち
何%を占めているかわかる。
When the periodic program M is started again in this manner, the microprocessor 26 outputs '0' to the EN1 and EN2 terminals of the CNT 21 and CNT 22, and the counting operation is stopped. The microprocessor 26 outputs the time from the start to the end of the measurement to the count output terminal OU of the CNT 21.
T1 is read through the gate 23, and the number of seconds that the program 1 was executed during the measurement time is read from the count output terminal OUT2 of the CNT 21 through the gate 24. Then, by dividing the value read from CNT22 by the value read from CNT1, it can be determined what percentage of the program execution time the program 1 occupies.

【0010】0010

【発明の効果】以上説明したように本発明は、時間測定
用のカウンタを、全処理時間測定用と特定プログラムの
実行時間測定用の2つ設け、測定時の開始から終了まで
の間のみそれらのカウンタを動作させるようにし、カウ
ント結果をマイクロプロセッサで読めるようにしたため
、特定のプログラムの全体の実行時間に占める割合が容
易にわかる。このため、マイクロプロセッサの使用率も
正確に算出できる。また、プログラムごとに測定可能な
ので、使用率が高い場合、どのプログラムで時間がかか
っているのかも容易に測定でき、デバックツールとして
も使用できるという効果がある。
Effects of the Invention As explained above, the present invention provides two counters for time measurement, one for measuring the total processing time and one for measuring the execution time of a specific program. Since the counter is activated and the count result can be read by a microprocessor, it is easy to determine the percentage of a particular program's overall execution time. Therefore, the usage rate of the microprocessor can also be calculated accurately. In addition, since it can be measured for each program, if the usage rate is high, it is easy to measure which program is taking time, and it can also be used as a debugging tool.

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

【図1】本発明の一実施例のブロック図である。FIG. 1 is a block diagram of one embodiment of the present invention.

【図2】従来のプログラム処理時間の測定方式の一例の
ブロック図である。
FIG. 2 is a block diagram of an example of a conventional method for measuring program processing time.

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

21,22    カウンタ(CNT)23,24  
  ゲート 25    ROM(メモリ) 26    マイクロプロセッサ 27    クロック回路(CLK) 30    タイマー回路 40    メモリ
21, 22 Counter (CNT) 23, 24
Gate 25 ROM (memory) 26 Microprocessor 27 Clock circuit (CLK) 30 Timer circuit 40 Memory

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】  マイクロプロセッサがプログラムに従
い制御,データ処理を行う装置において、測定開始から
終了までのプログラムの全処理時間を測定する第1のカ
ウンタと、指定された特定のプログラムの実行時間を測
定する第2のカウンタと、前記第1のカウンタ及び前記
第2のカウンタのカウント値を読み取りプログラムの全
処理時間に対する前記特定のプログラム実行時間の割合
を算出する手段とを有することを特徴とするプログラム
処理時間の測定方式。
Claim 1: A device in which a microprocessor performs control and data processing according to a program, comprising a first counter that measures the total processing time of the program from the start of measurement to the end of the measurement, and a first counter that measures the execution time of a specified specific program. a second counter that reads the count values of the first counter and the second counter and calculates a ratio of the specific program execution time to the total processing time of the program. Processing time measurement method.
JP3121562A 1991-05-28 1991-05-28 Measuring system for program processing time Pending JPH04349543A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3121562A JPH04349543A (en) 1991-05-28 1991-05-28 Measuring system for program processing time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3121562A JPH04349543A (en) 1991-05-28 1991-05-28 Measuring system for program processing time

Publications (1)

Publication Number Publication Date
JPH04349543A true JPH04349543A (en) 1992-12-04

Family

ID=14814309

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3121562A Pending JPH04349543A (en) 1991-05-28 1991-05-28 Measuring system for program processing time

Country Status (1)

Country Link
JP (1) JPH04349543A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6930960B2 (en) * 2002-03-27 2005-08-16 Hitachi, Ltd. Execution time measurement device in a control unit and an execution time measurement method
US8700956B2 (en) 2010-11-29 2014-04-15 Denso Corporation Microcomputer

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6930960B2 (en) * 2002-03-27 2005-08-16 Hitachi, Ltd. Execution time measurement device in a control unit and an execution time measurement method
US8700956B2 (en) 2010-11-29 2014-04-15 Denso Corporation Microcomputer

Similar Documents

Publication Publication Date Title
JP2806524B2 (en) Vector operation instruction issue control method
JPH04349543A (en) Measuring system for program processing time
JPS5848162A (en) System for measurement terminal response time
JPH0229457Y2 (en)
JPH0251749A (en) Circuit for measuring processor application rate
JPH0566974A (en) Cpu load factor measuring circuit
JPS5822463A (en) Computer load measuring instrument
JPS607554A (en) Measuring system for performance of computer system
JPS59116864A (en) Measurement system for use rate of central processing unit
KR950013602B1 (en) Frequency measuring device
JPH05233022A (en) Input/output responsing time confirming method for programmable controller
JPH0535889A (en) Microprocessor circuit
JPS61276039A (en) Processor using ratio measuring system
SU1485152A1 (en) Impedance parameter microprocessor meter
JPH048823B2 (en)
JPH034945Y2 (en)
JPH0810881Y2 (en) Error rate counter for DAT
RU46596U1 (en) INFORMATION SYSTEM QUALITY MANAGEMENT MODEL
JPS63156424A (en) Pulse count circuit
JPH02236645A (en) System for measuring memory state in use of process
JPS60254340A (en) Device for measuring instruction execution time of information processor
JP2663482B2 (en) Measurement circuit
JPH0296848A (en) Method for measuring execution time of instruction
JP2000148536A (en) Method and circuit for interruption
JPS59221710A (en) Measuring system for arithmetic processing time of sequence program