JP2008090699A - Trace logging method, apparatus and program - Google Patents
Trace logging method, apparatus and program Download PDFInfo
- Publication number
- JP2008090699A JP2008090699A JP2006272512A JP2006272512A JP2008090699A JP 2008090699 A JP2008090699 A JP 2008090699A JP 2006272512 A JP2006272512 A JP 2006272512A JP 2006272512 A JP2006272512 A JP 2006272512A JP 2008090699 A JP2008090699 A JP 2008090699A
- Authority
- JP
- Japan
- Prior art keywords
- execution
- trace log
- trace
- storage device
- program
- 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
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
【課題】 プログラマが事前に予測できなかった稀な状況やコンピュータシステムの負荷状態に応じてトレースログ出力を制御することが可能な技術を提供する。
【解決手段】 プログラム実行時のトレースログを出力するトレースロギング方法において、プログラムの実行時にその動的な情報を示す実行時情報の計測を行ってその計測された実行時情報を記憶装置に格納するステップと、前記記憶装置に格納した実行時情報である計測値を読み出してその計測値を評価するための評価値を計算し、その計算した評価値がポリシー定義テーブルで指定される閾値条件を満たす場合にトレースログを記憶装置へ出力するステップとを有するものである。
【選択図】図1PROBLEM TO BE SOLVED: To provide a technique capable of controlling trace log output according to a rare situation that a programmer could not predict in advance or a load state of a computer system.
In a trace logging method for outputting a trace log at the time of program execution, runtime information indicating dynamic information is measured at the time of program execution, and the measured runtime information is stored in a storage device. And reading the measurement value, which is runtime information stored in the storage device, and calculating an evaluation value for evaluating the measurement value, and the calculated evaluation value satisfies a threshold condition specified in the policy definition table And a step of outputting a trace log to a storage device.
[Selection] Figure 1
Description
本発明はプログラム実行時のトレースログを出力するトレースロギング技術に関するものである。 The present invention relates to a trace logging technique for outputting a trace log during program execution.
従来、プログラムの実行時の状態を示すトレースログの出力を行う場合、特許文献1に記載の様に、プログラムが処理の対象とするデータのみをトレースログ出力の判定基準としてきた。すなわち、特許文献1のデータトレース方式では、トレースデータの出力を行なうか否かを、プログラム実行中におけるデータが、予め定めるトレース出力条件を満足するか否かによって判断しており、例えば、プログラムaにおいて、トランザクションの入力データが“A”或いは“B”と等しければトレースデータを採取する等、あるデータが事前に想定可能な値に該当する場合にトレースデータを採取している。
Conventionally, when outputting a trace log indicating a state at the time of execution of a program, as described in
上記従来技術ではプログラムは事前に想定可能な範囲のデータのみを処理の対象とするため、この方法ではトレースログ出力の条件も事前に想定可能な範囲に制限されてしまう。プログラマが事前に想定できなかった状況が発生した場合には、トレースログの出力はできないという問題がある。 In the above prior art, since the program targets only data in a range that can be assumed in advance, this method limits the conditions for outputting the trace log to a range that can be assumed in advance. There is a problem that the trace log cannot be output if a situation occurs that the programmer could not assume in advance.
また、上記従来技術ではトレースログの出力量は処理対象のデータのみに依存し、コンピュータシステムの負荷状態を無視してしまう。このため、コンピュータシステムが高負荷状態にある場合に、負荷を軽減させる為にトレースログの出力量を抑制することができないという問題もある。 Further, in the above prior art, the output amount of the trace log depends only on the data to be processed, and ignores the load state of the computer system. For this reason, when the computer system is in a high load state, there is also a problem that the output amount of the trace log cannot be suppressed in order to reduce the load.
本発明の目的は上記問題を解決し、プログラマが事前に予測できなかった稀な状況やコンピュータシステムの負荷状態に応じてトレースログ出力を制御することが可能な技術を提供することにある。 An object of the present invention is to solve the above problems and provide a technique capable of controlling trace log output according to a rare situation that a programmer could not predict in advance or a load state of a computer system.
本発明は、プログラム実行時のトレースログを出力するトレースロギング装置において、プログラムの動的な実行時情報に応じてトレースログの出力を行うものである。 The present invention outputs a trace log in accordance with dynamic runtime information of a program in a trace logging apparatus that outputs a trace log during program execution.
本発明のトレースロギング装置では、トレースロギングの行われるプログラムを実行する際に、その動的な情報を示す実行時情報として、当該プログラムが分岐命令でどの分岐先に何回分岐したのかを計測する。そして分岐先毎の分岐回数の割合、即ち分岐確率を評価値として算出し、その算出した分岐確率がある値以下である場合にトレースログを出力する。 In the trace logging device according to the present invention, when executing a program for which trace logging is performed, the execution time information indicating the dynamic information is measured as to how many times the program branches to which branch destination by a branch instruction. . Then, the ratio of the number of branches for each branch destination, that is, the branch probability is calculated as an evaluation value, and a trace log is output when the calculated branch probability is less than a certain value.
また本発明のトレースロギング装置では、プログラムの目的処理の実行の為に費やした実行ステップ数と、トレースログ出力処理の実行の為に費やした実行ステップ数を測定する。両者の比率がシステムの負荷状態によって決まるある値以上である場合に、トレースログ出力を抑制する。 In the trace logging apparatus according to the present invention, the number of execution steps spent for executing the target process of the program and the number of execution steps spent for executing the trace log output process are measured. Trace log output is suppressed when the ratio between the two is greater than a certain value determined by the load state of the system.
前記の様に本発明では、プログラムの実行時の分岐確率がある値以下である場合にトレースログを出力するので、プログラマが事前に予測できなかった稀な状況においてもトレースログ出力を行うことが可能である。このトレースログによって、稀な状況においても、プログラムの実行履歴を正しく把握することが可能となり、異常の兆候を未然に検知することが可能となる。また障害発生時の原因究明を容易にすることができる。 As described above, in the present invention, since the trace log is output when the branching probability at the time of execution of the program is less than a certain value, the trace log can be output even in a rare situation where the programmer could not predict in advance. Is possible. This trace log makes it possible to correctly grasp the execution history of the program even in rare circumstances, and to detect signs of abnormality in advance. In addition, it is possible to easily investigate the cause when a failure occurs.
また本発明では、コンピュータシステムの負荷状態に応じて、トレースログ出力量を抑制することにより、トレースログ出力に掛かるオーバーヘッドを軽減する。これによりコンピュータシステムの高負荷状態を緩和することが可能となる。 Further, according to the present invention, the overhead of trace log output is reduced by suppressing the amount of trace log output according to the load state of the computer system. As a result, the high load state of the computer system can be alleviated.
本発明によれば、プログラマが事前に予測が困難であった稀な状況やコンピュータシステムの負荷状態に応じてトレースログ出力を制御することが可能となる。 According to the present invention, it is possible to control trace log output in accordance with a rare situation in which it is difficult for a programmer to predict in advance or a load state of a computer system.
以下にプログラム実行時のトレースログを出力する一実施形態のトレースロギング装置について説明する。 A trace logging apparatus according to an embodiment that outputs a trace log during program execution will be described below.
図1は本実施形態のプロファイリング機能付きトレースロギング装置の構成を示す図である。図1に示す様に本実施形態のコンピュータ100は、プロファイラ部112と、トレースログ出力部113とを有している。
FIG. 1 is a diagram showing a configuration of a trace logging apparatus with a profiling function according to the present embodiment. As shown in FIG. 1, the
プロファイラ部112は、プログラムの実行時にその動的な情報を示す実行時情報の計測を行ってその計測された実行時情報を記憶装置に格納する処理部である。トレースログ出力部113は、前記記憶装置に格納した実行時情報である計測値を読み出してその計測値を評価するための評価値を計算し、その計算した評価値がポリシー定義テーブルで指定される閾値条件を満たす場合にトレースログを記憶装置へ出力する処理部である。
The
コンピュータ100をプロファイラ部112及びトレースログ出力部113として機能させる為のプログラムは、CD−ROM等の記録媒体に記録され磁気ディスク等に格納された後、メモリにロードされて実行されるものとする。なお前記プログラムを記録する記録媒体はCD−ROM以外の他の記録媒体でも良い。また前記プログラムを当該記録媒体から情報処理装置にインストールして使用しても良いし、ネットワークを通じて当該記録媒体にアクセスして前記プログラムを使用するものとしても良い。
A program for causing the
図1に示す通り、本実施形態のトレースロギング装置であるコンピュータ100は、CPU101、キーボード102、ディスプレイ103、記憶装置104〜106及び主記憶装置108から構成されており、それぞれがバス107で接続されている。
As shown in FIG. 1, a
主記憶装置108には、OS109と各アプリケーションプログラム110が展開されており、アプリケーションプログラム110は主処理部111、プロファイラ部112、トレースログ出力部113から構成される。
An OS 109 and
アプリケーションプログラム110は、プログラムの目的処理を行う主処理部111と、プログラムの実行情報を収集・記録するプロファイラ部112と、トレースログを出力するかどうかを判定し、その結果によってトレースログを出力するトレースログ出力部113を順に繰り返し実行する。
The
図2は本実施形態の記憶装置104〜106に保存される情報の概要を示す図である。図2に示す様に各記憶装置には分岐確率等の実行時情報が格納されている。
FIG. 2 is a diagram showing an outline of information stored in the
統計情報記憶装置104は、分岐確率テーブル300、実行ステップ数テーブル400、サブルーチン情報テーブル500を保存する。プロファイラ部112は、プログラムの実行情報をこれらテーブル300〜500に記録する。トレースログ出力部113はこれらテーブル300〜500から情報を取得し、その情報を元にトレースログを出力するかどうかを判定する。
The statistical
ポリシー定義記憶装置105は、ポリシー定義テーブル600を保存する。トレースログ出力部113は、ポリシー定義テーブル600に記録されている規則に従い、トレースログを出力するかどうかを判定する。
The policy
トレースログ記憶装置106は、トレースログテーブル700を保存する。トレースログ出力部113は、トレースログをトレースログテーブル700に出力し保存する。
The trace
図3は本実施形態の分岐確率テーブルの一例を示す図である。分岐確率テーブル300は、プログラムの実行において発生した処理の分岐とその回数を記録する。 FIG. 3 is a diagram illustrating an example of a branch probability table according to the present embodiment. The branch probability table 300 records the branch of the process that occurred in the execution of the program and the number of times.
分岐確率テーブル300は、分岐箇所(分岐元)301の一覧、各分岐箇所に対応する分岐先302の一覧、及び各分岐先へと分岐した回数である分岐回数303から構成される。ここで、アプリケーションプログラム110を最初に実行する場合には、そのテスト段階で収集された分岐箇所、分岐先、分岐回数の情報を初期値として格納しておき、以後、アプリケーションプログラム110が実行される度に分岐回数の情報を累積していくものとする。
The branch probability table 300 includes a list of branch locations (branch sources) 301, a list of
図4は本実施形態の実行ステップ数テーブルの一例を示す図である。実行ステップ数テーブル400は、プログラムが各処理の実行に費やした実行ステップ数を記録する。 FIG. 4 is a diagram showing an example of the execution step number table of the present embodiment. The execution step number table 400 records the number of execution steps that the program has spent executing each process.
実行ステップ数テーブル400は、プログラムが実行した処理種別401及びその実行に要したステップ数402から構成される。
The execution step number table 400 includes a
合計実行ステップ数は、プログラムが各処理の実行に要したステップ数の総計を表す。トレースログ出力実行ステップ数は、トレースログを出力するかどうかの判定処理及びトレースログの出力処理に要したステップ数の総計を表す。主処理連続実行ステップ数は、最後にトレースログを出力してからの、プログラムの目的処理である主処理部111の実行に要したステップ数の総計を表す。トレースログ出力部113がトレースログを出力すると、主処理連続実行ステップ数はゼロに戻される。
The total number of execution steps represents the total number of steps required for execution of each process by the program. The number of trace log output execution steps represents the total number of steps required for the process of determining whether to output the trace log and the process of outputting the trace log. The number of main process continuous execution steps represents the total number of steps required to execute the
図5は本実施形態のサブルーチン情報テーブル500の一例を示す図である。サブルーチン情報テーブル500は、現在実行しているサブルーチンの情報及びサブルーチンの実行履歴を記録する。 FIG. 5 is a diagram showing an example of the subroutine information table 500 of the present embodiment. The subroutine information table 500 records information on the subroutine currently being executed and the execution history of the subroutine.
サブルーチン情報テーブル500は、サブルーチンの一意な名称であるサブルーチン名501、サブルーチンの処理を決定付けるパラメタ情報502及びサブルーチンの実行開始時刻503から構成される。メインルーチン及びメインルーチンから呼び出されるサブルーチンの呼び出し履歴を呼び出し順に記録する。
The subroutine information table 500 includes a
プロファイラ部112は、サブルーチンの実行を開始した時にサブルーチン情報をサブルーチン情報テーブル500の先頭に追加登録する。またサブルーチンの実行を終了し、呼び出し元に戻る時に、サブルーチン情報テーブル500の先頭から実行していたサブルーチン情報を削除する。この処理によりサブルーチン情報テーブル500は、現在実行しているサブルーチンの情報を先頭に保持する。
The
図6は本実施形態のポリシー定義テーブルの一例を示す図である。ポリシー定義テーブル600は、トレースログを出力するかどうかの判定規則を定義する。 FIG. 6 is a diagram showing an example of the policy definition table of this embodiment. The policy definition table 600 defines a determination rule for determining whether to output a trace log.
ポリシー定義テーブル600は、判定規則の種類を表す設定項目601、設定項目に対する基準値乃至基準値を与える式である設定値/設定式602、及び判定規則の優先順位603から構成される。
The policy definition table 600 includes a
本システムの利用者乃至管理者は、設定値/設定式602、優先順位603を変更することでトレースログをどの様な場合に出力するかを制御することができる。
A user or administrator of this system can control when the trace log is output by changing the setting value /
図7は本実施形態のトレースログテーブルの一例を示す図である。トレースログテーブル700は、トレースログ出力部113が出力したトレースログを保存する。
FIG. 7 is a diagram showing an example of the trace log table of the present embodiment. The trace log table 700 stores the trace log output by the trace
トレースログテーブル700は、各トレースログがポリシー定義テーブル600のどの設定項目601が設定値/設定式602を満たしたため出力されたのかを示す該当項目701、その時の設定項目601の取った値702、該当項目701に対応して定まっているトレースログ本文703、及び付加情報704から構成される。
The trace log table 700 includes a
図7の1行目は、図6のポリシー定義テーブル600の1行目の分岐確率による条件を満たした場合のトレースログ出力例である。該当項目として分岐確率であることを、値として分岐確率を、トレースログ本文として分岐箇所と分岐先を、付加情報として分岐条件に使用された条件変数の名称と値を出力する。 The first line of FIG. 7 is an example of a trace log output when the condition according to the branching probability of the first line of the policy definition table 600 of FIG. 6 is satisfied. The branch probability is output as the corresponding item, the branch probability is output as the value, the branch location and branch destination are output as the trace log body, and the name and value of the condition variable used for the branch condition are added as additional information.
図7の2行目は、図6のポリシー定義テーブル600の3行目の主処理連続実行ステップ数による条件を満たした場合のトレースログ出力例である。該当項目として主処理連続実行ステップ数であることを、値として主処理を連続して実行した実行ステップ数を、トレースログ本文として現在実行しているサブルーチン名を、付加情報として現在実行しているサブルーチンのパラメタの名称と値を出力する。 The second line in FIG. 7 is an example of a trace log output when the condition based on the number of main processing continuous execution steps in the third line of the policy definition table 600 in FIG. 6 is satisfied. The corresponding item is the number of main process continuous execution steps, the value is the number of execution steps that executed the main process continuously, the name of the subroutine currently being executed as the trace log text, and the current execution as additional information Print the names and values of subroutine parameters.
図7の3行目は、図6のポリシー定義テーブル600の4行目のトレースログ出力命令による条件を満たした場合のトレースログ出力例である。該当項目としてトレースログ出力命令であることを、トレースログ本文として明示的なトレースログ出力命令によって与えられた任意のメッセージを出力する。 The third line in FIG. 7 is an example of trace log output when the condition according to the trace log output command in the fourth line of the policy definition table 600 in FIG. 6 is satisfied. An arbitrary message given by an explicit trace log output command is output as a trace log body, indicating that the item is a trace log output command.
図7の4行目は、図6のポリシー定義テーブル600の5行目のサブルーチン実行時間による条件を満たした場合のトレースログ出力例である。該当項目としてサブルーチン実行時間であることを、値としてサブルーチンの実行時間を、トレースログ本文として実行を完了したサブルーチン名を、負荷情報として実行を完了したサブルーチンのパラメタの名称と値を出力する。 The fourth line of FIG. 7 is an example of a trace log output when the condition according to the subroutine execution time of the fifth line of the policy definition table 600 of FIG. 6 is satisfied. The corresponding item is the subroutine execution time, the subroutine execution time as the value, the subroutine name that has been executed as the trace log body, and the name and value of the subroutine parameter that has been executed as the load information.
図11は本実施形態のアプリケーションプログラム110が実行する処理の流れを示す図である。図11では、アプリケーションプログラム110が、主処理部111、プロファイラ部112、及びトレースログ出力部113を順に繰り返し実行する処理を表している。
FIG. 11 is a diagram showing a flow of processing executed by the
主処理部111は、終了命令、明示的なトレースログ出力命令、分岐命令、サブルーチンの実行完了若しくは一定ステップ数を実行するまで、プログラムの目的処理を実行する(ステップ901)。終了命令に到達した場合(ステップ902)は、プログラムの実行を終了する(ステップ912)。その他の条件を満たした場合には、プロファイラ部112に制御を移す。
The
プロファイラ部112は、明示的なトレースログ出力命令に到達していた場合(ステップ903)には、トレースログ出力部113のステップ907に制御を移す。分岐命令に到達していた場合(ステップ904)には、分岐確率テーブル300の分岐箇所x−分岐先xmに対応する分岐回数303を1増やす(ステップ906)。これらいずれの場合にも当てはまらず、サブルーチンの実行を完了した乃至一定ステップ数を実行した為にプロファイラ部へ制御が移った場合には、実行ステップ数テーブル400の合計実行ステップ数と主処理連続実行ステップ数を積算する(ステップ905)。
If the
トレースログ出力部113は、ポリシー定義テーブル600の判定規則を優先順位に従って適用し、トレースログを出力するかどうかを判定する(ステップ907)。判定方法の詳細は図12以降で説明する。トレースログを出力すると判定した場合(ステップ908)は、トレースログテーブル700へトレースログを出力する(ステップ909)。
The trace
プロファイラ部112は、トレースログを出力した場合は、実行ステップ数テーブル400の合計実行ステップ数とトレースログ出力実行ステップ数を積算し、主処理連続実行ステップ数をゼロにする(ステップ911)。トレースログを出力しなかった場合は、実行ステップ数テーブル400の合計実行ステップ数を積算する(ステップ910)。
以上、一連の処理をプログラムが終了するまで、ステップ901に戻って繰り返し実行する。
When outputting the trace log, the
As described above, the series of processing is repeatedly executed by returning to step 901 until the program ends.
図12は本実施形態のトレースログ出力部113の判定処理の流れを示す図である。図12では、トレースログ出力部113がトレースログを出力するかどうかをポリシー定義テーブル600に従って判定する処理を表している。
FIG. 12 is a diagram showing a flow of determination processing of the trace
先ず、ポリシー定義テーブル600から最も優先順位の高い設定項目を取得する(ステップ1001)。この設定項目に対応した評価方法1100〜1500によって、トレースログを出力するか、出力しないか、或いは判定を保留し他の設定項目の評価によって判定するか、を判定する(ステップ1002)。 First, the setting item with the highest priority is acquired from the policy definition table 600 (step 1001). By the evaluation method 1100-1500 corresponding to this setting item, it is determined whether to output the trace log or not, or whether to hold the determination and determine by evaluation of other setting items (step 1002).
トレースログを出力するか、出力しないかを判定した場合(ステップ1003)は、その結果を以って判定を完了する(ステップ908)。
判定が保留され、かつポリシー定義テーブル600に次に優先順位の高い設定項目がない場合(ステップ1004)は、トレースログを出力しないと判定する(ステップ908)。
判定が保留され、かつポリシー定義テーブル600に次に優先順位の高い設定項目がある場合は、その設定項目を取得し(ステップ1005)、ステップ1002に戻り、設定項目に対応する評価と判定を繰り返す。
If it is determined whether to output the trace log (step 1003), the determination is completed based on the result (step 908).
If the determination is suspended and there is no setting item with the next highest priority in the policy definition table 600 (step 1004), it is determined not to output the trace log (step 908).
If the determination is suspended and there is a setting item with the next highest priority in the policy definition table 600, the setting item is acquired (step 1005), and the process returns to step 1002 to repeat the evaluation and determination corresponding to the setting item. .
図13は本実施形態の分岐確率によってトレースログを出力するかどうかを判定する処理の流れを示す図である。主処理部111は、分岐命令に到達した場合、分岐命令に到達したことを示すパラメタをプロファイラ部112に渡す。プロファイラ部112はトレースログ出力部113に制御を移す際にそのパラメタを引き渡す。トレースログ出力部113はこのパラメタを元に分岐命令に到達しているかどうかを判定する。
FIG. 13 is a diagram showing a flow of processing for determining whether or not to output a trace log according to the branch probability according to the present embodiment. When the
プログラムの実行が分岐命令に到達していない場合(ステップ1101)は、判定を保留し、次の優先順位の設定項目について評価を行う。 If the execution of the program has not reached the branch instruction (step 1101), the determination is suspended, and the next priority setting item is evaluated.
プログラムの実行が分岐命令に到達している場合、分岐確率を算出し、トレースログを出力するかどうか判定する。 When the execution of the program reaches the branch instruction, the branch probability is calculated and it is determined whether or not to output the trace log.
先ず、分岐確率テーブル300から、到達した分岐箇所xに対応する分岐先x1…xnの分岐回数303を取得し合計する(ステップ1102)。分岐条件の評価により決定した分岐先xmに対する分岐確率xm/Σxi(i=1…n)を計算する(ステップ1103)。
First, the number of
次に、ポリシー定義テーブル600から分岐確率に対する設定値を取得する(1104)。
ステップ1102〜1103で算出した分岐確率が設定値以下である場合(ステップ1105)は、トレースログを出力すると判定する。分岐確率が設定値を超えている場合は、判定を保留し、次の優先順位の設定項目について評価を行う。
Next, a setting value for the branch probability is acquired from the policy definition table 600 (1104).
When the branching probability calculated in steps 1102 to 1103 is equal to or less than the set value (step 1105), it is determined that the trace log is output. If the branching probability exceeds the set value, the determination is suspended and the next priority setting item is evaluated.
以上の処理によって、プログラム中の全ての条件分岐について、分岐確率が設定値以下の場合にトレースログを出力することが可能となる。即ち、プログラマが事前に想定し得ない稀な状況を自動的に検出し、トレースログを出力することが可能となる。 With the above processing, it is possible to output a trace log for all conditional branches in the program when the branch probability is less than or equal to the set value. That is, it is possible to automatically detect a rare situation that a programmer cannot assume in advance and output a trace log.
図14は本実施形態のトレースログの出力に要した実行ステップ数と合計実行ステップ数との比率からトレースログを出力するかどうかを判定する処理の流れを示す図である。先ず、実行ステップ数テーブル400から合計実行ステップ数とトレースログ出力実行ステップ数を取得する(ステップ1201)。トレースログの出力に要した実行ステップ数の割合を、トレースログ出力実行率=トレースログ出力実行ステップ数/合計実行ステップ数として計算する(ステップ1202)。 FIG. 14 is a diagram showing a flow of processing for determining whether to output a trace log from the ratio of the number of execution steps required for outputting the trace log and the total number of execution steps according to this embodiment. First, the total number of execution steps and the number of trace log output execution steps are acquired from the execution step number table 400 (step 1201). The ratio of the number of execution steps required for outputting the trace log is calculated as Trace log output execution rate = Number of trace log output execution steps / Total number of execution steps (Step 1202).
次に、ポリシー定義テーブル600からトレースログ出力実行率の設定式を取得する(ステップ1203)。コンピュータシステムの負荷率を変数として、設定式の値を計算する(ステップ1204)。 Next, a trace log output execution rate setting formula is acquired from the policy definition table 600 (step 1203). Using the load factor of the computer system as a variable, the value of the setting formula is calculated (step 1204).
ステップ1201〜1202で算出したトレースログ出力実行率が設定式の値を超えている場合(ステップ1205)は、トレースログを出力しないと判定する。トレースログ出力実行率が設定式の値以下である場合は、判定を保留し、次の優先順位の設定項目について評価を行う。 When the trace log output execution rate calculated in steps 1201 to 1202 exceeds the value of the setting formula (step 1205), it is determined that the trace log is not output. If the trace log output execution rate is less than or equal to the value of the setting expression, the determination is suspended and the next priority setting item is evaluated.
例として、コンピュータシステムの負荷率をLで表すこととし、設定式が0.1×(1-L)であった場合を考える。コンピュータシステムの負荷率が100%の場合は、L = 1, 設定式0.1×(1-L) = 0.1×(1-1) = 0となるため、トレースログ出力実行率に依らず、トレースログを出力しない。負荷率が50%の場合は、L = 0.5, 設定式0.1×(1-L) = 0.1×(1-0.5) = 0.05となるため、トレースログ出力実行率が0.05(=5%)を超えていた場合には、トレースログを出力しない。 As an example, let us consider the case where the load factor of a computer system is represented by L and the setting formula is 0.1 × (1-L). If the load factor of the computer system is 100%, L = 1, setting formula 0.1 x (1-L) = 0.1 x (1-1) = 0, so the trace log output rate does not depend on the trace log output execution rate. Is not output. When the load factor is 50%, L = 0.5, setting formula 0.1 x (1-L) = 0.1 x (1-0.5) = 0.05, so the trace log output execution rate exceeds 0.05 (= 5%) If it is, the trace log is not output.
以上の処理によって、トレースログ出力の実行率をコンピュータシステムの負荷状態によって決まるある割合以下に抑えることが可能となる。即ち、コンピュータシステムの負荷状態に応じてトレースログ出力量を抑制することが可能であり、コンピュータシステムの高負荷状態を緩和することが可能である。 With the above processing, the execution rate of the trace log output can be suppressed to a certain ratio determined by the load state of the computer system. That is, the trace log output amount can be suppressed according to the load state of the computer system, and the high load state of the computer system can be alleviated.
図15は本実施形態のプログラムの目的処理を一定ステップ数実行する毎にトレースログを出力するかどうかを判定する処理の流れを示す図である。先ず、実行ステップ数テーブル400から、トレースログ出力処理を挟まずにプログラムの目的処理を実行し続けたステップ数である、主処理連続実行ステップ数を取得する(ステップ1301)。 FIG. 15 is a diagram showing a flow of processing for determining whether or not to output a trace log every time the target processing of the program of this embodiment is executed for a certain number of steps. First, from the execution step number table 400, the main process continuous execution step number, which is the number of steps in which the target process of the program has been executed without interposing the trace log output process, is obtained (step 1301).
次にポリシー定義テーブル600から主処理連続実行ステップ数の設定値を取得する(ステップ1302)。主処理連続実行ステップ数が設定値以上である場合(ステップ1303)は、トレースログを出力すると判定する。主処理連続実行ステップ数が設定値未満である場合は、判定を保留し、次の優先順位の設定項目について評価を行う。 Next, a setting value for the number of main processing continuous execution steps is acquired from the policy definition table 600 (step 1302). If the number of main process continuous execution steps is greater than or equal to the set value (step 1303), it is determined that a trace log is output. When the number of main process continuous execution steps is less than the set value, the determination is suspended and the next set item of priority is evaluated.
以上の処理によって、明示的にトレースログ出力を命令しなくても、一定実行ステップ数毎にトレースログを出力することが可能となり、アプリケーションプログラム110の動作をトレースログから把握することが可能となる。
With the above processing, it is possible to output a trace log for each predetermined number of execution steps without explicitly instructing to output a trace log, and it is possible to grasp the operation of the
図16は本実施形態の明示的なトレースログ出力命令に到達した時にトレースログを出力するかどうかを判定する処理の流れを示す図である。主処理部111はトレースログ出力命令に到達した場合、トレースログ出力命令に到達したことを示すパラメタをプロファイラ部112に渡す。プロファイラ部112はトレースログ出力部113に制御を移す際にそのパラメタを引き渡す。トレースログ出力部113はこのパラメタを元にトレースログ出力命令に到達しているかどうかを判定する。
FIG. 16 is a diagram showing the flow of processing for determining whether or not to output a trace log when the explicit trace log output command of this embodiment is reached. When the
プログラムの実行が明示的なトレースログ出力命令に到達した場合(ステップ1401)は、トレースログを出力すると判定する。トレースログ出力命令に到達していない場合は、判定を保留し、次の優先順位の設定項目について評価を行う。 When the execution of the program reaches an explicit trace log output command (step 1401), it is determined that the trace log is output. If the trace log output command has not been reached, the determination is suspended and the next priority setting item is evaluated.
図17は本実施形態のサブルーチンの実行を完了した時にトレースログを出力するかどうかを判定する処理の流れを示す図である。主処理部111はサブルーチンの実行を完了した場合、サブルーチンの実行完了を示すパラメタをプロファイラ部112に渡す。プロファイラ部112はトレースログ出力部113に制御を移す際にそのパラメタを引き渡す。トレースログ出力部113はこのパラメタを元にサブルーチンの実行を完了したかどうかを判定する。
FIG. 17 is a diagram showing a flow of processing for determining whether to output a trace log when execution of the subroutine of the present embodiment is completed. When the
プログラムがサブルーチンの実行を完了していない場合(ステップ1501)は、判定を保留し、次の優先順位の設定項目について評価を行う。
サブルーチンの実行を完了している場合は、サブルーチン情報テーブル500の先頭から現在実行しているサブルーチンの実行開始時刻503を取得し、現在時刻との差からサブルーチンの実行時間を計算する(ステップ1502)。
If the program has not completed execution of the subroutine (step 1501), the determination is suspended and the next priority setting item is evaluated.
If the execution of the subroutine has been completed, the
次にポリシー定義テーブル600からサブルーチン実行時間の設定値を取得する(ステップ1503)。
実行を完了したサブルーチンの実行時間が設定値未満である場合(ステップ1504)、判定を保留し、次の優先順位の設定項目について評価を行う。
実行を完了したサブルーチンの実行時間が設定値以上である場合は、サブルーチン情報テーブル500の全てのサブルーチンの実行開始時刻を実行時間だけ進め(ステップ1505)、トレースログを出力すると判定する。実行開始時刻を実行時間だけ進めることにより、当該サブルーチンの呼び出し元全てにおいてトレースログが出力されることを抑止する。
Next, a set value of subroutine execution time is acquired from the policy definition table 600 (step 1503).
If the execution time of the subroutine that has completed execution is less than the set value (step 1504), the determination is suspended and the next priority setting item is evaluated.
If the execution time of the subroutine that has completed execution is equal to or greater than the set value, the execution start time of all subroutines in the subroutine information table 500 is advanced by the execution time (step 1505), and it is determined that the trace log is output. By advancing the execution start time by the execution time, it is possible to prevent the trace log from being output from all callers of the subroutine.
図8は本実施形態のアプリケーションプログラム110の生成の一例を示す図である。図8では、プログラムの目的処理である主処理部111のみから成るソースプログラム114から、プロファイラ部112及びトレースログ出力部113を持つ実行プログラムであるアプリケーションプログラム110を生成する処理を表している。
FIG. 8 is a diagram showing an example of generation of the
言語処理系115は、与えられたソースプログラム114の内容を解析し、プロファイラ部112及びトレースログ出力部113を生成し、実行プログラムに埋め込むことで、アプリケーションプログラム110を生成する。
The
本実施形態の一つとして、プロファイラ部112及びトレースログ出力部113をサブルーチンとしてプログラム中に埋め込み、プログラム中においてプロファイル処理乃至トレースログ出力処理を必要とする箇所にこれらサブルーチンの呼び出し処理を埋め込む方法がある。
As one of the embodiments, there is a method in which the
また別の実施形態の一つとして、プログラム中においてプロファイル処理乃至トレースログ出力処理の必要な箇所に、プロファイラ部112乃至トレースログ出力部113の該当処理部分をマクロ展開して直接埋め込む方法もある。
As another embodiment, there is a method of directly embedding a corresponding processing portion of the
図9は本実施形態の言語処理系115によって処理される前のソースプログラム114の一例を示す図である。左端の数字は行番号を示し、プログラムの内容はプログラミング言語Cに基づく擬似コードで示している。
FIG. 9 is a diagram showing an example of the
図9の3〜6行はサブルーチンの定義、8〜23行はメインルーチンの定義、11〜16行は分岐命令、18行はサブルーチンの実行、20行は明示的なトレースログ出力命令である。
In FIG. 9,
図10は本実施形態の言語処理系115によって図9で示したソースプログラムの例を処理した後のアプリケーションプログラム110の一例を示す図である。左端の数字は行番号を示し、プログラムの内容はプログラミング言語Cに基づく擬似コードで示している。アルファベット大文字で表記している処理が、言語処理系115が埋め込んだ処理である。
FIG. 10 is a diagram showing an example of the
図10の1〜12行はサブルーチンの定義、14〜48行はメインルーチンの定義、24〜37行は分岐命令、39行はサブルーチンの実行、41〜43行は明示的なトレースログ出力命令である。
In FIG. 10,
図10の4、16行は現在実行しているサブルーチンの名称、パラメタの名称と値をサブルーチン情報テーブル500に保存する処理、11行はサブルーチン情報を呼び出し元の情報に戻す処理である。
図10の10、46行はサブルーチンの実行を完了した時に、プロファイラ部112へ制御を移す処理である。サブルーチンの実行を完了したことをパラメタとして渡している。実行を完了したサブルーチンの名称、パラメタ名と値、実行開始時刻はサブルーチン情報テーブル500に記録されているため、パラメタとしては渡さない。
Lines 10 and 46 in FIG. 10 are processes for transferring control to the
図10の18〜21行は一定ステップ数を実行する毎にプロファイラ部112へ制御を移す処理を割り込み処理として登録する処理である。一定ステップ数を実行したことをパラメタとして渡す様に設定している。
図10の28、34行は分岐命令に到達した時に、プロファイラ部112へ制御を移す処理である。分岐命令に到達したこと、分岐箇所、分岐先、分岐の判定に使用した条件変数の名称と値をパラメタとして渡している。分岐箇所、分岐先の名称は言語処理系115が自動生成して割り当てる。
Lines 28 and 34 in FIG. 10 are processes for transferring control to the
図10の43行は明示的なトレースログ出力命令に到達した時に、プロファイラ部112へ制御を移す処理である。明示的なトレースログ出力命令に到達したこと、指定された任意のメッセージをパラメタとして渡している。本処理は図9の20行に対応しており、ソースプログラム114の処理を置き換えている。
Line 43 in FIG. 10 is a process for transferring control to the
以上説明した様に本実施形態のトレースロギング装置によれば、プログラムの動的な実行時情報に応じてトレースログの出力を行うので、プログラマが事前に予測できなかった稀な状況やコンピュータシステムの負荷状態に応じてトレースログ出力を制御することが可能である。 As described above, according to the trace logging apparatus of the present embodiment, the trace log is output according to the dynamic runtime information of the program. It is possible to control the trace log output according to the load state.
100…コンピュータ、101…CPU、102…キーボード、103…ディスプレイ、104…統計情報記憶装置、105…ポリシー定義記憶装置、106…トレースログ記憶装置、107…バス、108…主記憶装置、109…OS、110…アプリケーションプログラム、111…主処理部、112…プロファイラ部、113…トレースログ出力部、300…分岐確率テーブル、400…実行ステップ数テーブル、500…サブルーチン情報テーブル、600…ポリシー定義テーブル、700…トレースログテーブル、301…分岐箇所(分岐元)、302…分岐先、303…分岐回数、401…処理種別、402…ステップ数、501…サブルーチン名、502…パラメタ情報、503…実行開始時刻、601…設定項目、602…設定値/設定式、603…優先順位、701…該当項目、702…値、703…トレースログ本文、704…付加情報、114…ソースプログラム、115…言語処理系。
DESCRIPTION OF
Claims (5)
プログラムの実行時にその動的な情報を示す実行時情報の計測を行ってその計測された実行時情報を前記記憶装置に格納し、前記記憶装置に格納した実行時情報である計測値を読み出してその計測値を評価するための評価値を計算し、その計算した評価値がポリシー定義テーブルで指定される閾値条件を満たす場合にトレースログを記憶装置へ出力することを特徴とするトレースロギング方法。 In a trace logging method in a trace logging device that includes a storage device and outputs a trace log during program execution,
The execution time information indicating the dynamic information is measured when the program is executed, the measured execution time information is stored in the storage device, and the measurement value which is the execution time information stored in the storage device is read. A trace logging method characterized by calculating an evaluation value for evaluating the measured value and outputting a trace log to a storage device when the calculated evaluation value satisfies a threshold condition specified in a policy definition table.
プログラムの実行時にその動的な情報を示す実行時情報の計測を行ってその計測された実行時情報を前記記憶装置に格納するプロファイラ部と、前記記憶装置に格納した実行時情報である計測値を読み出してその計測値を評価するための評価値を計算し、その計算した評価値がポリシー定義テーブルで指定される閾値条件を満たす場合にトレースログを記憶装置へ出力するトレースログ出力部とを備えることを特徴とするトレースロギング装置。 In a trace logging device that has a storage device and outputs a trace log during program execution,
A profiler unit that measures runtime information indicating dynamic information at the time of program execution and stores the measured runtime information in the storage device, and a measurement value that is runtime information stored in the storage device A trace log output unit that calculates an evaluation value for evaluating the measured value and outputs the trace log to the storage device when the calculated evaluation value satisfies a threshold condition specified in the policy definition table. A trace logging device comprising:
プログラムの実行時にその動的な情報を示す実行時情報の計測を行ってその計測された実行時情報を前記記憶装置に格納するステップと、前記記憶装置に格納した実行時情報である計測値を読み出してその計測値を評価するための評価値を計算し、その計算した評価値がポリシー定義テーブルで指定される閾値条件を満たす場合にトレースログを記憶装置へ出力するステップとをコンピュータに実行させることを特徴とするプログラム。 In a program for causing a computer to execute a trace logging method in a trace logging device that includes a storage device and outputs a trace log during program execution,
Measuring execution time information indicating the dynamic information at the time of execution of the program and storing the measured execution time information in the storage device; and a measurement value which is the execution time information stored in the storage device. An evaluation value for reading and evaluating the measurement value is calculated, and when the calculated evaluation value satisfies a threshold condition specified in the policy definition table, a step of outputting a trace log to a storage device is executed by a computer. A program characterized by that.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2006272512A JP2008090699A (en) | 2006-10-04 | 2006-10-04 | Trace logging method, apparatus and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2006272512A JP2008090699A (en) | 2006-10-04 | 2006-10-04 | Trace logging method, apparatus and program |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2008090699A true JP2008090699A (en) | 2008-04-17 |
Family
ID=39374756
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2006272512A Pending JP2008090699A (en) | 2006-10-04 | 2006-10-04 | Trace logging method, apparatus and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2008090699A (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2011076389A (en) * | 2009-09-30 | 2011-04-14 | Fujitsu Frontech Ltd | Information management program, information management method and information management device |
| JP2012141909A (en) * | 2011-01-06 | 2012-07-26 | Hitachi Ltd | Abnormality detection method and information processing system using the same |
| JP2013174960A (en) * | 2012-02-23 | 2013-09-05 | Fujitsu Semiconductor Ltd | Description file of lsi model, simulation system, and method for debug |
-
2006
- 2006-10-04 JP JP2006272512A patent/JP2008090699A/en active Pending
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2011076389A (en) * | 2009-09-30 | 2011-04-14 | Fujitsu Frontech Ltd | Information management program, information management method and information management device |
| JP2012141909A (en) * | 2011-01-06 | 2012-07-26 | Hitachi Ltd | Abnormality detection method and information processing system using the same |
| JP2013174960A (en) * | 2012-02-23 | 2013-09-05 | Fujitsu Semiconductor Ltd | Description file of lsi model, simulation system, and method for debug |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110990019B (en) | Java class analysis method and device, storage medium and electronic equipment | |
| US8397104B2 (en) | Creation of test plans | |
| US8898649B2 (en) | Application program analysis method, analysis system and recording medium for identifying a contributing factor for an invalid operation of an application program | |
| KR20110070468A (en) | Instrumentation execution device and method | |
| CN112634973A (en) | Data rereading method and system of storage medium, terminal device and storage medium | |
| US20110154127A1 (en) | Test support system, method and computer program product, which optimize test scenarios to minimize total test time | |
| JP2019215847A (en) | Reducing buffer overflow | |
| CN105556402A (en) | Method for manipulating a control program of a control device | |
| JP6723483B2 (en) | Test case generation device, test case generation method, and test case generation program | |
| US7353500B2 (en) | Suppressing execution of monitoring measurement program pointed to by inserted branch after threshold number of coverage to reduce instruction testing overhead | |
| KR102114547B1 (en) | Testing method and apparatus of target function incluede in target program | |
| US9646252B2 (en) | Template clauses based SAT techniques | |
| US11241962B2 (en) | Evaluation apparatus for display arbitration control and generation apparatus for rule definition file | |
| JP2008090699A (en) | Trace logging method, apparatus and program | |
| US20100077383A1 (en) | Simulation method and storage medium for storing program | |
| KR101476536B1 (en) | The method and system for inspecting program | |
| CN114153750A (en) | Code checking method and device, code compiling method and electronic equipment | |
| JP5021584B2 (en) | Microcomputer simulator, simulation method thereof, program, and computer-readable medium | |
| JP6583033B2 (en) | Driver generation program, apparatus, and method | |
| JP2007323299A (en) | Review execution order determination device, review execution order determination program, recording medium storing review execution order determination program, and review execution order determination method | |
| CN119538262B (en) | Fuzz testing input optimization device for IoT device firmware | |
| US11520964B1 (en) | Method and system for assertion-based formal verification using unique signature values | |
| CN113312167B (en) | Service control method and device, electronic equipment and computer readable medium | |
| CN112860224B (en) | Function execution environment construction method and device, electronic equipment and storage medium | |
| JP5067705B2 (en) | Abnormal test support device, abnormal test support method, and program |