JPH01211048A - Measuring system for executing instruction number of program - Google Patents

Measuring system for executing instruction number of program

Info

Publication number
JPH01211048A
JPH01211048A JP63036275A JP3627588A JPH01211048A JP H01211048 A JPH01211048 A JP H01211048A JP 63036275 A JP63036275 A JP 63036275A JP 3627588 A JP3627588 A JP 3627588A JP H01211048 A JPH01211048 A JP H01211048A
Authority
JP
Japan
Prior art keywords
instruction
trap
branch
program
instructions
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
JP63036275A
Other languages
Japanese (ja)
Inventor
Naoto Ishikura
石倉 直人
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 JP63036275A priority Critical patent/JPH01211048A/en
Publication of JPH01211048A publication Critical patent/JPH01211048A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To effectively measure the number of necessary executing instructions by replacing a branch instruction stored in a program with a trap instruction, applying an interruption for each execution of a trap instruction, and counting the number of instructions including the preceding trap instruction and its subsequent ones. CONSTITUTION:A branch instruction stored in an object program 1 is retrieved (2) and replaced with a trap instruction (3). At the same time, the address of the trap instruction and the branch instruction are stored in a table (5). When the program and then the trap instructions are carried out, the program state is temporarily held (6). The number of instructions received from the address (8) pointed by said branch instruction are counted (7) and added to the previous count value (9). Then the branch instruction is read (10) out of the trap instruction for calculation (11) of the branch destination. This calculated address is stored (8) and the program 1 is restarted.

Description

【発明の詳細な説明】 (産業上の利用分野〕 本発明はプログラムの性能測定方式に間し、特にプログ
ラムの実行命令数の測定方式に関するものである。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a method for measuring the performance of a program, and particularly to a method for measuring the number of executed instructions of a program.

〔従来の技術〕[Conventional technology]

新規に開発したプログラム等の性能測定の一つとして、
所定の処理を遂行するのに必要な実行命令数の測定があ
る。
As one of the performance measurements of newly developed programs, etc.
There is a measurement of the number of execution instructions required to perform a predetermined process.

このようなプログラムの実行命令数の測定・は、従来、
ハードウェアの動作モードとして全命令毎にソフトウェ
アへの割込みを発生させる機能を持つ電子計算機を使用
し、その割込み回数をソフトウェアでカウントするとい
う方式が一般的であった。
Measuring the number of executed instructions of such a program has traditionally been
A common hardware operating mode was to use an electronic computer with the function of generating an interrupt to software for every instruction, and to count the number of interrupts using software.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

しかし、上述した従来の方式では、全命令毎にソフトウ
ェアへ割込みを発生させる機能を持つ電子計算機に通用
が限定され、そのような機能を持たない一般の電子計算
機上での測定は困難である。
However, the conventional method described above is only applicable to electronic computers that have the function of generating an interrupt to software for every instruction, and it is difficult to measure on a general electronic computer that does not have such a function.

また、全命令に対して割込みを発生させる方式では、シ
ステム全体のパフォーマンスを著しく低下させる。なお
、特定の命令(例えば分岐命令)のみで割込みを発生さ
せることも原理的には可能であるが、命令の種類に応じ
て割込みを発生させるか否かを判定する判定回路の組込
みのためハードウェアコストの上昇を招いてしまうと共
に、より著しく適用可能な電子計算機が限定される。
Furthermore, the system in which interrupts are generated for all instructions significantly degrades the performance of the entire system. Although it is theoretically possible to generate an interrupt only with a specific instruction (for example, a branch instruction), it is necessary to incorporate a judgment circuit that determines whether or not to generate an interrupt depending on the type of instruction. This results in an increase in hardware costs, and further limits the number of computers to which it can be applied.

本発明の目的は、一般の電子計算機が有する基本的なト
ラップ機構を使用して効率良くプログラムの実行命令数
の測定が行える方式を提供することにある。
An object of the present invention is to provide a method that can efficiently measure the number of executed instructions of a program using a basic trap mechanism that general electronic computers have.

〔課題を解決するための手段〕[Means to solve the problem]

本発明は上記目的を達成するために、 電子計算機上で実行されるプログラムの実行命令数を測
定する方式において、 前記プログラム中に存在する分岐命令を検索する分岐命
令検索手段と、 該分岐命令検索手段で検索された分岐命令をトラップ命
令に置換えるトラップ命令埋込み手段と、該トラップ命
令埋込み手段によりトラップ命令に置換えられた元の分
岐命令をそのアドレスと共に格納するトラップ管理テー
ブルと、 トラップ命令実行時に起動され該トラップ命令のアドレ
ス、前記分岐命令の動作を決定付ける電子計算機の状態
レジスタの内容を含むプログラム状態を保存するプログ
ラム状態保存手段と、実行命令数を記録する命令数カウ
ンタと、命令数計算の開始位置を示す開始命令アドレス
レジスタと、 該開始命令アドレスレジスタに示される開始位置から前
記プログラム状態保存手段で保存された今回のトランプ
命令のアドレスまでの範囲に含まれる命令数を計算し、
その結果を前記命令数カウンタに加算する命令数カウン
ト手段と、前記トラップ管理テーブルより今回のトラッ
プ命令に対応する元の分岐命令を見つけ出すトラップ管
理テーブル検索手段と、 該トラップ管理テーブル検索手段により得られた元の分
岐命令と、前記プログラム状態保存手段により保存され
たトラップ実行時の状態レジスタの内容により、分岐命
令を実行した結果、次にどの命令から実行するかを決め
、決定した実行先命令のアドレスを前記開始命令アドレ
スレジスタに設定する分岐先アドレス計算手段と、 該分岐先アドレス計算手段で求められた前記分岐先アド
レスから前記プログラムの実行を再開させる再開手段を
有する。
In order to achieve the above object, the present invention provides a system for measuring the number of executed instructions of a program executed on an electronic computer, comprising: a branch instruction search means for searching for branch instructions existing in the program; and a branch instruction search means for searching for branch instructions existing in the program. trap instruction embedding means for replacing a branch instruction retrieved by the trap instruction with a trap instruction; a trap management table for storing the original branch instruction replaced by the trap instruction by the trap instruction embedding means together with its address; a program state storage means for storing a program state including the address of the activated trap instruction and the contents of a state register of an electronic computer that determines the operation of the branch instruction; an instruction number counter for recording the number of executed instructions; and an instruction number calculation. a start instruction address register indicating the start position of the start instruction address register; and calculating the number of instructions included in the range from the start position indicated in the start instruction address register to the address of the current playing card instruction stored by the program state storage means;
instruction number counting means for adding the result to the instruction number counter; trap management table search means for finding the original branch instruction corresponding to the current trap instruction from the trap management table; As a result of executing the branch instruction, it is determined which instruction should be executed next based on the original branch instruction and the contents of the state register at the time of trap execution saved by the program state saving means, and the instruction to be executed is determined. The branch destination address calculation means sets an address in the start instruction address register, and the restart means resumes execution of the program from the branch destination address determined by the branch destination address calculation means.

〔作用〕[Effect]

実行命令数を測定しようとするプログラムの実行に先立
って、分岐命令検索手段によりそのプログラム中に含ま
れる分岐命令が検索され、トラップ命令埋込み手段によ
りその分岐命令がトラップ命令に置換えられる。また、
トラップ命令に置換えられた元の分岐命令とそのアドレ
スとがトラップ管理テーブルに格納される。
Prior to execution of a program whose number of executed instructions is to be measured, a branch instruction search means searches for a branch instruction included in the program, and a trap instruction embedding means replaces the branch instruction with a trap instruction. Also,
The original branch instruction replaced by the trap instruction and its address are stored in the trap management table.

プログラムの実行を開始すると、そこに埋込まれたトラ
ップ命令の実行時に割込みが発生し、プログラム状態保
存手段により、そのトラップ命令のアドレス、状態レジ
スタの内容を含むプログラム状態が保存される。この後
、命令数カウント手段により、開始命令アドレスレジス
タに保持されていた開始命令アドレスから今回のトラッ
プ命令のアドレスまでの範囲に含まれる命令の数が計算
され、その計算値が命令数カウンタに累積される。
When the execution of the program is started, an interrupt occurs when a trap instruction embedded therein is executed, and the program state including the address of the trap instruction and the contents of the state register is saved by the program state saving means. After this, the number of instructions counting means calculates the number of instructions included in the range from the start instruction address held in the start instruction address register to the address of the current trap instruction, and the calculated value is accumulated in the number of instructions counter. be done.

また、トラップ管理テーブル検索手段により今回のトラ
ップ命令に対応する元の分岐命令が見つけられ、この元
の分岐命令とプログラム状態保存手段により保存された
トラップ実行時の状態レジスタの内容とに基づき、その
元の分岐命令の次にどの命令を実行すべきかが決定され
る。この決定された命令のアドレスは次回のトラップ時
における命令数の算出用として開始命令アドレスレジス
タに保持されると共に再開手段に渡される。再開手段は
、この渡された分岐先アドレスからプログラムの実行を
再開させる0以上のような処理がトラップ命令により発
生する割込み毎に行われることで、プログラムの実行命
令数が命令数カウンタの累積値として求められる。
Furthermore, the trap management table search means finds the original branch instruction corresponding to the current trap instruction, and based on this original branch instruction and the contents of the state register at the time of trap execution saved by the program state storage means, the original branch instruction corresponding to the current trap instruction is found. It is determined which instruction should be executed next to the original branch instruction. The address of this determined instruction is held in the start instruction address register for calculating the number of instructions at the next trap, and is also passed to the restart means. The restarting means restarts the execution of the program from the passed branch destination address by performing 0 or more processing for each interrupt generated by the trap instruction, so that the number of executed instructions of the program is reduced to the cumulative value of the instruction number counter. It is required as.

〔実施例〕〔Example〕

次に本発明の実施例について図面を参照して説明する。 Next, embodiments of the present invention will be described with reference to the drawings.

第1図は本発明のプログラムの実行命令数測定方式の一
実施例の構成図である。
FIG. 1 is a block diagram of an embodiment of a method for measuring the number of executed instructions of a program according to the present invention.

本実施例は、実行命令数の測定対象とするオブジェクト
プログラムlと、分岐命令検索手段2と、トラップ命令
埋込み手段3と、トラップ管理テーブル5と、プログラ
ム状態保存手段6と、命令数カウント手段7と、開始命
令アドレスレジスタ8と、命令数カウンタ9と、トラッ
プ管理テーブル検索手段10と、分岐先アドレス計算手
段11と、再開手段12と、命令数カウンタ9の内容を
出力する表示装置あるいはプリンタ装置等の出力手段1
3とで構成されている。オブジェクトプログラム1中に
は幾つかの分岐命令4が含まれ、これらが後述するよう
にしてトラップ命令4゛に置換えられる。
This embodiment includes an object program l whose number of executed instructions is to be measured, a branch instruction search means 2, a trap instruction embedding means 3, a trap management table 5, a program state storage means 6, and an instruction number counting means 7. , a start instruction address register 8 , an instruction number counter 9 , a trap management table search means 10 , a branch destination address calculation means 11 , a restart means 12 , and a display device or printer device for outputting the contents of the instruction number counter 9 etc. output means 1
It is composed of 3. The object program 1 includes several branch instructions 4, which are replaced with trap instructions 4' as described later.

第2図はオブジェクトプログラム1の一部の内容例を示
し、命令C11=C1iからなるブロックL1.命令C
21〜C2jからなるブロックL2、命令C31〜C3
kからなるブロックし3を含む、 OP 11−OP 
1 t、 OP、21〜OP2 j。
FIG. 2 shows an example of the contents of a part of the object program 1, in which blocks L1. Command C
Block L2 consisting of 21 to C2j, instructions C31 to C3
Block consisting of k and including 3, OP 11-OP
1 t, OP, 21-OP2 j.

0P31〜OP3には各命令の命令コード(オペレージ
コンコード)であり、そのうち0P1iと0P3kが分
岐命令の命令コードである。第2図に示すオブジェクト
プログラム部分は、命令C11から実行を開始した場合
、命令C12,・・・、C1iと実行し、この分岐命令
C1iの実行によって、命令C21あるいは命令C31
に分岐し、命令C21に分岐したときは命令C22,・
・・、命令C2j、命令C31,・・・、命令C3にへ
と進み、命令C31に分岐したときは命令C21−C2
jをパスして命令C31,・・・、C3にへと進む。
0P31 to OP3 are instruction codes (operation code) of each instruction, among which 0P1i and 0P3k are instruction codes of branch instructions. When the object program part shown in FIG. 2 starts execution from instruction C11, it executes instructions C12,..., C1i, and by executing this branch instruction C1i, instruction C21 or instruction C31
When branching to instruction C21, instruction C22, .
..., instruction C2j, instruction C31, ..., progresses to instruction C3, and when branching to instruction C31, instructions C21-C2
j and proceeds to instructions C31, . . . , C3.

次に、本実施例の動作を各図を参照して具体的に説明す
る。
Next, the operation of this embodiment will be specifically explained with reference to each figure.

例えば、オブジェクトプログラム1を電子計算機の仮想
記憶上にあるプログラム、プログラム状態保存手段6を
ハードウェアまたはファームウェアで実現されたトラッ
プ処理機構、分岐命令検索手段2.トラップ命令埋込み
手段3.命令数カウント手段7.トラップ管理テーブル
検索手段10゜分岐先アドレス計算手段11.再開手段
12を当該計算機上で動作するプログラム、トラップ管
理テーブル5.開始命令アドレスレジスタ8.命令数カ
ウンタ9を主記憶上に確保された領域であるとする。
For example, the object program 1 is a program on the virtual memory of an electronic computer, the program state storage means 6 is a trap processing mechanism realized by hardware or firmware, the branch instruction search means 2. Trap instruction embedding means 3. Instruction number counting means 7. Trap management table search means 10° branch destination address calculation means 11. The restart means 12 is a program running on the computer, a trap management table5. Start instruction address register8. It is assumed that the instruction number counter 9 is an area secured on the main memory.

オブジェクトプログラム1が仮想記憶上にロードされる
と、分岐命令検索手段2は、そのオブジェクトプログラ
ム1を読み、分岐命令を探す、−般に、命令は命令コー
ドとそれに続(オペランドフィールドとから構成され、
電子計算機によってはオペランドフィールドの長さはそ
の命令コードにより決まる。従って、このような電子計
算機であれば、プログラムの先頭から順次命令コードを
探索することができ、その命令コードが分岐命令のコー
ドであるか否かを調べることによって、分岐命令を探し
出すことができる。
When the object program 1 is loaded onto the virtual memory, the branch instruction search means 2 reads the object program 1 and searches for a branch instruction.In general, an instruction consists of an instruction code and its successor (operand field). ,
Depending on the electronic computer, the length of the operand field is determined by its instruction code. Therefore, with such an electronic computer, it is possible to search for instruction codes sequentially from the beginning of the program, and by checking whether the instruction code is a branch instruction code, it is possible to find a branch instruction. .

このようにして探し出された分岐命令は、トラップ命令
埋込み手段3によってトラップ命令に置換えられる0例
えば第一2図の例では、分岐命令C1i、C3k(7)
命令:y −FOP 1 t、 op 3 k;6(そ
れぞれトラップ命令Bl、B、2に置換えられる。
The branch instructions found in this way are replaced with trap instructions by the trap instruction embedding means 3. For example, in the example of FIG. 12, branch instructions C1i, C3k (7)
Instructions: y-FOP 1 t, op 3 k; 6 (replaced with trap instructions Bl, B, 2, respectively.

このとき、トラップ命令埋込み手段3は、トラップ管理
テーブル5に、その命令アドレスと、トラップ命令によ
って置換えられた元の分岐命令を格納する。また、トラ
ップ命令埋込み手段3は、全分岐命令をトラップ命令で
置換えた後、オブジェクトプログラム1の実行を開始さ
せる。
At this time, the trap instruction embedding means 3 stores the instruction address and the original branch instruction replaced by the trap instruction in the trap management table 5. Further, the trap instruction embedding means 3 starts execution of the object program 1 after replacing all branch instructions with trap instructions.

オブジェクトプログラム1の実行が開始され、そこに埋
込まれたトラップ命令が実行されると、プログラム状態
保存手段6が起動され、そのトラップ命令のアドレス、
このトラップ命令で置換された元の分岐命令の動作を決
定付ける電子計算機の状態レジスタの内容を含むプログ
ラム状態が保存される。このような動作を行うプログラ
ム状態保存手段6つまりトラップ処理機構は、通常の電
子計算機(マシン)には−船釣に備えられているもので
ある。
When execution of the object program 1 is started and the trap instruction embedded therein is executed, the program state storage means 6 is activated and stores the address of the trap instruction,
The program state, including the contents of the computer's state registers, determining the behavior of the original branch instruction replaced by this trap instruction is saved. The program state storage means 6, ie, the trap processing mechanism, which performs such operations is provided in ordinary electronic computers (machines) for boat fishing.

プログラムのトラップ命令実行時の状態が保存された後
、命令数カウント手段7は、開始命令アドレスレジスタ
8の指している命令から、現トラップ命令までの命令数
をカウントする。このときの動作を第2図を参照して説
明する。
After the state of the program at the time of execution of the trap instruction is saved, the instruction number counting means 7 counts the number of instructions from the instruction pointed to by the start instruction address register 8 to the current trap instruction. The operation at this time will be explained with reference to FIG.

いま、時刻tQにおいて、命令コードOpHを含む命令
C1lよりプログラムの実行が始まるとし、命令C1l
の命令アドレスが開始命令アドレスレジスタ8に格納さ
れているものとして、第2図の時刻t1において分岐命
令C1iに置換えられたトラップ命令Blによって命令
数カウント手段7が起動されたものとする。
Now, at time tQ, it is assumed that the program execution starts from the instruction C1l containing the instruction code OPH, and the execution of the program starts from the instruction C1l including the instruction code OpH.
It is assumed that the instruction address is stored in the start instruction address register 8, and the instruction number counting means 7 is activated by the trap instruction Bl replaced by the branch instruction C1i at time t1 in FIG.

命令数カウント手段7は、プログラム状態保存手段6が
保存している命令アドレスレジスタにより、命令コード
0P1tを含む命令C1iの命令アドレスを知ることが
できる。従って、命令コード0PIIを含む命令C1l
から命令コード0P11を含む命令CI+までのブロッ
クLLの中の命令数をカウントすることにより、時刻t
oから時刻t1までの間に実行された命令数を知ること
ができる。実行命令数のカウントは、命令コードにより
命令長が分かるので、命令コード0P11を含む命令C
1lのアドレスから命令コードoP1iを含む命令C1
iのアドレスまでの間の領域を1命令ずつ区切って行く
ことにより可能である。
The instruction number counting means 7 can know the instruction address of the instruction C1i including the instruction code 0P1t from the instruction address register stored in the program state storage means 6. Therefore, the instruction C1l containing the instruction code 0PII
By counting the number of instructions in block LL from to instruction CI+ containing instruction code 0P11, time t
The number of instructions executed between o and time t1 can be known. To count the number of executed instructions, the instruction length can be determined by the instruction code, so the instruction C including instruction code 0P11
Instruction C1 including instruction code oP1i from address 1l
This is possible by dividing the area up to address i one instruction at a time.

命令数カウント手段7は、このようにして得た実行命令
数を命令数カウンタ9に加算していく。
The instruction number counting means 7 adds the thus obtained number of executed instructions to the instruction number counter 9.

今回の実行命令数のカウントを終えると、次にトラップ
管理テーブル検索手段10が起動され、トラップ管理テ
ーブル検索手段lOはトラップ命令アドレスをキーにし
てトラップ管理テーブル5を検索し、現トラップ命令に
置換えられた元の分岐命令を得る。
After counting the number of executed instructions this time, the trap management table search means 10 is activated next, and the trap management table search means 1O searches the trap management table 5 using the trap instruction address as a key, and replaces it with the current trap instruction. Get the original branch instruction.

続いて分岐アドレス計算手段11が起動され、分岐アド
レス計算手段11は、次に実行が開始される命令のアド
レス(分岐先アドレス)を計算し、そのアドレスで開始
命令アドレスレジスタ8の内容を更新すると共に再開手
段12へ通知し、再開手段12は中断されたオブジェク
トプログラム1の状態を図示しないCPUのレジスタ等
に復元し、通知された分岐先アドレスを命令カウンタに
設定する処理等を行うことにより、オブジェクトプログ
ラム1の実行を再開させる0以上の処理を再び第2図を
参照して説明する。
Subsequently, the branch address calculation means 11 is activated, and the branch address calculation means 11 calculates the address of the next instruction to be executed (branch destination address), and updates the contents of the start instruction address register 8 with that address. At the same time, the restarting means 12 is notified of this, and the restarting means 12 restores the state of the interrupted object program 1 to a register of the CPU (not shown), and sets the notified branch destination address in the instruction counter. The zero or more processes for restarting the execution of the object program 1 will be explained with reference to FIG. 2 again.

時刻t1において起動された分岐アドレス計算手段11
は、プログラム状態保存手段6により保存された状態レ
ジスタと、トラップ管理テーブル検索手段10により得
た分岐命令の形式により、次に実行すべき命令が命令コ
ード0P21を含む命令C21か命令コード0P31を
含む命令C31かを決定し、そのアドレスを開始命令ア
ドレスレジスタ8に格納すると共に、このアドレスを渡
して再開手段12を起動する。再開手段12は起動され
ると、その通知された分岐先アドレスにオブジェクトプ
ログラム1の実行の制御を渡す、これにより、その分岐
先アドレスからオブジェクトプログラム1の実行が再開
される。この場合において、命令コード0P1iの次に
実行されるトラップ命令は命令コードOP3にと置換さ
れたトラップ命令B2である。そこで、時刻t2におい
て命令コードOP3にと置換されたトラップ命令B2が
実行され、再び命令数カウント手段7が起動された場合
を考えてみる。
Branch address calculation means 11 activated at time t1
According to the state register saved by the program state storage means 6 and the format of the branch instruction obtained by the trap management table search means 10, the next instruction to be executed is either instruction C21 containing instruction code 0P21 or instruction C21 containing instruction code 0P31. The instruction C31 is determined and its address is stored in the start instruction address register 8, and this address is passed to start the restart means 12. When the resuming means 12 is activated, it passes control of the execution of the object program 1 to the notified branch destination address, thereby restarting the execution of the object program 1 from the branch destination address. In this case, the trap instruction executed next to the instruction code 0P1i is the trap instruction B2, which is replaced with the instruction code OP3. Therefore, let us consider a case where the trap instruction B2 replaced with the instruction code OP3 is executed at time t2, and the instruction number counting means 7 is activated again.

命令コード0PIIを含む命令C1iの次に実行される
命令が命令コード○P21を含む命令C21の場合は、
開始命令アドレスレジスタ8は命令コード0P21のア
ドレスを指しているので、前に説明したと同様にしてブ
ロックし2とブロックL3に含まれる命令の数がカウン
トされる。逆に命令コード0P1iを含む命令C1iの
次に実行される命令が命令コード0P31を含む命令C
31の場合は、開始命令アドレスレジスタ8が命令コー
ド0P31を指しているので、ブロックL3に含まれる
命令の数がカウントされる。
If the instruction executed next to the instruction C1i containing the instruction code 0PII is the instruction C21 containing the instruction code ○P21,
Since the start instruction address register 8 points to the address of instruction code 0P21, the number of instructions included in block 2 and block L3 is counted in the same manner as described above. Conversely, the instruction executed next to the instruction C1i containing the instruction code 0P1i is the instruction C containing the instruction code 0P31.
In the case of 31, the start instruction address register 8 points to instruction code 0P31, so the number of instructions included in block L3 is counted.

以上のようにして順次開始命令アドレスレジスタ8を更
新し、それが指す命令から実行されたトラップ命令まで
の命令数をカウントし、命令数カウンタ9に加算して行
くことにより、命令数カウンタ9は最終的にオブジェク
トプログラム1の実行命令数を示すことになる。
As described above, by sequentially updating the start instruction address register 8, counting the number of instructions from the instruction pointed to by the start instruction address register 8 to the executed trap instruction, and adding it to the instruction number counter 9, the instruction number counter 9 is Ultimately, it indicates the number of executed instructions of the object program 1.

この命令数カウンタ9の内容は出力手段13により操作
員等に通知される。
The contents of the instruction number counter 9 are notified to the operator etc. by the output means 13.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、本発明は、被測定対象のプログラ
ム内の分岐命令をトラップ命令に置換え、そのトラップ
命令の実行で割込みが発生する度に、直前の時点からの
命令数をカウントし加算していくことにより、全体の実
行命令数を得ることができる。この方式によれば、実行
命令数の測定機構が動作するのは分岐命令の箇所のみで
あり、性能低下を少なくすることができる他、基本的な
トラップ機構を用いてソフトウェアで実現することがで
き、ハードウェアモデルに依存しない方式とすることが
できる効果がある。
As explained above, the present invention replaces a branch instruction in a program to be measured with a trap instruction, and each time an interrupt occurs due to execution of the trap instruction, the number of instructions from the immediately previous point is counted and added. By doing so, the total number of executed instructions can be obtained. According to this method, the mechanism for measuring the number of executed instructions operates only at branch instructions, which reduces performance degradation and can be implemented in software using a basic trap mechanism. This has the advantage of being a method that does not depend on the hardware model.

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

第1図は本発明の実施例の構成図および、第2図はオブ
ジェクトプログラム1の一部の内容例を示す図である。 図において、 ■・・・オブジェクトプログラム 2・・・分岐命令検索手段 3・・・トラップ命令埋込み手段 4・・・分岐命令 4”・・・トラップ命令 5・・・トラップ管理テーブル 6・・・プログラム状態保存手段 7・・・命令数カウント手段 8・・・開始命令アドレスレジスタ 9・・・命令数カウンタ 10・・・トラップ管理テーブル検索手段11・・・分
岐先アドレス計算手段 12・・・再開手段 13・・・出力手段
FIG. 1 is a block diagram of an embodiment of the present invention, and FIG. 2 is a diagram showing an example of the contents of a part of an object program 1. As shown in FIG. In the figure, ■...Object program 2...Branch instruction search means 3...Trap instruction embedding means 4...Branch instruction 4''...Trap instruction 5...Trap management table 6...Program State storage means 7...Instruction number counting means 8...Start instruction address register 9...Instruction number counter 10...Trap management table search means 11...Branch destination address calculation means 12...Resuming means 13... Output means

Claims (1)

【特許請求の範囲】 電子計算機上で実行されるプログラムの実行命令数を測
定する方式において、 前記プログラム中に存在する分岐命令を検索する分岐命
令検索手段と、 該分岐命令検索手段で検索された分岐命令をトラップ命
令に置換えるトラップ命令埋込み手段と、該トラップ命
令埋込み手段によりトラップ命令に置換えられた元の分
岐命令をそのアドレスと共に格納するトラップ管理テー
ブルと、 トラップ命令実行時に起動され該トラップ命令のアドレ
ス、前記分岐命令の動作を決定付ける電子計算機の状態
レジスタの内容を含むプログラム状態を保存するプログ
ラム状態保存手段と、実行命令数を記録する命令数カウ
ンタと、 命令数計算の開始位置を示す開始命令アドレスレジスタ
と、 該開始命令アドレスレジスタに示される開始位置から前
記プログラム状態保存手段で保存された今回のトラップ
命令のアドレスまでの範囲に含まれる命令数を計算し、
その結果を前記命令数カウンタに加算する命令数カウン
ト手段と、 前記トラップ管理テーブルより今回のトラップ命令に対
応する元の分岐命令を見つけ出すトラップ管理テーブル
検索手段と、 該トラップ管理テーブル検索手段により得られた元の分
岐命令と、前記プログラム状態保存手段により保存され
たトラップ実行時の状態レジスタの内容により、分岐命
令を実行した結果、次にどの命令から実行するかを決め
、決定した実行先命令のアドレスを前記開始命令アドレ
スレジスタに設定する分岐先アドレス計算手段と、 該分岐先アドレス計算手段で求められた前記分岐先アド
レスから前記プログラムの実行を再開する再開手段を具
備したことを特徴とするプログラムの実行命令数測定方
式。
[Claims] A method for measuring the number of executed instructions of a program executed on an electronic computer, comprising: branch instruction search means for searching for branch instructions existing in the program; and branch instruction search means for searching for branch instructions existing in the program; trap instruction embedding means for replacing a branch instruction with a trap instruction; a trap management table for storing the original branch instruction replaced by the trap instruction by the trap instruction embedding means together with its address; a program state storage means for storing a program state including the address of the branch instruction and the contents of a state register of the electronic computer that determines the operation of the branch instruction; an instruction number counter for recording the number of executed instructions; and an instruction number counter indicating a starting position for calculating the number of instructions. calculating a start instruction address register and the number of instructions included in the range from the start position indicated in the start instruction address register to the address of the current trap instruction saved by the program state storage means;
instruction number counting means for adding the result to the instruction number counter; trap management table search means for finding the original branch instruction corresponding to the current trap instruction from the trap management table; As a result of executing the branch instruction, it is determined which instruction should be executed next based on the original branch instruction and the contents of the state register at the time of trap execution saved by the program state saving means, and the instruction to be executed is determined. A program comprising: branch destination address calculation means for setting an address in the start instruction address register; and restart means for restarting execution of the program from the branch destination address determined by the branch destination address calculation means. A method for measuring the number of executed instructions.
JP63036275A 1988-02-18 1988-02-18 Measuring system for executing instruction number of program Pending JPH01211048A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63036275A JPH01211048A (en) 1988-02-18 1988-02-18 Measuring system for executing instruction number of program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63036275A JPH01211048A (en) 1988-02-18 1988-02-18 Measuring system for executing instruction number of program

Publications (1)

Publication Number Publication Date
JPH01211048A true JPH01211048A (en) 1989-08-24

Family

ID=12465222

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63036275A Pending JPH01211048A (en) 1988-02-18 1988-02-18 Measuring system for executing instruction number of program

Country Status (1)

Country Link
JP (1) JPH01211048A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011237841A (en) * 2010-04-30 2011-11-24 Fujitsu Ltd Verification support program, verification support device, and verification support method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011237841A (en) * 2010-04-30 2011-11-24 Fujitsu Ltd Verification support program, verification support device, and verification support method

Similar Documents

Publication Publication Date Title
JPS63175934A (en) Data processor
JP4243463B2 (en) Instruction scheduling simulation method and simulation system
JPH01211048A (en) Measuring system for executing instruction number of program
JPH1196006A (en) Information processor
JPH04288625A (en) Microcomputer
JP2000076095A (en) Device and method for tracing program and storage medium storing program therefor
JP2536615B2 (en) Information processing device
JP2853460B2 (en) Data loading method and arithmetic processor using the same
KR950011476B1 (en) An electronic exchager
JPS61233838A (en) Information processor
JPH0580691B2 (en)
JP2584528Y2 (en) Information processing device
JPS59189452A (en) Queue structure for data processor
JP3079238B2 (en) Debug device
JPS6379138A (en) Information processor
JPH0769816B2 (en) Data processing device
JP2020038502A (en) Arithmetic processing device, information processing device, and control method for information processing device
JPH0540654A (en) Optional instruction tracing system
JPS6149695B2 (en)
JPH06295252A (en) Computer
JPH05313924A (en) Measuring mechanism for virtual computer
JPH04140881A (en) Information processor
JPH03269640A (en) Virtual computer system
JPH02235152A (en) Information processor
JPH08153026A (en) Method for measuring program performance evaluation data and measuring device therefor