JP4905974B2 - Program profiling apparatus, program profiling method, and program - Google Patents
Program profiling apparatus, program profiling method, and program Download PDFInfo
- Publication number
- JP4905974B2 JP4905974B2 JP2007095389A JP2007095389A JP4905974B2 JP 4905974 B2 JP4905974 B2 JP 4905974B2 JP 2007095389 A JP2007095389 A JP 2007095389A JP 2007095389 A JP2007095389 A JP 2007095389A JP 4905974 B2 JP4905974 B2 JP 4905974B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- main method
- processing time
- measurement
- main
- 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.)
- Expired - Fee Related
Links
Images
Description
本発明は、複数のメソッドで構成されたプログラムを実行したときに、各メソッドの処理時間を測定したり、メソッド間の呼出関係を解析する、プログラムプロファイリング装置、プログラムプロファイリング方法、及びプログラムに関する。 The present invention relates to a program profiling apparatus, a program profiling method, and a program for measuring a processing time of each method and analyzing a call relationship between methods when a program composed of a plurality of methods is executed.
複数のメソッドで構成されたプログラムの処理性能の改善を目的として、プログラム全体の性能の低下に大きな影響を与える(ボトルネックとなる)メソッドを特定する必要がある。そのため、メソッドの処理時間を計測するなどの処理が行われている。
実際には、メソッドが呼び出されるルートによっても処理時間が異なる場合があるため、ボトルネックを特定するためにメソッドの処理時間を計測する際には、メソッド間の呼出関係も解析する必要がある。そして、解析した呼出関係に基づいて、メソッドの処理時間の計測を行う。このような一連の処理はプロファイリングと呼ばれている。
For the purpose of improving the processing performance of a program composed of a plurality of methods, it is necessary to identify a method that greatly affects the performance degradation of the entire program (becomes a bottleneck). Therefore, processing such as measuring the processing time of the method is performed.
Actually, the processing time may vary depending on the route by which the method is called. Therefore, when measuring the processing time of the method in order to identify the bottleneck, it is necessary to analyze the calling relationship between the methods. Then, the processing time of the method is measured based on the analyzed call relationship. Such a series of processes is called profiling.
例えば、特許文献1は、ソースプログラムや実行プログラムを加工し、計測対象とするメソッドの前後にプローブを挿入し、このプローブの処理によってプロファイリングを行う技術を開示している。
For example,
しかし、特許文献1が開示する技術では、プログラムを実行した際に実行されるメソッドに挿入されているプローブが全て実行されるため、結果的に計測を行う必要性の低いプローブまで実行されてしまうことになる。したがって、より詳細な計測を行おうとすればするほどプローブの実行による実行環境への大きな負荷が生じ、計測結果の精度が低下してしまう。
However, in the technique disclosed in
そのため、以下に示すようなプロファイリングの手法が提案されている。
(i)まず、ほぼ全てのメソッドを計測の対象とした統計的なデータを計測する第1の計測を行う。(ii)次に、この計測結果に基づいて、より詳細な計測を行うためのメソッドの絞り込みを行う。(iii)そして、この絞り込まれたメソッドに対してのみ、当該メソッドが実行される度に、一連の呼出関係にあるメソッドの実行時間も含めて処理時間を計測するといった、より詳細な計測を行う第2の計測処理を行う。
Therefore, the following profiling methods have been proposed.
(I) First, a first measurement is performed to measure statistical data with almost all methods as objects of measurement. (Ii) Next, based on this measurement result, narrowing down methods for performing more detailed measurement is performed. (Iii) Then, only for this narrowed-down method, each time the method is executed, a more detailed measurement is performed such as measuring the processing time including the execution time of a method having a series of calling relationships. A second measurement process is performed.
上述したプロファイリングの手法では、詳細な計測を行うメソッドが絞りこまれているため、実行環境への負荷の小さいプロファイリングを実現することが可能となる。
しかし、上述のプロファイリングの手法では、第1の計測と第2の計測とを別々に行う必要があり、この計測の度に計測対象システムの設定や、計測用シナリオの実行、計測結果の分析という手順が発生することになり、非効率的である。 However, in the above-described profiling method, it is necessary to perform the first measurement and the second measurement separately. For each measurement, the measurement target system is set, the measurement scenario is executed, and the measurement result is analyzed. Procedures will occur and are inefficient.
本発明は、上記実状に鑑みてなされたものであり、効率的なプロファイリングが可能なプロファイリング装置等を提供することを目的とする。 The present invention has been made in view of the above circumstances, and an object thereof is to provide a profiling apparatus and the like capable of efficient profiling.
上記目的を達成するため、本発明の第1の観点に係るプロファイリング装置は、
複数のメソッドから構成されたプログラムを実行した際に、実行したメソッドの処理時間を計測する統計データ計測手段と、
前記統計データ計測手段により計測されたメソッドの処理時間が所定の閾値以上であるかを判別する処理時間判別手段と、
前記処理時間判別手段により処理時間が所定の閾値以上であると判別されたメソッドを、前記プログラムを実行した際の実行時間の主要な要因となる主要メソッドに設定する主要メソッド設定手段と、
前記主要メソッドが実行された際に、該主要メソッドの処理時間と該主要メソッドがどのようなメソッドを辿って呼び出されてきたのかを示すルート情報とを取得する、詳細データ計測手段と、
前記詳細データ計測手段により取得された前記主要メソッドの処理時間とルート情報とを、該主要メソッド毎に記憶するメソッド詳細情報記憶手段と、
所定の数を超えて前記メソッド詳細情報記憶手段に記憶されている主要メソッドに対して、前記主要メソッド設定手段によって設定した主要メソッドの設定を解除する主要メソッド設定解除手段と、
を備え、
前記主要メソッド設定手段は、前記プログラムの実行中に主要メソッドを設定し、
前記主要メソッド設定解除手段は、前記プログラムの実行中に主要メソッドの設定を解除し、
前記プログラムの1回の実行中に、前記統計データ計測手段による計測と前記詳細データ計測手段による計測とを行う、
ことを特徴とする。
In order to achieve the above object, a profiling apparatus according to a first aspect of the present invention includes:
Statistical data measuring means for measuring the processing time of the executed method when a program composed of a plurality of methods is executed;
Processing time determination means for determining whether the processing time of the method measured by the statistical data measurement means is equal to or greater than a predetermined threshold;
Main method setting means for setting a method determined by the processing time determination means to have a processing time equal to or greater than a predetermined threshold as a main method that is a main factor of execution time when the program is executed;
Detailed data measuring means for acquiring processing information of the main method and route information indicating what method the main method has been followed by when the main method is executed;
Method detailed information storage means for storing the processing time and route information of the main method acquired by the detailed data measuring means for each main method;
Main method setting release means for releasing the setting of the main method set by the main method setting means for the main methods stored in the method detailed information storage means exceeding a predetermined number;
With
The main method setting means sets a main method during execution of the program,
The main method setting release means cancels the setting of the main method during the execution of the program,
During one execution of the program, the measurement by the statistical data measurement means and the measurement by the detailed data measurement means are performed.
It is characterized by that.
前記統計データ計測手段は、実行したメソッドの処理時間を該メソッド毎に累積して、累積した処理時間を該メソッドの処理時間としてもよい。 The statistical data measuring means may accumulate the processing time of the executed method for each method, and the accumulated processing time may be the processing time of the method.
前記閾値は、所定の時間内に統計データ計測手段で計測された処理時間の最大値を基準にした値であってよい。 The threshold value may be a value based on the maximum value of the processing time measured by the statistical data measuring means within a predetermined time.
前記主要メソッドが処理を待機している待ち時間を求める待ち時間求め手段をさらにそなえ、
前記詳細データ計測手段は、前記待ち時間求め手段によって求められた待ち時間を前記主要メソッド毎に記憶してもよい。
A waiting time obtaining means for obtaining a waiting time during which the main method is waiting for processing;
The detailed data measuring means may store the waiting time obtained by the waiting time obtaining means for each main method.
上記目的を達成するため、本発明の第2の観点に係るプロファイリング方法は、
複数のメソッドから構成されたプログラムを実行した際に、実行したメソッドの処理時間を計測する統計データ計測ステップと、
前記統計データ計測ステップにより計測されたメソッドの処理時間が所定の閾値以上であるかを判別する処理時間判別ステップと、
前記処理時間判別ステップにより処理時間が所定の閾値以上であると判別されたメソッドを、前記プログラムを実行した際の実行時間の主要な要因となる主要メソッドに設定する主要メソッド設定ステップと、
前記主要メソッドが実行された際に、該主要メソッドの処理時間と、該主要メソッドがどのようなメソッドを辿って呼び出されてきたのかを示すルート情報とを取得する、詳細データ計測ステップと、
前記詳細データ計測ステップにより取得された前記主要メソッドの処理時間とルート情報とを、該主要メソッド毎に記憶するメソッド詳細情報記憶ステップと、
所定の数を超えて前記メソッド詳細情報記憶ステップで記憶した主要メソッドに対して、前記主要メソッド設定ステップで設定した主要メソッドの設定を解除する主要メソッド設定解除ステップと、
を備え、
前記主要メソッド設定ステップでは、前記プログラムの実行中に主要メソッドを設定し、
前記主要メソッド設定解除ステップでは、前記プログラムの実行中に主要メソッドの設定を解除し、
前記プログラムの1回の実行中に、前記統計データ計測ステップによる計測と前記詳細データ計測ステップによる計測とを行う、
ことを特徴とする。
In order to achieve the above object, a profiling method according to a second aspect of the present invention includes:
Statistical data measurement step that measures the processing time of the executed method when a program composed of multiple methods is executed,
A processing time determination step of determining whether the processing time of the method measured by the statistical data measurement step is equal to or greater than a predetermined threshold;
A main method setting step for setting a method determined by the processing time determination step to have a processing time equal to or greater than a predetermined threshold as a main method that is a main factor of execution time when the program is executed;
A detailed data measurement step of obtaining a processing time of the main method and route information indicating what kind of method the main method has been called by when the main method is executed;
A method detailed information storage step for storing the processing time and route information of the main method acquired by the detailed data measuring step for each main method;
A main method setting release step for releasing the setting of the main method set in the main method setting step for the main method stored in the method detailed information storage step exceeding a predetermined number;
With
Wherein in the main method setting step sets the key methods during execution of the program,
In the main method setting release step, the setting of the main method is canceled during the execution of the program,
During one execution of the program, the measurement by the statistical data measurement step and the measurement by the detailed data measurement step are performed.
It is characterized by that.
上記目的を達成するため、本発明の第3の観点に係るプログラムは、
コンピュータを、
複数のメソッドから構成されたプログラムを実行した際に、実行したメソッドの処理時間を計測する統計データ計測手段、
前記統計データ計測手段により計測されたメソッドの処理時間が所定の閾値以上であるかを判別する処理時間判別手段、
前記処理時間判別手段により処理時間が所定の閾値以上であると判別されたメソッドを、前記プログラムを実行した際の実行時間の主要な要因となる主要メソッドに設定する主要メソッド設定手段、
前記主要メソッドが実行された際に、該主要メソッドの処理時間と該主要メソッドがどのようなメソッドを辿って呼び出されてきたのかを示すルート情報とを取得する、詳細データ計測手段、
前記詳細データ計測手段により取得された前記主要メソッドの処理時間とルート情報とを、該主要メソッド毎に記憶するメソッド詳細情報記憶手段、
所定の数を超えて前記メソッド詳細情報記憶手段に記憶されている主要メソッドに対して、前記主要メソッド設定手段によって設定した主要メソッドの設定を解除する主要メソッド設定解除手段、
として機能させるプログラムであって、
前記主要メソッド設定手段は、前記プログラムの実行中に主要メソッドを設定し、
前記主要メソッド設定解除手段は、前記プログラムの実行中に主要メソッドの設定を解除し、
前記プログラムの1回の実行中に、前記統計データ計測手段による計測と前記詳細データ計測手段による計測とを行う、
ことを特徴とする。
In order to achieve the above object, a program according to the third aspect of the present invention provides:
Computer
When executing a program composed of a plurality of methods, statistical data measuring means to measure the processing time of the method was executed,
Processing time determination hand stage processing time method measured by the statistical data measuring means for determining whether more than a predetermined threshold value,
The processing time by the processing time determination means methods that is determined to be equal to or larger than a predetermined threshold value, the main method setting means to set the main method that is the main factor of the execution time for executing the program,
Wherein when the primary method is performed, and acquires the route information indicating whether the has been invoked following a what methods the processing time of said principal methods and said principal methods, detailed data measurement hand stage,
Method detailed information storage means for storing the processing time and route information of the main method acquired by the detailed data measuring means for each main method,
Main method setting release means for releasing the setting of the main method set by the main method setting means for the main method stored in the method detailed information storage means exceeding a predetermined number;
A program that functions as
The main method setting means sets a main method during execution of the program,
The main method setting release means cancels the setting of the main method during the execution of the program,
During one execution of the program, the measurement by the statistical data measurement means and the measurement by the detailed data measurement means are performed.
It is characterized by that.
本発明によれば、1回のプログラムの実行で、統計的な情報と、詳細な情報とを同時に取得できるため、効率的なプロファイリングが可能となる。 According to the present invention, statistical information and detailed information can be acquired simultaneously by executing a program once, so that efficient profiling is possible.
以下、本発明の実施形態に係るプログラムプロファイリング装置について、図面を参照して説明する。
プログラムプロファイリング装置1は、図1に示すように、通信部11と、入力部12と、出力部13と、記憶部14と、入出力I/F部15と、制御部16と、を備え、各部はバス17を介して互いに接続されている。
Hereinafter, a program profiling apparatus according to an embodiment of the present invention will be described with reference to the drawings.
As shown in FIG. 1, the
通信部11は、通信ネットワーク2を介して、ネットワーク上の情報処理装置等と通信を行うものであり、通信インタフェース等を備える。例えば、通信部11が、プロファイリングの対象となる実行プログラムを受信することにより、プログラムプロファイリング装置1はプロファイリングの対象を取り込む。
なお、本実施形態でプロファイリングの対象とする実行プログラムは複数のクラスから構成され、各クラスは1つ以上のメソッドを備えているものとする。
The communication unit 11 communicates with an information processing apparatus and the like on the network via the
It is assumed that the execution program to be profiled in this embodiment is composed of a plurality of classes, and each class has one or more methods.
入力部12は、プログラムプロファイリング装置1に様々な情報を入力するために使用するものであり、ボタン、キー等の入力装置を備える。例えば、入力部12には、後述する分析処理の開始指示情報等が入力される。
The
出力部13は、様々な情報を出力するものであり、ディスプレイ等の表示装置を備える。例えば、出力部13には、後述する分析処理において測定されたメソッド毎の処理時間の一覧画面等が表示される。
The
記憶部14は、様々な情報やプログラム等を記憶するものであり、ハードディスク等の補助記憶装置を備える。例えば、記憶部14は、分析処理を行う前に、予め、通信部11等を介して取り込んだ実行プログラム等を記憶しておく。
また、記憶部は、図2に示すように、プローブ挿入対象記憶テーブル141と、メソッド統計情報記憶テーブル142と、コールグラフ情報記憶テーブル143と、メソッド情報記憶テーブル144と、メソッド詳細性能ログテーブル145と、を記憶する。
The
Further, as shown in FIG. 2, the storage unit includes a probe insertion target storage table 141, a method statistical information storage table 142, a call graph information storage table 143, a method information storage table 144, and a method detailed performance log table 145. And memorize.
プローブ挿入対象記憶テーブル141は図4に示すように、プロファイリング対象の実行プログラムを構成するクラス毎に、該クラスにプローブを挿入するか否かを示す情報を記憶する。 As shown in FIG. 4, the probe insertion target storage table 141 stores information indicating whether or not a probe is to be inserted into each class that constitutes an execution program to be profiled.
メソッド統計情報記憶テーブル142は、図5に示すように、プログラムを実行した際の、メソッド毎の総実行時間と、総待ち時間と、実行回数とを記憶する。なお、総待ち時間とは、当該メソッドから呼び出されるメソッドの処理が完了するまで、当該メソッドの処理が待機してしている待ち状態の時間(待ち時間)をプログラムの開始から終了までで累算した時間である。 As shown in FIG. 5, the method statistical information storage table 142 stores the total execution time, the total waiting time, and the number of executions for each method when the program is executed. The total waiting time is the accumulated waiting time (waiting time) from the start to the end of the program until the processing of the method called from the method is completed. It was time.
コールグラフ情報記憶テーブル143は、図6(A)に示すように、処理(メソッド)間の呼出関係(呼出元メソッド名と呼出先メソッド名)および、その呼出関係が呼び出された回数(呼び出し回数)を記憶する。なお、コールグラフ情報記憶テーブル143に図6(A)に示すような情報が記憶されている場合、この記憶情報から図6(B)に示すような呼出間系を表したグラフ(コールグラフ)を作成することができる。 As shown in FIG. 6 (A), the call graph information storage table 143 has a call relationship between processing (methods) (caller method name and callee method name) and the number of times the call relationship is called (call count). ) Is memorized. When information as shown in FIG. 6 (A) is stored in the call graph information storage table 143, a graph (call graph) representing an inter-call system as shown in FIG. 6 (B) from this stored information. Can be created.
メソッド情報記憶テーブル144は、図7に示すように、実行プログラムに含まれるメソッド毎に、メソッドIDと、トレース用IDと、メソッド名と、該メソッドが属するクラスの識別情報(クラス名)と、計測可否情報とを記憶する。
メソッドIDは、後述するプローブ挿入処理において発行される、メソッドの識別情報である。
トレース用IDは、後述するプローブ挿入処理において取得される、スタックトレースを取得する際に使用されるメソッドの識別情報である。例えば、実行プログラムがJAVA(登録商標)である場合、このトレース用IDはJAVA仮想マシン・プロファイラインタフェースが発行するIDに相当する。
計測可否情報は、該メソッドを計測部が行うプロファイルの対象とするか否かを示す情報である。
As shown in FIG. 7, the method information storage table 144 includes, for each method included in the execution program, a method ID, a tracing ID, a method name, identification information (class name) of a class to which the method belongs, Measurement availability information is stored.
The method ID is method identification information issued in a probe insertion process to be described later.
The trace ID is identification information of a method used when acquiring a stack trace, which is acquired in probe insertion processing described later. For example, when the execution program is JAVA (registered trademark), the tracing ID corresponds to an ID issued by the JAVA virtual machine profiler interface.
The measurement availability information is information indicating whether or not the method is a target of a profile performed by the measurement unit.
メソッド詳細性能ログテーブル145は、プロファイリングの結果を記憶するテーブルである。メソッド詳細性能ログテーブル145は、図8に示すように、実行されたメソッドの処理毎に、実行される処理が属するスレッドの識別情報(図では名称)と、メソッドIDと、実行時間と、待ち時間と、スタックトレースとを記憶する。
スタックトレースは、処理がどのようなメソッドを辿って呼び出されてきたのかを示す情報であり、辿ってきたメソッドのトレース用IDを順に記憶する。例えば、スタックトレースに「11111,22222,33333」という情報が記録されている場合、該スタックトレースを有する処理は、トレース用ID「11111」,「22222」,「33333」を有する各メソッドを順に辿って呼び出されてきたことを意味する。なお、トレース用IDに対応したメソッド名などの情報は、前述したメソッド情報記憶テーブル144を参照して取得すればよい。
The method detailed performance log table 145 is a table for storing the results of profiling. As shown in FIG. 8, the method detailed performance log table 145 includes, for each process of an executed method, identification information (name in the figure) of a thread to which the process to be executed belongs, a method ID, an execution time, and a wait Remember time and stack trace.
The stack trace is information indicating what method the process has been traced and called, and sequentially stores the trace ID of the traced method. For example, when information “11111, 22222, 33333” is recorded in the stack trace, the process having the stack trace traces each method having the trace IDs “11111”, “22222”, “33333” in order. Means that it has been called. Information such as the method name corresponding to the trace ID may be acquired with reference to the method information storage table 144 described above.
図1に戻り、入出力I/F部15は、入出力機器3を接続するためのインタフェースである。例えば、プロファイリング対象となる実行プログラム等を、通信部11ではなく、入出力I/F部15を介して、CD−ROMドライブ等の入出力機器3から取り込むこともできる。
Returning to FIG. 1, the input / output I /
制御部16は、データの演算処理を行うと共に、バス17を介して通信部11、入力部12、出力部13、記憶部14、入出力I/F部15を制御するものであり、CPU(Central Processing Unit)161、ROM(Read Only Memory)162、RAM(Random Access Memory)163等を備える。制御部16における演算処理及び制御処理は、具体的には、CPU161が、RAM163を作業領域として使用して各種データを一時的に記憶させながら、ROM162に記憶されている制御プログラムを実行することにより行われる。
The
例えば、制御部16が、ROM162や記憶部14に記憶されている制御プログラムに従って上記各部を制御することにより、プログラムプロファイリング装置1において、プロファイリング処理等が行わ
For example, the
図3は、本実施の形態に係るプログラムプロファイリング装置の機能構成例を示すブロック図である。
プログラムプロファイリング装置1は、機能的には、図示するように、プローブ挿入部21と、プログラム実行部22と、計測部23と、詳細計測対象設定部24と、計測方法選択部25と、計測対象設定部26とを備える。なお、これらの各構成要素は、図1に示した制御部16が、同じく図1に示した通信部11、入力部12、出力部13、記憶部14、又は入出力I/F部15を制御することにより、実現することができる。
FIG. 3 is a block diagram illustrating a functional configuration example of the program profiling apparatus according to the present embodiment.
As shown in the figure, the
プローブ挿入部21は、プローブ挿入対象記憶テーブル141で挿入対象であると設定されている(可と設定されている)クラスのメソッドに対して、計測用のプローブを挿入するとともに、該メソッドをメソッド情報記憶テーブル144に登録する。
The
プログラム実行部22は、プローブが挿入された実行プログラムを実行する。
The
計測部23は、プログラム実行部22によって実行された実行プログラムの処理(メソッド)に関する情報を計測する。計測部23は、統計データ計測部231と、詳細データ計測部232とを備える。
統計データ計測部231は、プログラムに含まれるほぼ全てのメソッドを計測の対象とした計測を行う。
詳細データ計測部232は、プログラムを実行したときに比較的その実行時間に影響を与えるメソッドを計測の対象として、統計データ計測部231が行う計測よりも、より詳細な計測を行う。
The
The statistical
The detailed
詳細計測対象設定部24は、詳細データ計測部232で計測の対象とするメソッドを設定する。
具体的には、詳細計測対象設定部24は、メソッド統計情報記憶テーブル142に記憶されているメソッドの処理時間が所定の閾値以上のとき、該メソッドに埋め込まれている詳細監視フラグを有効化して、該メソッドを詳細データ計測部232による計測の対象にする。また、統計データ計測部231は、メソッド詳細性能ログテーブル145を参照することにより、詳細データ計測部232による計測が所定の回数以上行われたメソッドを判別し、その判別したメソッドに埋め込まれている詳細監視フラグを無効化して、該メソッドを詳細データ計測部232による計測の対象から外す。
The detailed measurement
Specifically, the detailed measurement
計測方法選択部25は、上述した計測処理を、計測部の統計データ計測部231と詳細データ計測部232のどちらで行うのかを切り換える処理を行う。
The measurement
計測対象設定部26は、メソッド情報記憶テーブル144の計測可否フラグを更新して、計測対象とするメソッドを設定する。
The measurement
次に、プログラムプロファイリング装置1でプログラムを実行した際に、ボトルネックを見つけるためにプログラム(実行プログラム)をプロファイリングする処理について概略を説明する。
Next, an outline of processing for profiling a program (execution program) in order to find a bottleneck when a program is executed by the
なお、前提として、予めプロファイリングの対象となる実行プログラムは、記憶部14に格納されており、該実行プログラムを構成するクラスのうち、どのクラスをプローブの挿入対象とするかを示すための情報も、ユーザの準備作業等によりプローブ挿入対象記憶テーブル141に予め記憶されているものとする。
As a premise, an execution program to be profiled is stored in the
ユーザから、実行プログラムを計測するための指示入力が入力部12よりなされ、その入力情報が制御部16に送信されると、図9に示すプロファイリング処理が開始される。
When a user inputs an instruction for measuring an execution program from the
まず、プローブ挿入部21は、実行プログラムにメソッド計測用のプローブを挿入する(ステップS101)。
First, the
次に、計測対象設定部26は、プログラムに含まれる全てのメソッドを、統計データ計測部231による計測の対象とするための設定を行う(ステップS102)。
Next, the measurement
次に、プログラム実行時に処理されるメソッドの処理時間等を計測する処理を行う(ステップS103)。
以上で、プロファイリング処理は終了する。
Next, processing for measuring the processing time of a method processed at the time of program execution is performed (step S103).
This completes the profiling process.
次に、先程概略を説明したプロファイリング処理を、図10〜図16を参照してより詳細に説明する。 Next, the profiling process outlined above will be described in more detail with reference to FIGS.
(1)図9ステップS101のプローブ挿入処理:
まず、プローブ挿入部21は、計測対象の実行プログラムを構成するクラスを1つRAM163に読み込む(図10、ステップS201)。
(1) Probe insertion processing in step S101 in FIG. 9:
First, the
続いて、プローブ挿入部21は、プローブ挿入対象記憶テーブル141に記憶されている情報に基づいて、ステップS201で読み込んだクラスが、プローブ挿入対象になっているか否かを判断する(ステップS202)。
Subsequently, the
プローブ挿入対象のクラスでないと判断した場合(ステップS202;No)、プローブ挿入部21は、処理をステップS207に移す。
プローブ挿入対象のクラスであると判断した場合(ステップS202;Yes)、プローブ挿入部21は、クラスに含まれるメソッドに対して識別情報(メソッドID)を発行する(ステップS203)。
When it is determined that the class is not the probe insertion target class (step S202; No), the
When determining that the class is a probe insertion target class (step S202; Yes), the
そして、プローブ挿入部21は、メソッドIDを発行したメソッドの前後(実行段階でそのメソッドの実行の前後となる部分)に、計測用のプローブを挿入する(ステップS204)。
なお、メソッドの処理の前に挿入されたプローブを実行開始(検出用の)プローブ、メソッドの後に挿入されたプローブを実行終了(検出用の)プローブとして、以下説明する。
Then, the
In the following description, it is assumed that the probe inserted before the processing of the method is an execution start (for detection) probe, and the probe inserted after the method is an execution end (for detection) probe.
図11は、メソッドと、該メソッドに挿入されるプローブの挿入の工程を説明するための図である。
なお、図11に記載されているプログラムは、理解を容易にするため、バイナリデータである実行プログラムをJAVA(登録商標)の言語形式で表したものである。
図11(A)が示す実行プログラムには、クラス「A」が含まれており、クラス「A」には、引数が無いメソッド「sayHello」が含まれている。
この目的プログラムに計測用のプローブが挿入された例を図11(B)に示す。クラス「A」には、処理の先頭に、プローブの処理を実行させるか否かを示す監視フラグ「flag_1」と、詳細データ計測部232による詳細な計測を実行させるか否かを示す詳細監視フラグ「dflag_1」とが挿入される。また、メソッド「sayHello」の処理の開始時点には実行開始プローブ「enterMethod」が、処理の終了時点には実行終了プローブ「exitMethod」がそれぞれ挿入される。
この実行開始プローブ「enterMethod」および、実行終了プローブ「exitMethod」は、引数に詳細監視フラグ「dflag_1」を有する。詳細監フラグが無効である場合、プローブは、統計データ計測部231による測定のみを行う。詳細監視フラグが有効である場合、プローブは、統計データ計測部231による測定に加えて、詳細データ測定部232による測定も行う。
FIG. 11 is a diagram for explaining a method and a process of inserting a probe inserted into the method.
Note that the program described in FIG. 11 represents an execution program that is binary data in the JAVA (registered trademark) language format for easy understanding.
The execution program shown in FIG. 11A includes a class “A”, and the class “A” includes a method “sayHello” having no argument.
An example in which a measurement probe is inserted into this objective program is shown in FIG. In the class “A”, a monitoring flag “flag_1” indicating whether or not the probe processing is executed at the beginning of the processing, and a detailed monitoring flag indicating whether or not the detailed
The execution start probe “enterMethod” and the execution end probe “exitMethod” have a detailed monitoring flag “dflag — 1” as an argument. When the detailed supervision flag is invalid, the probe performs only measurement by the statistical
続いて、プローブ挿入部21は、クラスに含まれるメソッドのトレース用IDを取得する(ステップS205)。
なお、具体的には、実行プログラムを実行するための仮想マシン等が提供するAPI(Application Program Interface)の機能によりクラス情報を取得して、このクラス情報からトレース用IDを取得する。
Subsequently, the
Specifically, class information is acquired by an API (Application Program Interface) function provided by a virtual machine or the like for executing an execution program, and a trace ID is acquired from the class information.
続いて、プローブ挿入部21は、メソッド情報記憶テーブル144に、ステップS204でプローブを挿入したメソッドのメソッドID、クラス名、メソッド名および、ステップS205で取得したトレース用IDとを対応付けて1つのエントリとして登録する(図10,ステップS206)。
Subsequently, the
続いて、ステップS207で、プローブ挿入部21は、読み込んでいない他のクラスが有るか否かを判別する。
読み込んでいない他のクラスが有ると判別した場合は(ステップS207;Yes)、プローブ挿入部21は、ステップS201〜ステップS206の処理を繰り返す。
読み込んでいない他のクラスがないと判別した場合は(ステップS207;No)、プローブ挿入処理は終了する。
Subsequently, in step S207, the
When it is determined that there is another class that has not been read (step S207; Yes), the
When it is determined that there is no other class that has not been read (step S207; No), the probe insertion process ends.
(2)図9ステップS102の計測対象設定処理:
計測対象設定部26は、先程のプローブ挿入処理により登録されたメソッド情報記憶テーブル144の全エントリの計測可否フラグを、計測部23による計測の対象とすることを表す「可」に設定する(図12、ステップS301)。以上で、計測対象設定処理は終了する。
(2) Measurement object setting process in step S102 in FIG. 9:
The measurement
(3)図9ステップS103の計測処理:
プログラム実行部22が、プローブ挿入済みの実行プログラムを実行すると、実行プログラムのメソッドに埋め込まれているプローブの処理により、統計モードでのメソッドの計測がなされる。
(3) Measurement process in step S103 in FIG. 9:
When the
ここで、この実行プログラムの実行によって行われる、プローブが挿入されているメソッドの動作について、図13、図14を参照して説明する。
まず、メソッドの実行が開始されると、プログラム実行部22は、該メソッドが計測の対象となっているか否かを判断する(図13、ステップS401)。具体的には、プログラム実行部22は、メソッド情報記憶テーブル144の計測可否情報に基づいて、この判断を行う。
Here, the operation of the method in which the probe is inserted, which is performed by executing this execution program, will be described with reference to FIGS.
First, when the execution of a method is started, the
メソッドが計測の対象となっていないと判断した場合(ステップS401;No)、プログラム実行部22はステップS408に処理を移す。
When it is determined that the method is not a measurement target (step S401; No), the
メソッドが計測の対象となっていると判断した場合(ステップS401;Yes)、統計データ計測部231は、当該メソッドの処理が開始されたことを、そのときの時刻とともに、図15(A)のL1に示すように、RAM163に記録する(ステップS402)。
When it is determined that the method is a measurement target (step S401; Yes), the statistical
続いて、計測方法選択部25は、当該メソッドが詳細監視の対象とするメソッドから呼び出されたメソッドであるのか否かを判断する(ステップS403)。
Subsequently, the measurement
なお、このステップS403の判断は、例えば以下のようにして行えばよい。
まず、スレッド毎にカウンタCnt(初期値0)を準備する。そして、このカウンタCntは、詳細データ計測部232による計測の対象に設定されているメソッドが実行されると1に設定され、それ以後メソッドが実行される度に、1つずつインクリメントするように設定する。そして、メソッドの実行開始時に、該カウンタCntをチェックして、カウンタCntの値が1となっている場合は、当該メソッドが詳細監視の対象とするメソッドから呼び出されたメソッドと判断すればよい。
例えば、図16に示すような呼出関係を有するメソッドA〜Dがあるとする。すなわち、メソッドAは、メソッドBを呼び出し、メソッドBはメソッドCを呼び出し、メソッドCはメソッドDを呼び出す。なお、メソッドBは、詳細データ計測部232による計測の対象として設定されているメソッドであるとする。
このような状態において、メソッドAが実行されることにより、呼出関係によりメソッドB〜Dが順に実行されていく処理について考える。この場合、詳細監視の対象メソッドであるメソッドBが実行された時点で、カウンタCntは1に設定される。そして、以降メソッドCが実行されるとカウンタCntは2に、メソッドDが実行されるとカウンタCntは3に設定される。すなわちこの例では、メソッドの実行開始時にカウンタCntのチェックを行い、値が1に設定されている当該メソッドCを、詳細監視の対象とするメソッドから呼び出されたメソッドであると判断することができる。
Note that the determination in step S403 may be performed as follows, for example.
First, a counter Cnt (initial value 0) is prepared for each thread. The counter Cnt is set to 1 when a method set as a measurement target by the detailed
For example, it is assumed that there are methods A to D having a calling relationship as shown in FIG. That is, method A calls method B, method B calls method C, and method C calls method D. Note that the method B is a method set as a measurement target by the detailed
Consider a process in which methods B to D are executed in order according to the calling relationship when method A is executed in such a state. In this case, the counter Cnt is set to 1 at the time when the method B, which is the target method for detailed monitoring, is executed. Subsequently, when the method C is executed, the counter Cnt is set to 2, and when the method D is executed, the counter Cnt is set to 3. That is, in this example, the counter Cnt is checked at the start of execution of the method, and it is possible to determine that the method C whose value is set to 1 is a method called from the method to be monitored in detail. .
図13に戻り、当該メソッドが詳細監視の対象とするメソッドから呼び出されたメソッドであると判断すると(ステップS403;Yes)、詳細データ計測部232は、その呼出元の詳細監視の対象とするメソッドが待ち状態となったことを、該メソッドの処理が属するスレッドの識別情報(スレッド名)とそのときの時刻とともに、図15(B)のL3に示すようにRAM163に記録し(ステップS404)、ステップS408に処理を移す。
Returning to FIG. 13, when it is determined that the method is a method called from the method targeted for detail monitoring (step S403; Yes), the detail
当該メソッドが詳細監視の対象とするメソッドから呼び出されたメソッドでないと判断すると(ステップS403;No)、計測方法選択部25は、当該メソッドが詳細データ計測部232による計測の対象と成っているか否かを判断する(ステップS405)。具体的には、当該メソッドに埋め込まれている詳細監視フラグから、この判断を行う。
If it is determined that the method is not a method called from the method to be subject to detailed monitoring (step S403; No), the measurement
当該メソッドが詳細データ計測部232による計測の対象でないと判断した場合(ステップS405;No)、計測方法選択部25はステップS408に処理を移す。
When it is determined that the method is not a measurement target by the detailed data measurement unit 232 (step S405; No), the measurement
当該メソッドが詳細データ計測部232による計測の対象である判断した場合(ステップS405;Yes)、詳細データ計測部232は、当該メソッドの処理が開始されたことを、当該メソッドの処理が属するスレッドの識別情報(スレッド名)とそのときの時刻とともに、図15(C)のL5に示すように、RAM163に記録する(ステップS406)。
If it is determined that the method is an object of measurement by the detailed data measurement unit 232 (step S405; Yes), the detailed
続いて詳細データ計測部232はスタックトレースを行い、当該メソッドの処理が辿ってきたメソッドを、トレース用IDのリスト形式で取得し、RAM163に記憶する(ステップS407)。そして、処理をステップS408に移す。
なお、このスタックトレースは、実行プログラムを実行するための仮想マシン等が提供するAPIの機能によって行えばよい。例えば、JAVA(登録商標)であれば、JAVA仮想マシン・プロファイラインタフェース (JVMPI)が提供するスタックトレースを行うためのメソッドであるGetCallTrace()を利用することで、この処理を行うことが可能となる。
Subsequently, the detailed
The stack trace may be performed by an API function provided by a virtual machine or the like for executing the execution program. For example, in the case of JAVA (registered trademark), this process can be performed by using GetCallTrace (), which is a method for performing a stack trace provided by the JAVA virtual machine profiler interface (JVMPI). .
ステップS408で、プログラム実行部22は、当該メソッドに挿入されているプローブ以外のメソッドの処理(すなわち、プローブが挿入される前のメソッドの処理)を実行する。
In step S408, the
続いて、ステップS408の処理が終了すると、プログラム実行部22は、当該メソッドが計測の対象となっているか否かを判断する(図14、ステップS409)。なお、この処理はステップS401と実質的に同等な処理である。
Subsequently, when the process of step S408 ends, the
メソッドが計測の対象となっていないと判断した場合(ステップS409;No)、プログラム実行部22は当該メソッドの実行を終了する。
When it is determined that the method is not a measurement target (step S409; No), the
メソッドが計測の対象となっていると判断した場合(ステップS409;Yes)、統計データ計測部231は、当該メソッドの処理が終了したことを、そのときの時刻とともに図15(A)のL2に示すように、RAM163に記録する(ステップS410)。
If it is determined that the method is a measurement target (step S409; Yes), the statistical
そして、統計モード計測部231は、ステップS402とステップS410との処理によってRAM163に記録した情報から、当該メソッドの処理時間を算出する。さらに、統計モード計測部231は、算出した処理時間をメソッド統計情報記憶テーブル142の当該メソッドの総実行時間に累算すると共に、実行回数を1プラスする。
例えば、図15(A)に示すような情報がRAM163に記憶されている場合には、メソッド統計情報記憶テーブル142のメソッドID「01」を有するエントリに格納されているメソッドの処理時間に4秒が加算され、またその実行回数が1プラスされる。
Then, the statistical
For example, when information as shown in FIG. 15A is stored in the
続いて、統計モード計測部231は、ステップS402とステップS410との処理によってRAM163に記録した情報から、当該メソッドの待ち時間を算出し、算出した待ち時間をメソッド統計情報記憶テーブル142の当該メソッドの総待ち時間に累算する(ステップS412)。
例えば、ステップS402とステップS410との処理により、図15(D)に示すような情報がRAM163に記憶されている場合には、メソッド01の待ち時間は、メソッド01が呼出すメソッド02の処理時間である3秒と求めることができ、メソッド01の総待ち時間は3秒プラスされる。
また、この総待ち時間を求める処理は、実行プログラムを実行するための仮想マシン等が提供するAPIを利用することにより求めてもよい。
Subsequently, the statistical
For example, when information as shown in FIG. 15D is stored in the
Further, the processing for obtaining the total waiting time may be obtained by using an API provided by a virtual machine or the like for executing the execution program.
続いて、統計モード計測部231は、当該メソッドが、別のメソッドから呼び出されて実行されている場合には、その呼出元、呼出先の対応関係をコールグラフ情報記憶テーブル143に記憶する(ステップS413)。
例えば、ステップS402とステップS410との処理により、図15(D)に示すような情報がRAM163に記憶されている場合には、呼出元をメソッド「01」、呼出先をメソッド「02」、呼出回数「1」とするエントリ情報をコールグラフ情報記憶テーブル143に登録する。なお、コールグラフ情報記憶テーブル143に既に記憶されている呼出先と呼出元の対応関係である場合には、その対応関係の呼出回数をプラス1する処理を行う。
また、この呼出先の対応関係は、実行プログラムを実行するための仮想マシン等が提供するAPIを利用することにより求めてもよい。
Subsequently, when the method is called from another method and executed, the statistical
For example, when information as shown in FIG. 15D is stored in the
Further, the correspondence relationship of the call destinations may be obtained by using an API provided by a virtual machine or the like for executing the execution program.
続いて、計測方法選択部25は、当該メソッドが詳細データ計測部232の計測対象とするメソッドから呼び出されたメソッドであるのか否かを判断する(ステップS414)。なお、この判断処理はステップS403と実施的に同等な処理である。
Subsequently, the measurement
当該メソッドが詳細監視の対象とするメソッドから呼び出されたメソッドであると判断すると(ステップS414;Yes)、詳細データ計測部232は、その呼出元の詳細監視の対象とするメソッドの待ち状態が解除されたことを、該メソッドの処理が属するスレッドの識別情報(スレッド名)とそのときの時刻とともに、図15(B)のL4に示すようにRAM163記録する(ステップS415)。
If it is determined that the method is a method called from the method targeted for detail monitoring (step S414; Yes), the detail
そして、ステップS404とステップS415とでRAM163に記憶した情報から、当該メソッドの呼出元となる詳細監視対象のメソッドの待ち時間を求め、詳細性能ログテーブルに記憶する(ステップS416)。そして、処理をステップS421に移す。
例えば、ステップS404とステップS415の処理により、図15(B)に示すような情報がRAM163に記憶されている場合、詳細データ計測部232は、メソッド詳細性能ログテーブル145のスレッド「#1」、メソッド01を有するエントリの待ち時間が「10秒」と記憶される。
Then, from the information stored in the
For example, when information such as that shown in FIG. 15B is stored in the
当該メソッドが詳細監視の対象とするメソッドから呼び出されたメソッドでないと判断すると(ステップS414;No)、計測方法選択部25は、当該メソッドが詳細データ計測部232による計測の対象と成っているか否かを判断する(ステップS417)。なお、この判断処理はステップS405と実施的に同等な処理である。
If it is determined that the method is not a method called from the method to be monitored in detail (Step S414; No), the measurement
当該メソッドが詳細データ計測部232による計測の対象でないと判断した場合(ステップS417;No)、計測方法選択部25はステップS421に処理を移す。
If it is determined that the method is not a measurement target by the detailed data measurement unit 232 (step S417; No), the measurement
当該メソッドが詳細データ計測部232による計測の対象であると判断した場合(ステップS417;Yes)、詳細データ計測部232は、当該メソッドの処理が終了したことを、当該メソッドの処理が属するスレッドの識別情報(スレッド名)とそのときの時刻とともに、図15(C)のL6に示すように、RAM163に記録する(ステップS418)。
When it is determined that the method is an object to be measured by the detailed data measurement unit 232 (step S417; Yes), the detailed
そして、詳細データ計測部232は、ステップS406とステップS418との処理によってRAM163に記録した情報から、メソッド詳細性能ログテーブル145に登録するためのエントリ情報を作成し、登録する(ステップS419)。
例えば、ステップS406とステップS418の処理により、図15(C)に示すような情報がRAM163に記憶されている場合、詳細データ計測部232は、スレッド「#1」、メソッド「01」、実行時間「4秒」のエントリをメソッド詳細性能ログテーブル145に記憶する。
Then, the detailed
For example, when the information as shown in FIG. 15C is stored in the
次に、詳細データ計測部232は、ステップS407でRAM163に記憶したトレース用IDのリストを、ステップS419で登録したエントリのスタックトレースに登録し(ステップS420)、処理をステップS422に移す。
Next, the detailed
ステップS421において、詳細計測対象設定部24は、メソッド統計情報記憶テーブル142に記憶されている情報に基づいて、当該メソッドの総処理時間が、所定の閾値(例えば60秒)以上であるか否かを判別する。
なお、この閾値は、所定の時間内にメソッド統計情報記憶テーブル142に記憶された総処理時間の最大値を基準とした値(例えば最大値の80%)などの、動的に変化する値であっても良い。
In step S421, based on the information stored in the method statistical information storage table 142, the detailed measurement
This threshold value is a value that changes dynamically, such as a value based on the maximum value of the total processing time stored in the method statistical information storage table 142 within a predetermined time (for example, 80% of the maximum value). There may be.
当該メソッドの総処理時間が所定の閾値以上でないと判別すると(ステップS421;No)、詳細計測対象設定部24は当該メソッドの処理を終了する。
If it is determined that the total processing time of the method is not equal to or greater than the predetermined threshold (step S421; No), the detailed measurement
当該メソッドの総処理時間が所定の閾値以上であると判別すると(ステップS421;Yes)、詳細計測対象設定部24は当該メソッドに埋め込まれている詳細監視フラグを有効化して、当該メソッドを詳細データ計測部232による計測の対象となるように設定し(ステップS423)、当該メソッドの処理を終了する。
If it is determined that the total processing time of the method is equal to or greater than the predetermined threshold (step S421; Yes), the detailed measurement
ステップS422において、詳細計測対象設定部24は、当該メソッドの処理によるメソッド詳細性能ログテーブル145のエントリが、所定の数(例えば20)以上登録されているか否かを判断する。
In step S422, the detailed measurement
所定の数以上登録されていないと判断すると(ステップS422;No)、詳細計測対象設定部24は当該メソッドの処理を終了する。
If it is determined that the predetermined number or more are not registered (step S422; No), the detailed measurement
所定の数以上登録されていると判断すると(ステップS422;Yes)、詳細計測対象設定部24は当該メソッドに埋め込まれている詳細監視フラグを無効化して、当該メソッドを詳細データ計測部232による計測の対象とならないように設定し(ステップS424)、当該メソッドの処理を終了する。
If it is determined that a predetermined number or more are registered (step S422; Yes), the detailed measurement
以上で、プローブが挿入されたメソッドが実行された場合の処理は終了する。そして、実行プログラムを実行したときに実行される全てのプローブが挿入されているメソッドに対して、前述の処理が実行される。そして、プログラムの実行が完了した時点で、計測処理は終了し、図9に示すプロファイリング処理は終了する。 Thus, the process when the method in which the probe is inserted is executed is completed. And the above-mentioned process is performed with respect to the method in which all the probes executed when the execution program is executed are inserted. Then, when the execution of the program is completed, the measurement process ends, and the profiling process shown in FIG. 9 ends.
以上説明したように、この実施の形態によれば、プログラムを実行した際に実行されるほぼ全てのメソッドを測定対象とした統計データ計測部231による計測が行われるとともに、その計測によって求められたメソッドの総実行時間に基づいて、詳細データ計測部232による監視の対象となるメソッドが随時設定される。そして、この設定がなされたメソッドに対しては、詳細データ計測部232による計測が行われる。
そのため、プログラムの実行回数が1回で、ほぼ全てのメソッドを測定対象とした統計的な測定と、ボトルネックとなる可能性のあるメソッドを測定対象とした、メソッドが実行される度に呼出関係とともに処理時間の測定を行う詳細な測定とを実施することが可能となり、実行環境への負荷を抑えた、より効率の良いプロファイリングを実現することができる。
As described above, according to this embodiment, measurement is performed by the statistical
Therefore, the number of program executions is one, statistical measurement with almost all methods as the measurement target, and the call relationship every time a method is executed with the method that may be a bottleneck as the measurement target. At the same time, it is possible to carry out detailed measurement for measuring the processing time, and it is possible to realize more efficient profiling with reduced load on the execution environment.
なお、この発明は上記実施の形態に限定されず、様々な応用が可能である。 In addition, this invention is not limited to the said embodiment, A various application is possible.
例えば、メソッド詳細性能ログテーブル145のエントリが、所定の数以上登録されているメソッドに対して詳細監視フラグを無効化したが(図14、ステップS422、S424)、この処理は必ずしも行う必要はない。
また、上記実施の形態では、詳細監視フラグを有効化するか否かの判別を、実行されたメソッドの総実行時間が所定の閾値以上であるかどうかにより行った。しかしこの判別を、当該メソッドの実行時間(すなわち当該メソッドが過去に実行された際の実行時間は含まない時間)が所定の閾値以上であるかどうかで、この判別を行ってもよい。この場合、総実行時間を求めるために、実行時間をメソッド毎に累算して記憶する処理を行う必要がないため、より高速にプロファイリングを行うことができる。
For example, although the detail monitoring flag is invalidated for a method in which a predetermined number or more entries are registered in the method detailed performance log table 145 (FIG. 14, steps S422 and S424), this process is not necessarily performed. .
In the above embodiment, whether or not to enable the detailed monitoring flag is determined based on whether or not the total execution time of the executed method is equal to or greater than a predetermined threshold. However, this determination may be made based on whether or not the execution time of the method (that is, the time not including the execution time when the method has been executed in the past) is equal to or greater than a predetermined threshold. In this case, since it is not necessary to perform processing for accumulating and storing the execution time for each method in order to obtain the total execution time, profiling can be performed at a higher speed.
なお、本発明のプログラムプロファイリング装置は、専用のハードウェアに限られるものではなく、通常のコンピュータシステムによっても実現することができる。
具体的には、上記実施の形態では、プログラムプロファイリング装置のプログラムが、メモリ等に予め記憶されているものとして説明した。しかし、上述の処理動作を実行させるためのプログラムを、フレキシブルディスク、CD−ROM(Compact Disk Read-Only Memory)、DVD(Digital Versatile Disk)、MO(Magneto-Optical disk)等のコンピュータ読み取り可能な記録媒体に格納して配布し、そのプログラムをコンピュータにインストールすることにより、上述の処理を実行するプログラムプロファイリング装置を構成してもよい。
Note that the program profiling apparatus of the present invention is not limited to dedicated hardware, and can also be realized by a normal computer system.
Specifically, in the above embodiment, the program profiling apparatus has been described as being prestored in a memory or the like. However, a program for executing the above-described processing operation is recorded on a computer-readable recording medium such as a flexible disk, a CD-ROM (Compact Disk Read-Only Memory), a DVD (Digital Versatile Disk), or an MO (Magneto-Optical disk). A program profiling apparatus that executes the above-described processing may be configured by storing and distributing the program in a medium and installing the program in a computer.
また、プログラムをインターネット等の通信ネットワーク上のサーバ装置が有するディスク装置等に格納しておき、例えば、搬送波に重畳させて、コンピュータにダウンロード等するようにしてもよい。さらに、通信ネットワークを介してプログラムを転送しながら起動実行することによっても、上述の処理を達成することができる。
また、上述の機能を、OS(Operating System)が分担又はOSとアプリケーションの協働により実現する場合等には、OS以外の部分のみを媒体に格納して配布してもよく、また、コンピュータにダウンロード等してもよい。
Further, the program may be stored in a disk device or the like included in a server device on a communication network such as the Internet, and may be downloaded to a computer by being superimposed on a carrier wave, for example. Furthermore, the above-described processing can also be achieved by starting and executing a program while transferring it via a communication network.
When the above functions are realized by an OS (Operating System) sharing or by cooperation between the OS and an application, only the part other than the OS may be stored in a medium and distributed. You may download it.
1 プログラムプロファイリング装置
141 プローブ挿入対象記憶テーブル
142 メソッド統計情報記憶テーブル
143 コールグラフ情報記憶テーブル
144 メソッド情報記憶テーブル
145 メソッド詳細性能ログテーブル
21 プローブ挿入部
22 プログラム実行部
23 計測部
231 統計データ計測部
232 詳細データ計測部
24 詳細計測対象設定部
25 計測方法選択部
26 計測対象設定部
1
Claims (6)
前記統計データ計測手段により計測されたメソッドの処理時間が所定の閾値以上であるかを判別する処理時間判別手段と、
前記処理時間判別手段により処理時間が所定の閾値以上であると判別されたメソッドを、前記プログラムを実行した際の実行時間の主要な要因となる主要メソッドに設定する主要メソッド設定手段と、
前記主要メソッドが実行された際に、該主要メソッドの処理時間と該主要メソッドがどのようなメソッドを辿って呼び出されてきたのかを示すルート情報とを取得する、詳細データ計測手段と、
前記詳細データ計測手段により取得された前記主要メソッドの処理時間とルート情報とを、該主要メソッド毎に記憶するメソッド詳細情報記憶手段と、
所定の数を超えて前記メソッド詳細情報記憶手段に記憶されている主要メソッドに対して、前記主要メソッド設定手段によって設定した主要メソッドの設定を解除する主要メソッド設定解除手段と、
を備え、
前記主要メソッド設定手段は、前記プログラムの実行中に主要メソッドを設定し、
前記主要メソッド設定解除手段は、前記プログラムの実行中に主要メソッドの設定を解除し、
前記プログラムの1回の実行中に、前記統計データ計測手段による計測と前記詳細データ計測手段による計測とを行う、
ことを特徴とするプログラムプロファイリング装置。 Statistical data measuring means for measuring the processing time of the executed method when a program composed of a plurality of methods is executed;
Processing time determination means for determining whether the processing time of the method measured by the statistical data measurement means is equal to or greater than a predetermined threshold;
Main method setting means for setting a method determined by the processing time determination means to have a processing time equal to or greater than a predetermined threshold as a main method that is a main factor of execution time when the program is executed;
Detailed data measuring means for acquiring processing information of the main method and route information indicating what method the main method has been followed by when the main method is executed;
Method detailed information storage means for storing the processing time and route information of the main method acquired by the detailed data measuring means for each main method;
Main method setting release means for releasing the setting of the main method set by the main method setting means for the main methods stored in the method detailed information storage means exceeding a predetermined number;
With
The main method setting means sets a main method during execution of the program,
The main method setting release means cancels the setting of the main method during the execution of the program,
During one execution of the program, the measurement by the statistical data measurement means and the measurement by the detailed data measurement means are performed.
A program profiling apparatus characterized by the above.
ことを特徴とする、請求項1に記載のプログラムプロファイリング装置。 The statistical data measuring means accumulates the processing time of the executed method for each method, and sets the accumulated processing time as the processing time of the method.
The program profiling apparatus according to claim 1, wherein:
ことを特徴とする、請求項1又は2に記載のプログラムプロファイリング装置。 The threshold is a value based on the maximum value of the processing time measured by the statistical data measuring means within a predetermined time.
The program profiling apparatus according to claim 1, wherein the apparatus is a program profiling apparatus.
前記詳細データ計測手段は、前記待ち時間求め手段によって求められた待ち時間を前記主要メソッド毎に記憶する、
ことを特徴とする請求項1乃至3の何れか1項に記載のプログラムプロファイリング装置。 A waiting time obtaining means for obtaining a waiting time during which the main method is waiting for processing;
The detailed data measuring means stores the waiting time obtained by the waiting time obtaining means for each main method.
The program profiling apparatus according to any one of claims 1 to 3 , wherein
前記統計データ計測ステップにより計測されたメソッドの処理時間が所定の閾値以上であるかを判別する処理時間判別ステップと、
前記処理時間判別ステップにより処理時間が所定の閾値以上であると判別されたメソッドを、前記プログラムを実行した際の実行時間の主要な要因となる主要メソッドに設定する主要メソッド設定ステップと、
前記主要メソッドが実行された際に、該主要メソッドの処理時間と、該主要メソッドがどのようなメソッドを辿って呼び出されてきたのかを示すルート情報とを取得する、詳細データ計測ステップと、
前記詳細データ計測ステップにより取得された前記主要メソッドの処理時間とルート情報とを、該主要メソッド毎に記憶するメソッド詳細情報記憶ステップと、
所定の数を超えて前記メソッド詳細情報記憶ステップで記憶した主要メソッドに対して、前記主要メソッド設定ステップで設定した主要メソッドの設定を解除する主要メソッド設定解除ステップと、
を備え、
前記主要メソッド設定ステップでは、前記プログラムの実行中に主要メソッドを設定し、
前記主要メソッド設定解除ステップでは、前記プログラムの実行中に主要メソッドの設定を解除し、
前記プログラムの1回の実行中に、前記統計データ計測ステップによる計測と前記詳細データ計測ステップによる計測とを行う、
ことを特徴とするプログラムプロファイリング方法。 Statistical data measurement step that measures the processing time of the executed method when a program composed of multiple methods is executed,
A processing time determination step of determining whether the processing time of the method measured by the statistical data measurement step is equal to or greater than a predetermined threshold;
A main method setting step for setting a method determined by the processing time determination step to have a processing time equal to or greater than a predetermined threshold as a main method that is a main factor of execution time when the program is executed;
A detailed data measurement step of obtaining a processing time of the main method and route information indicating what kind of method the main method has been called by when the main method is executed;
A method detailed information storage step for storing the processing time and route information of the main method acquired by the detailed data measuring step for each main method;
A main method setting release step for releasing the setting of the main method set in the main method setting step for the main method stored in the method detailed information storage step exceeding a predetermined number;
With
Wherein in the main method setting step sets the key methods during execution of the program,
In the main method setting release step, the setting of the main method is canceled during the execution of the program,
During one execution of the program, the measurement by the statistical data measurement step and the measurement by the detailed data measurement step are performed.
A program profiling method characterized by the above.
複数のメソッドから構成されたプログラムを実行した際に、実行したメソッドの処理時間を計測する統計データ計測手段、
前記統計データ計測手段により計測されたメソッドの処理時間が所定の閾値以上であるかを判別する処理時間判別手段、
前記処理時間判別手段により処理時間が所定の閾値以上であると判別されたメソッドを、前記プログラムを実行した際の実行時間の主要な要因となる主要メソッドに設定する主要メソッド設定手段、
前記主要メソッドが実行された際に、該主要メソッドの処理時間と該主要メソッドがどのようなメソッドを辿って呼び出されてきたのかを示すルート情報とを取得する、詳細データ計測手段、
前記詳細データ計測手段により取得された前記主要メソッドの処理時間とルート情報とを、該主要メソッド毎に記憶するメソッド詳細情報記憶手段、
所定の数を超えて前記メソッド詳細情報記憶手段に記憶されている主要メソッドに対して、前記主要メソッド設定手段によって設定した主要メソッドの設定を解除する主要メソッド設定解除手段、
として機能させるプログラムであって、
前記主要メソッド設定手段は、前記プログラムの実行中に主要メソッドを設定し、
前記主要メソッド設定解除手段は、前記プログラムの実行中に主要メソッドの設定を解除し、
前記プログラムの1回の実行中に、前記統計データ計測手段による計測と前記詳細データ計測手段による計測とを行う、
ことを特徴とするプログラム。 Computer
When executing a program composed of a plurality of methods, statistical data measuring means to measure the processing time of the method was executed,
Processing time determination hand stage processing time method measured by the statistical data measuring means for determining whether more than a predetermined threshold value,
The processing time by the processing time determination means methods that is determined to be equal to or larger than a predetermined threshold value, the main method setting means to set the main method that is the main factor of the execution time for executing the program,
Wherein when the primary method is performed, and acquires the route information indicating whether the has been invoked following a what methods the processing time of said principal methods and said principal methods, detailed data measurement hand stage,
Method detailed information storage means for storing the processing time and route information of the main method acquired by the detailed data measuring means for each main method,
Main method setting release means for releasing the setting of the main method set by the main method setting means for the main method stored in the method detailed information storage means exceeding a predetermined number;
A program that functions as
The main method setting means sets a main method during execution of the program,
The main method setting release means cancels the setting of the main method during the execution of the program,
During one execution of the program, the measurement by the statistical data measurement means and the measurement by the detailed data measurement means are performed.
A program characterized by that.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007095389A JP4905974B2 (en) | 2007-03-30 | 2007-03-30 | Program profiling apparatus, program profiling method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007095389A JP4905974B2 (en) | 2007-03-30 | 2007-03-30 | Program profiling apparatus, program profiling method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2008257287A JP2008257287A (en) | 2008-10-23 |
JP4905974B2 true JP4905974B2 (en) | 2012-03-28 |
Family
ID=39980830
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007095389A Expired - Fee Related JP4905974B2 (en) | 2007-03-30 | 2007-03-30 | Program profiling apparatus, program profiling method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4905974B2 (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9418005B2 (en) | 2008-07-15 | 2016-08-16 | International Business Machines Corporation | Managing garbage collection in a data processing system |
JP5182821B2 (en) | 2009-05-29 | 2013-04-17 | インターナショナル・ビジネス・マシーンズ・コーポレーション | Method for determining the cause of memory consumption in a program, and its computer system and computer program |
US9176783B2 (en) | 2010-05-24 | 2015-11-03 | International Business Machines Corporation | Idle transitions sampling with execution context |
US8843684B2 (en) | 2010-06-11 | 2014-09-23 | International Business Machines Corporation | Performing call stack sampling by setting affinity of target thread to a current process to prevent target thread migration |
US8799872B2 (en) | 2010-06-27 | 2014-08-05 | International Business Machines Corporation | Sampling with sample pacing |
WO2012073580A1 (en) * | 2010-11-29 | 2012-06-07 | 日本電気株式会社 | Performance evaluation device and performance evaluation method |
US8799904B2 (en) | 2011-01-21 | 2014-08-05 | International Business Machines Corporation | Scalable system call stack sampling |
JP6079071B2 (en) * | 2012-09-10 | 2017-02-15 | 日本電気株式会社 | Application execution apparatus, method, and program |
JP6471615B2 (en) * | 2015-06-02 | 2019-02-20 | 富士通株式会社 | Performance information generation program, performance information generation method, and information processing apparatus |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS62245443A (en) * | 1986-04-18 | 1987-10-26 | Mitsubishi Electric Corp | Measuring method for execution time of program |
JP2004310181A (en) * | 2003-04-02 | 2004-11-04 | Nec Corp | Device and method for and subroutine performance measuring, program |
-
2007
- 2007-03-30 JP JP2007095389A patent/JP4905974B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2008257287A (en) | 2008-10-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4905974B2 (en) | Program profiling apparatus, program profiling method, and program | |
US8214628B2 (en) | Computer performance monitoring by associating counter values with particular processes when an interrupt is detected | |
JP5353227B2 (en) | Information processing apparatus having performance measurement program, performance measurement method, and performance measurement function. | |
JP4879782B2 (en) | Program profiling method and program | |
US9189393B2 (en) | Computer, control method of computer, and recording medium | |
US20090222646A1 (en) | Method and apparatus for detecting processor behavior using instruction trace data | |
JP2003050715A (en) | Compiler and debugging device | |
JP2017037370A (en) | Computing device, process control method and process control program | |
JP6070712B2 (en) | Information processing apparatus and performance analysis data collection method | |
JP4971679B2 (en) | Processor system and performance measurement method for processor system | |
US10409636B2 (en) | Apparatus and method to correct an execution time of a program executed by a virtual machine | |
US20230289210A1 (en) | Extraction of side channel information from multithreaded processors based on processor resource contention | |
JP2014142682A (en) | Memory address management system and program | |
JP2011258058A (en) | Performance prediction apparatus, computer program and performance prediction method | |
JP6510430B2 (en) | Trace data editing apparatus and method | |
JP2005215816A (en) | Performance profiling method using hardware monitor | |
JP2009015734A (en) | Program profiling device, program profiling method and program | |
WO2012056569A1 (en) | Performance measurement method, performance measurement device, and performance measurement program | |
JP2011203995A (en) | Analysis device, analysis method and analysis program | |
JP4869581B2 (en) | Coverage measurement system and program thereof | |
JP2011150736A (en) | Profiling program, profiling method and computer | |
JP6048225B2 (en) | Processing device and performance monitoring information acquisition program | |
JP2002318712A (en) | Program running history analyzing method | |
JP6834457B2 (en) | Emulation performance calculation device, emulation performance calculation system, emulation performance calculation method, and emulation performance calculation program | |
JP2016218743A (en) | Operation candidate providing program, operation candidate providing apparatus, and operation candidate providing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20100324 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20110620 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20110705 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20110905 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20111011 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20111212 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20120104 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20120105 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150120 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4905974 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |