JP2005242879A - Performance information acquiring device and method, and control program - Google Patents

Performance information acquiring device and method, and control program Download PDF

Info

Publication number
JP2005242879A
JP2005242879A JP2004054513A JP2004054513A JP2005242879A JP 2005242879 A JP2005242879 A JP 2005242879A JP 2004054513 A JP2004054513 A JP 2004054513A JP 2004054513 A JP2004054513 A JP 2004054513A JP 2005242879 A JP2005242879 A JP 2005242879A
Authority
JP
Japan
Prior art keywords
performance information
information
program
execution
thread
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2004054513A
Other languages
Japanese (ja)
Inventor
Kazuhiro Kusano
和寛 草野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2004054513A priority Critical patent/JP2005242879A/en
Publication of JP2005242879A publication Critical patent/JP2005242879A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a function which can be used on a text level handled with parallel processing even though it has a similar use interface as prof which can be used only by optionally specifying a compiler. <P>SOLUTION: This system acquires discrimination information of a plurality of threads which are executed in parallel at the time of executing a program, manages pointers to access unique data including executing time information of the threads corresponding to the discrimination information, acquires the executing time information as performance information for every threads respectively accessing the plurality of threads on the basis of the pointers, totals the acquired results, and outputs performance information for every threads respectively together with performance information of the whole program. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は、プログラムの性能情報を取得する技術に関する。特に、複数のスレッドが並行実行されているプログラムに利用する。   The present invention relates to a technique for acquiring performance information of a program. In particular, it is used for programs in which a plurality of threads are executed in parallel.

従来の性能情報取得方法の一例として、Linux上で一般に利用されているprofがある。これは、プログラムの実行で各関数の処理に要した時間を測定して、その結果をテキストベースで表示する機能を備えており、逐次プログラムのチューニングなどで有効である。利用方法は、プログラムをコンパイルする際にオプションを指定するのみであり、その結果がテキストファイルとして出力されるために利用し易い。しかし、並列処理に対応していないため、スレッド単位の実行状況を表示することができない。   As an example of a conventional performance information acquisition method, there is prof which is generally used on Linux. This has a function of measuring the time required for processing each function during program execution and displaying the result on a text basis, which is effective for sequential program tuning and the like. The method of use only specifies options when compiling the program, and the result is output as a text file, which is easy to use. However, since it does not support parallel processing, the execution status of each thread cannot be displayed.

テキストベースで動作する機能を提供する他の例では、ライブラリとして提供され、その機能を利用する場合にはプログラム中にライブラリ呼び出しを挿入してコンパイルするものがあるが、これも並列処理に対応していない。ライブラリとして提供しているものは、コンパイラとは別に開発することができ、コンパイラの変更は必要としないが、プログラムの修正が必要であるという点で利用者に負担が必要となっている。
特開平8−147199号公報 特開平9−237203号公報
Other examples that provide functions that operate on a text basis are provided as libraries, and when using these functions, some programs are compiled by inserting library calls into the program. This also supports parallel processing. Not. What is provided as a library can be developed separately from the compiler and does not require changes to the compiler, but requires a burden on the user in that the program needs to be modified.
JP-A-8-147199 JP-A-9-237203

このように、従来のライブラリは、性能情報を取得する処理においてスレッドに対する考慮がされていないため、並列実行した各スレッドの性能情報を取得することができなかった。並列処理に対応した性能情報を表示するものとして、コンパイラと分離されたツールはあるが、逐次処理で利用できるテキストベースの機能とは異なるものであった。   As described above, the conventional library does not consider the thread in the process of acquiring the performance information, and thus cannot acquire the performance information of each thread executed in parallel. Although there is a tool separated from the compiler for displaying performance information corresponding to parallel processing, it is different from the text-based function that can be used in sequential processing.

特許文献1によれば、情報取得の命令をプログラムに追加せずに、動的ライブラリの実行回数と時間とを取得する装置が開示されている。この実現のために、その構成においてカーネルにフラグを用意し、それを利用して実行時にリンクをライブラリに変更したり、一定の時間毎に情報取得するモジュールを起動している。発明の効果としては、プログラムの再コンパイル(翻訳)と再リンク(結合)を行わず、通常のロードモジュールのまま実行情報の取得を可能にすることが挙げられている。   According to Patent Document 1, an apparatus that acquires the number of times of execution and time of a dynamic library without adding an information acquisition command to a program is disclosed. In order to realize this, a flag is prepared in the kernel in the configuration, and a link is changed to a library at the time of execution by using the flag, or a module for acquiring information at a certain time is started. The effect of the invention is that execution information can be acquired as a normal load module without recompiling (translating) and relinking (joining) the program.

しかし、特許文献1によれば、カーネルに用意するフラグや測定監視処理手段が必要になり、さらに、実行時にカーネルのフラグの値による実行情報取得を制御する仕組みや動的リンカのテーブル書き換え操作に関する手段が必要になり複雑である。   However, according to Patent Document 1, a flag and measurement monitoring processing means prepared in the kernel are required, and further, a mechanism for controlling execution information acquisition by the value of the kernel flag at the time of execution and a table rewriting operation of the dynamic linker. Means are required and complicated.

また、特許文献2によれば、スレッドの性能を測定するシステムが開示されている。その構成では、各スレッドのデータについて、親と子のスレッドに関連したエリアを用意して、それらにデータを記録していくことを特徴としている。このときに、スレッドの親子関係を記憶する並列サポートレイヤの延長部分を利用している。効果としては、親スレッドを識別する仕組みである並列サポートレイヤを用いて、データを保持する複数のメモリセルを決定して並列プロファイラの機能を提供していることが挙げられている。   Further, according to Patent Document 2, a system for measuring the performance of a thread is disclosed. The configuration is characterized in that for each thread data, an area related to the parent thread and the child thread is prepared and the data is recorded therein. At this time, the extended part of the parallel support layer that stores the parent-child relationship of the threads is used. As an effect, it is mentioned that a parallel profiler function is provided by determining a plurality of memory cells holding data using a parallel support layer that is a mechanism for identifying a parent thread.

しかし、特許文献2によれば、スレッドの親子関係を記憶し、それを用いてデータを保持するメモリセルを用意し、データを複数のメモリセルに保存する必要があり、特殊なハードウェア構成を必要とする。   However, according to Patent Document 2, it is necessary to prepare a memory cell that stores the parent-child relationship of a thread and holds data using the thread, and to store the data in a plurality of memory cells. I need.

本発明は、このような背景に行われたものであって、コンパイラのオプション指定のみで利用できるprofと同様の利用インタフェースでありながら並列処理に対応したテキストレベルで利用可能な機能を提供することを目的とする。   The present invention is made in such a background, and provides a function that can be used at a text level corresponding to parallel processing while having the same use interface as prof that can be used only by specifying a compiler option. With the goal.

本発明は、OpenMPなどスレッドを利用した並列実行において、各スレッドの性能情報を実行時情報として取得し、それらを用いてプログラム全体の性能情報を生成し、スレッドの性能情報と共に利用者に提供することを可能にすることを特徴とする。   The present invention acquires performance information of each thread as runtime information in parallel execution using threads such as OpenMP, generates performance information of the entire program using them, and provides it to the user together with the performance information of the thread. It is characterized by making it possible.

同じライブラリ呼び出しインタフェースを持ち、かつスレッドによる並列実行に対応した並列実行用性能情報取得ライブラリを用意する。ライブラリ呼び出しインタフェースが同じため、性能情報を取得する際に行うコンパイラのコード挿入処理は、従来の逐次処理の処理と互換性を保っている。   Prepare a performance information acquisition library for parallel execution that has the same library call interface and supports parallel execution by threads. Since the library call interface is the same, the compiler code insertion processing performed when acquiring performance information is compatible with the conventional sequential processing.

次に、コンパイル時に指定されたオプションを解析して、並列実行オプションが指定された場合に並列実行用のライブラリをリンクし、それ以外の場合は従来のライブラリをリンクするようにリンクオプションを生成する。   Next, the options specified at compile time are analyzed, and if the parallel execution option is specified, the library for parallel execution is linked. Otherwise, the link option is generated so that the conventional library is linked. .

並列実行に対応したライブラリのインタフェースは、引数を含めて従来のライブラリと同じであるが、実行時に各スレッドに対応して性能情報を扱う必要がある。このため、実行時にスレッド識別情報(以下、IDと記す)を取得し、これと引数として渡されてくる通常は関数名である識別子から、管理情報に問い合わせて、対応したスレッドの性能情報を更新する。   The interface of the library corresponding to parallel execution is the same as that of the conventional library including arguments, but it is necessary to handle performance information corresponding to each thread at the time of execution. For this reason, the thread identification information (hereinafter referred to as ID) is acquired at the time of execution, and the management information is queried from the identifier that is usually a function name passed as an argument, and the performance information of the corresponding thread is updated. To do.

そして、プログラム実行終了時には、各スレッドの性能情報から、プログラム全体の性能情報を計算し、スレッドの性能情報と合わせて出力する。   At the end of program execution, the performance information of the entire program is calculated from the performance information of each thread and is output together with the performance information of the thread.

また、本発明は、特許文献1に開示された技術のように、カーネルに用意するフラグや測定監視設定手段および実行時にカーネルのフラグの値による実行情報取得を制御する仕組み、動的リンカのテーブルー部クレームの書き換え操作に関する手段は必要ない利点がある。   In addition, as in the technique disclosed in Patent Document 1, the present invention provides a mechanism for controlling execution information acquisition based on a flag prepared in the kernel, measurement monitoring setting means, and the value of the kernel flag at the time of execution, a table of a dynamic linker There is an advantage that means relating to the rewriting operation of the part claims is not necessary.

本発明では、スレッドを用いたOpenMPなどのプログラムで、スレッド毎の性能情報を利用者に提供できること、および逐次実行とスレッドを用いた並列実行とで同じ関数インタフェースを採用することにより、ユーザがプログラム中に挿入したライブラリを並列実行でそのまま利用可能とすることができる。   In the present invention, a program such as OpenMP using threads can provide performance information for each thread to the user, and the same function interface is used for sequential execution and parallel execution using threads. The library inserted inside can be used as it is in parallel execution.

また、本発明は、特許文献2に開示された技術のように、スレッドの親子関係を記憶し、それを用いてデータを保持するメモリセルを決定することがなく、よって、データを複数のメモリセルに保存する必要もない利点がある。   In addition, unlike the technique disclosed in Patent Document 2, the present invention does not store a parent-child relationship of threads and uses it to determine a memory cell that holds data. There is an advantage that it is not necessary to store in a cell.

本発明では、逐次実行とスレッドによる並列実行とで同じライブラリインタフェースを用いることができる。   In the present invention, the same library interface can be used for sequential execution and parallel execution by threads.

すなわち、本発明の第一の観点は、OSまたはハードウェアが提供する機能を用いて実行するプログラムの性能情報を取得する手段を備えた性能情報取得装置であって、本発明の特徴とするところは、プログラム実行時に並列実行する複数のスレッドのIDを取得し、当該IDに対応する当該スレッドの実行時間情報を含む固有データへアクセスするためのポインタを管理する管理情報記録手段を備え、前記性能情報を取得する手段は、前記ポインタに基づき複数の前記スレッドにアクセスして前記実行時間情報を前記スレッド毎の性能情報としてそれぞれ取得する手段と、このそれぞれ取得する手段の取得結果を集計し、プログラム全体の性能情報と共に前記スレッド毎の性能情報をそれぞれ出力する手段とを備えたところにある。   In other words, a first aspect of the present invention is a performance information acquisition apparatus including means for acquiring performance information of a program executed using a function provided by an OS or hardware, and is a feature of the present invention. Includes a management information recording unit that acquires IDs of a plurality of threads that are executed in parallel at the time of program execution and manages a pointer for accessing unique data including execution time information of the threads corresponding to the IDs. The means for acquiring information includes means for accessing the plurality of threads based on the pointer and acquiring the execution time information as performance information for each thread, and totaling the acquisition results of the respective means for acquiring, And means for outputting the performance information for each thread together with the overall performance information.

本発明の第二の観点は、性能情報取得方法であって、本発明の特徴とするところは、性能情報取得対象となるプログラムをコンパイルする際に、並列実行指定のオプションの有無を検索するステップと、並列実行指定のオプションがあるときには、並列用のライブラリをリンクするオプションを追加するステップと、これらのステップにより得られたオプションを最終的なオプションとして生成してコンパイルおよびリンク処理を行うステップとを実行するところにある。   According to a second aspect of the present invention, there is provided a performance information acquisition method. The feature of the present invention is that a step of searching for the presence or absence of an option for parallel execution when compiling a program for which performance information is to be acquired When there is an option for parallel execution specification, there are a step for adding an option for linking a library for parallel execution, a step for generating an option obtained by these steps as a final option, and a step for compiling and linking. Is in place.

本発明の第三の観点は、情報処理装置にインストールすることにより、その情報処理装置に、OSまたはハードウェアが提供する機能を用いて実行するプログラムの性能情報を取得する機能を備えた性能情報取得装置に相応する機能を実現させる制御プログラムであって、本発明の特徴とするところは、プログラム実行時に並列実行する複数のスレッドのIDを取得し、当該IDに対応する当該スレッドの実行時間情報を含む固有データへアクセスするためのポインタを管理する管理情報記録機能を実現させ、前記性能情報を取得する機能として、前記ポインタに基づき複数の前記スレッドにアクセスして前記実行時間情報を前記スレッド毎の性能情報としてそれぞれ取得する機能と、このそれぞれ取得する機能の取得結果を集計し、プログラム全体の性能情報と共に前記スレッド毎の性能情報をそれぞれ出力する機能とを実現させるところにある。   A third aspect of the present invention is a performance information having a function of acquiring performance information of a program to be executed using a function provided by an OS or hardware by installing the information processing apparatus in the information processing apparatus. A control program for realizing a function corresponding to an acquisition device, which is characterized by acquiring IDs of a plurality of threads that are executed in parallel during program execution, and executing time information of the threads corresponding to the IDs The management information recording function for managing the pointer for accessing the unique data including the information is realized, and as the function for acquiring the performance information, the plurality of threads are accessed based on the pointer, and the execution time information is obtained for each thread. The functions that are acquired as performance information and the acquisition results of the functions that are acquired It is with beam overall performance information performance information for each of the threads at realizing the function of outputting, respectively.

本発明の制御プログラムは本発明の記録媒体に記録されることにより、前記情報処理装置は、この記録媒体を用いて本発明の制御プログラムをインストールすることができる。あるいは、本発明の制御プログラムを保持するサーバからネットワークを介して直接前記情報処理装置に本発明の制御プログラムをインストールすることもできる。   By recording the control program of the present invention on the recording medium of the present invention, the information processing apparatus can install the control program of the present invention using this recording medium. Alternatively, the control program of the present invention can be directly installed in the information processing apparatus via a network from a server holding the control program of the present invention.

これにより、汎用の情報処理装置を用いて、スレッドを用いたOpenMPなどの並列実行におけるプログラムの性能情報をスレッド単位に得ることができ、また、スレッド並列実行でも同じインタフェースで性能情報を得ることができる性能情報取得装置を実現することができる。   As a result, it is possible to obtain program performance information in parallel execution such as OpenMP using threads by using a general-purpose information processing apparatus, and also obtain performance information with the same interface in thread parallel execution. A performance information acquisition device that can be used can be realized.

第一の効果は、スレッドを用いたOpenMPなどの並列実行におけるプログラムの性能情報をスレッド単位に得ることができることにある。その理由は、ライブラリがスレッドを考慮した処理を行うためである。   The first effect is that the performance information of a program in parallel execution such as OpenMP using threads can be obtained for each thread. The reason is that the library performs processing in consideration of threads.

第二の効果は、スレッド並列実行でも同じインタフェースで性能情報を得ることが可能であることにある。その理由は、並列実行を指定されたときにコンパイラがリンクするライブラリを切り替えることで、同じインタフェースで並列実行に対応したライブラリをリンクしているためである。   The second effect is that it is possible to obtain performance information with the same interface even in thread parallel execution. The reason is that the library corresponding to the parallel execution is linked with the same interface by switching the library linked by the compiler when the parallel execution is designated.

本発明実施例の性能情報取得装置の構成を図1を参照して説明する。図1は本実施例の性能情報取得装置のブロック構成図である。   The configuration of the performance information acquisition apparatus according to the embodiment of the present invention will be described with reference to FIG. FIG. 1 is a block diagram of a performance information acquisition apparatus according to the present embodiment.

本実施例は、図1に示すように、OSまたはハードウェアが提供する機能を用いて実行するプログラムの性能情報を取得する性能情報取得部1を備えた性能情報取得装置であって、本実施例の特徴とするところは、プログラム実行時に並列実行する複数のスレッドのIDを取得し、当該IDに対応する当該スレッドの実行時間情報を含む固有データへアクセスするためのポインタを管理する記憶部3を備え、性能情報取得部1は、前記ポインタに基づき複数の前記スレッドにアクセスして前記実行時間情報を前記スレッド毎の性能情報としてそれぞれ取得する手段と、このそれぞれ取得する手段の取得結果を集計し、プログラム全体の性能情報と共に前記スレッド毎の性能情報をそれぞれ出力する手段とを備えたところにある。   As shown in FIG. 1, the present embodiment is a performance information acquisition apparatus including a performance information acquisition unit 1 that acquires performance information of a program executed using a function provided by an OS or hardware. The feature of the example is that a storage unit 3 that acquires IDs of a plurality of threads that are executed in parallel during program execution and manages a pointer for accessing specific data including execution time information of the threads corresponding to the IDs The performance information acquisition unit 1 accesses a plurality of threads based on the pointer and acquires the execution time information as performance information for each thread, and totals the acquisition results of the acquisition means. And means for outputting performance information for each thread together with performance information for the entire program.

本発明実施例の性能情報取得方法を図3を参照して説明する。図3は本実施例のオプション生成の手順を示すフローチャートである。   A performance information acquisition method according to an embodiment of the present invention will be described with reference to FIG. FIG. 3 is a flowchart showing an option generation procedure of this embodiment.

本実施例は、図3に示すように、性能情報取得対象となるプログラムをコンパイルする際に、並列実行指定のオプションの有無を検索するステップ(A1)と、並列実行指定のオプションがあるときには、並列用のライブラリをリンクするオプションを追加するステップ(A4)と、これらのステップにより得られたオプションを最終的なオプションとして生成してコンパイルおよびリンク処理を行うステップ(A6)とを実行することを特徴とする。   In this embodiment, as shown in FIG. 3, when compiling a program for which performance information is to be acquired, a step (A1) for searching for the presence or absence of a parallel execution designation option and a parallel execution designation option are present. Executing the step (A4) of adding an option for linking a library for parallel use, and the step (A6) of generating an option obtained by these steps as a final option and performing a compile and link process. Features.

本発明は、汎用の情報処理装置にインストールすることにより、その情報処理装置に本発明の性能情報取得装置に相応する機能を実現させる制御プログラムとして実現することができる。この制御プログラムは、記録媒体に記録されて情報処理装置にインストールされ、あるいは通信回線を介して情報処理装置にインストールされることにより当該情報処理装置に、性能情報取得部1、処理部2、記憶部3にそれぞれ相応する機能を実現させることができる。   The present invention can be implemented as a control program that, when installed in a general-purpose information processing apparatus, causes the information processing apparatus to realize a function corresponding to the performance information acquisition apparatus of the present invention. The control program is recorded in a recording medium and installed in the information processing apparatus, or installed in the information processing apparatus via a communication line, so that the information processing apparatus has the performance information acquisition unit 1, the processing unit 2, and the storage Functions corresponding to the respective units 3 can be realized.

以下では、本実施例をさらに詳細に説明する。   Hereinafter, this embodiment will be described in more detail.

(実施例の構成)
図1を参照すると、本実施例の性能情報取得装置は、性能情報取得部1、処理部2、記憶部3を含む。性能情報取得部1は、OSやハードウェアが提供する機能を用いて実行しているプログラムの性能情報を取得する。処理部2は、実行時にスレッドIDを取得し、それとライブラリ呼び出しの引数および記憶部3に含まれる管理情報31を用いて、性能情報32および管理情報31の更新を行う。記憶部3は、管理情報31と性能情報32とを含む。
(Configuration of Example)
Referring to FIG. 1, the performance information acquisition apparatus according to the present exemplary embodiment includes a performance information acquisition unit 1, a processing unit 2, and a storage unit 3. The performance information acquisition unit 1 acquires performance information of a program being executed using functions provided by the OS and hardware. The processing unit 2 acquires the thread ID at the time of execution, and updates the performance information 32 and the management information 31 using the argument of the library call and the management information 31 included in the storage unit 3. The storage unit 3 includes management information 31 and performance information 32.

管理情報31は、各スレッドで実行している関数やスレッドの性能情報へアクセスするためのポインタなどの対応を管理する情報を保持する。管理情報31と性能情報32は、図2に示すようにスレッドに共通のデータ11と各スレッドの性能情報32とを含む。   The management information 31 holds information for managing correspondence such as a function executed in each thread and a pointer for accessing the performance information of the thread. The management information 31 and performance information 32 include data 11 common to threads and performance information 32 of each thread, as shown in FIG.

(実施例の動作)
次に、図1〜図5を参照して本発明の実施例の動作について詳細に説明する。
(Operation of the embodiment)
Next, the operation of the embodiment of the present invention will be described in detail with reference to FIGS.

性能情報を取得したいプログラムがある場合に、最初にそのプログラムを、通常の処理と同様にコンパイルする(図5のステップF1)。このときにオプションとして、性能情報を参照するためのコンパイルオプションを指定することで、従来と同様にコンパイラによるライブラリ呼び出しの挿入処理やライブラリのリンクが行われる。これで生成された実行オブジェクトを計算機上で実行(ステップF2)することで、求める性能情報を得ることができる(ステップF3)。   When there is a program for which performance information is to be acquired, the program is first compiled in the same manner as normal processing (step F1 in FIG. 5). At this time, by specifying a compile option for referring to performance information as an option, the library call insertion processing and library linking are performed by the compiler as in the past. The performance information to be obtained can be obtained (step F3) by executing the generated execution object on the computer (step F2).

ここで、最初にコンパイルをする際に、本手法は図3に示す手順により並列実行オプションの指定の有無でリンクするライブラリを切り替えている。その手順は、まず指定されたオプションを検索する(図3のステップA1)。そして、そこに性能情報を取得する機能を有効にするオプションの有無をチェックする(ステップA2)。この指定がなければ、指定されたままのオプションを出力とする(ステップA6)。性能情報取得の指定がある場合には、さらに並列実行のオプションの有無を調べる(ステップA3)。並列実行の指定がある場合には、並列用のライブラリをリンクするオプションを追加して(ステップA4)、指定がなければ従来の逐次用ライブラリをリンクするオプションを追加する(ステップA5)。以上の処理で得られたオプションを最終的なオプションとして生成し(ステップA6)、コンパイルおよびリンク処理を行う。   Here, when compiling for the first time, according to the procedure shown in FIG. 3, the method switches the library to be linked depending on whether or not the parallel execution option is specified. In the procedure, first, the designated option is searched (step A1 in FIG. 3). And the presence or absence of the option which validates the function which acquires performance information there is checked (step A2). If this is not specified, the specified option is output (step A6). If performance information acquisition is specified, the presence of parallel execution options is further checked (step A3). If parallel execution is specified, an option for linking a parallel library is added (step A4), and if not specified, an option for linking a conventional sequential library is added (step A5). The options obtained by the above processing are generated as final options (step A6), and compile and link processing is performed.

性能情報を取得するオプションが指定された場合には、コンパイラでは本来の手続きの処理(図4のB2)の前後に性能情報を取得するためのライブラリ呼び出し(B1とB3)を挿入して、新たな手続き(B4)として実行オブジェクトを生成する。   When an option for acquiring performance information is specified, the compiler inserts library calls (B1 and B3) for acquiring performance information before and after the processing of the original procedure (B2 in FIG. 4) As a procedure (B4), an execution object is generated.

生成された実行オブジェクトの実行では、コンパイラにより挿入されたライブラリ呼び出し、またはユーザが指定したライブラリ呼び出しにより性能情報が取得される。コンパイラにより挿入されたライブラリ呼び出しは、その呼び出しを含む関数名が引数となっており、これを識別子として性能情報が記録される。性能情報を記録する機能は、図1に示す性能情報取得部1、処理部2、および記憶部3で構成される。さらに記憶部3には、管理情報31と性能情報32とが含まれる。   In executing the generated execution object, performance information is acquired by a library call inserted by the compiler or a library call specified by the user. The library call inserted by the compiler has a function name including the call as an argument, and performance information is recorded using this as an identifier. The function for recording the performance information includes the performance information acquisition unit 1, the processing unit 2, and the storage unit 3 shown in FIG. Further, the storage unit 3 includes management information 31 and performance information 32.

この機能は、関数のはじめに呼ばれた場合は以下のように動作する。ライブラリが呼び出されると、処理部2はまず最初に性能情報取得部1から性能情報を取得して記録しておき、ライブラリを呼び出したスレッドIDを調べる。ここで、メイン関数などライブラリがそのスレッドで最初に呼び出された場合には、関連データの初期化処理を行う。それ以外の場合には、スレッドIDと管理情報31から、引数で渡された関数を呼び出す前に実行していた関数を調べる。この情報は、スレッド固有データ12に記録されている。そして、最初に記録した性能情報とこの関数を呼び出した関数およびスレッドIDから、そのスレッドにおける関数の性能情報を計算して更新する。その後、管理情報31にあるスレッドが現在処理している関数に関する情報を、ライブラリの引数で渡された関数名で更新する。この更新はスタックのプッシュ操作で行う。最後に、ライブラリにおける処理時間をプログラムの実行時間に含めないため、再び性能情報を取得し、現在の関数の実行開始情報として記録する。   This function works as follows when called at the beginning of a function. When the library is called, the processing unit 2 first acquires and records performance information from the performance information acquisition unit 1, and checks the thread ID that called the library. Here, when a library such as a main function is called for the first time in the thread, initialization processing of related data is performed. In other cases, the function executed before calling the function passed by the argument is checked from the thread ID and the management information 31. This information is recorded in the thread specific data 12. Then, the performance information of the function in the thread is calculated and updated from the performance information recorded first, the function that called this function, and the thread ID. Thereafter, the information on the function currently processed by the thread in the management information 31 is updated with the function name passed as an argument of the library. This update is performed by pushing the stack. Finally, since the processing time in the library is not included in the execution time of the program, the performance information is acquired again and recorded as the execution start information of the current function.

関数の終りで呼ばれた場合には、以下のような動作となる。ライブラリが呼び出されると、開始時点での処理と同様に性能情報やスレッドIDを取得する。そして、管理情報31に記録されている性能情報とライブラリ呼び出しの最初に記録した性能情報とから、新たな性能情報を計算して更新する。その後、現在の処理している関数を呼び出した関数に戻すため、スタックのポップ操作を行う。その結果、現在の関数を呼び出した関数が現在処理している関数となるので、それに対して再び取得した性能情報を実行開始情報として記録する。   When called at the end of a function, it behaves as follows: When the library is called, the performance information and thread ID are acquired in the same manner as the process at the start time. Then, new performance information is calculated and updated from the performance information recorded in the management information 31 and the performance information recorded at the beginning of the library call. After that, a stack pop operation is performed to return the function currently being processed to the function that called it. As a result, the function that called the current function becomes the function currently being processed, and the performance information acquired again is recorded as execution start information.

以上の手順で記録された各スレッドの性能情報は、プログラム実行終了時に呼び出すように登録されたライブラリ呼び出しで、プログラム全体の性能情報を計算する際に利用される。各スレッドの性能情報は、スレッドの共通データ領域11から全て参照することができるため、プログラム実行終了時に全てをアクセスすることが可能である。そして、この計算終了後、プログラム全体の性能情報と各スレッドの性能情報とを出力する。   The performance information of each thread recorded in the above procedure is used when calculating the performance information of the entire program by the library call registered to be called at the end of program execution. Since all the performance information of each thread can be referred to from the common data area 11 of the thread, it is possible to access all at the end of program execution. After the calculation, the performance information of the entire program and the performance information of each thread are output.

次に、本発明の実施例の効果について説明する。   Next, effects of the embodiment of the present invention will be described.

本発明の実施例で説明したとおり、性能情報を取得し、記録管理する部分がスレッドを考慮しているため、各スレッドの性能情報を記録し、それをプログラム実行後に表示することが可能になっている。また、コンパイラがオプションによってリンクするライブラリを切り替えるため、ライブラリのインタフェースは、並列実行に対応したものも従来と同じである。これによって、ユーザは明示的にプログラム中にライブラリ呼び出しを挿入して性能情報を得る場合でも、逐次実行と並列実行とで修正する必要がなくなる。さらに、コンパイラのオプションも新たなものは追加されておらず、この点でも修正は必要ない。   As described in the embodiment of the present invention, the performance information acquisition and recording management part considers threads, so it is possible to record the performance information of each thread and display it after program execution. ing. Further, since the compiler switches the library to be linked depending on the option, the library interface corresponding to the parallel execution is the same as the conventional one. Thus, even when the user explicitly inserts a library call into the program to obtain performance information, the user does not need to make corrections between sequential execution and parallel execution. In addition, no new compiler options have been added, and no modification is necessary in this respect.

本発明は、コンパイラのオプション指定のみで利用できるprofと同様の利用インタフェースでありながら並列処理に対応したテキストレベルで利用可能であることから、プログラムの研究開発に広く利用することができる。   The present invention can be widely used for research and development of programs because it can be used at a text level corresponding to parallel processing while using the same interface as prof that can be used only by specifying options of the compiler.

本実施例の性能情報取得装置のブロック構成図。The block block diagram of the performance information acquisition apparatus of a present Example. 本実施例の共通データ領域とスレッド固有データとの関係を示す図。The figure which shows the relationship between the common data area | region and thread specific data of a present Example. 本実施例のオプション生成の手順を示すフローチャート。The flowchart which shows the procedure of the option production | generation of a present Example. 本実施例の手続きの性能情報記録開始処理および記録終了処理の手順を示すフローチャート。The flowchart which shows the procedure of the performance information recording start process of a procedure of a present Example, and a recording end process. 本実施例のコンパイルの手順を示すフローチャート。The flowchart which shows the procedure of the compilation of a present Example.

符号の説明Explanation of symbols

1 性能情報取得部
2 処理部
3 記憶部
11 共通データ領域
12 スレッド固有データ
31 管理情報
32 性能情報
A1〜A6、B1〜B4、F1〜F3 ステップ
DESCRIPTION OF SYMBOLS 1 Performance information acquisition part 2 Processing part 3 Storage part 11 Common data area 12 Thread specific data 31 Management information 32 Performance information A1-A6, B1-B4, F1-F3 Step

Claims (3)

OSまたはハードウェアが提供する機能を用いて実行するプログラムの性能情報を取得する手段を備えた性能情報取得装置において、
プログラム実行時に並列実行する複数のスレッドの識別情報を取得し、当該識別情報に対応する当該スレッドの実行時間情報を含む固有データへアクセスするためのポインタを管理する管理情報記録手段を備え、
前記性能情報を取得する手段は、
前記ポインタに基づき複数の前記スレッドにアクセスして前記実行時間情報を前記スレッド毎の性能情報としてそれぞれ取得する手段と、
このそれぞれ取得する手段の取得結果を集計し、プログラム全体の性能情報と共に前記スレッド毎の性能情報をそれぞれ出力する手段と
を備えたことを特徴とする性能情報取得装置。
In a performance information acquisition device comprising means for acquiring performance information of a program executed using a function provided by an OS or hardware,
Management information recording means for acquiring identification information of a plurality of threads executed in parallel at the time of program execution and managing a pointer for accessing specific data including execution time information of the thread corresponding to the identification information,
The means for acquiring the performance information includes:
Means for accessing the plurality of threads based on the pointer and obtaining the execution time information as performance information for each thread;
A performance information acquisition apparatus comprising: means for totalizing the acquisition results of the respective acquisition means and outputting performance information for each thread together with performance information of the entire program.
性能情報取得対象となるプログラムをコンパイルする際に、
並列実行指定のオプションの有無を検索するステップと、
並列実行指定のオプションがあるときには、並列用のライブラリをリンクするオプションを追加するステップと、
これらのステップにより得られたオプションを最終的なオプションとして生成してコンパイルおよびリンク処理を行うステップと
を実行することを特徴とするプログラムの性能情報取得方法。
When compiling a program for performance information acquisition,
A step of searching for the presence or absence of an option for specifying parallel execution;
When there is an option to specify parallel execution, adding an option to link the library for parallel execution,
A method for generating performance information of a program, comprising: generating an option obtained by these steps as a final option and performing compiling and linking processing.
情報処理装置にインストールすることにより、その情報処理装置に、
OSまたはハードウェアが提供する機能を用いて実行するプログラムの性能情報を取得する機能を備えた性能情報取得装置に相応する機能を実現させる制御プログラムにおいて、
プログラム実行時に並列実行する複数のスレッドの識別情報を取得し、当該識別情報に対応する当該スレッドの実行時間情報を含む固有データへアクセスするためのポインタを管理する管理情報記録機能を実現させ、
前記性能情報を取得する機能として、
前記ポインタに基づき複数の前記スレッドにアクセスして前記実行時間情報を前記スレッド毎の性能情報としてそれぞれ取得する機能と、
このそれぞれ取得する機能の取得結果を集計し、プログラム全体の性能情報と共に前記スレッド毎の性能情報をそれぞれ出力する機能と
を実現させることを特徴とする制御プログラム。
By installing on an information processing device,
In a control program for realizing a function corresponding to a performance information acquisition apparatus having a function of acquiring performance information of a program executed using a function provided by an OS or hardware,
Acquiring identification information of a plurality of threads executed in parallel at the time of program execution, realizing a management information recording function for managing a pointer for accessing specific data including execution time information of the thread corresponding to the identification information,
As a function of acquiring the performance information,
A function of accessing the plurality of threads based on the pointer and acquiring the execution time information as performance information for each thread;
A control program that aggregates the acquisition results of the respective acquired functions and outputs the performance information for each thread together with the performance information of the entire program.
JP2004054513A 2004-02-27 2004-02-27 Performance information acquiring device and method, and control program Pending JP2005242879A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004054513A JP2005242879A (en) 2004-02-27 2004-02-27 Performance information acquiring device and method, and control program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004054513A JP2005242879A (en) 2004-02-27 2004-02-27 Performance information acquiring device and method, and control program

Publications (1)

Publication Number Publication Date
JP2005242879A true JP2005242879A (en) 2005-09-08

Family

ID=35024530

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004054513A Pending JP2005242879A (en) 2004-02-27 2004-02-27 Performance information acquiring device and method, and control program

Country Status (1)

Country Link
JP (1) JP2005242879A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009093310A (en) * 2007-10-05 2009-04-30 Hitachi Ltd Apparatus and method for creating execution code and method of managing source code

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009093310A (en) * 2007-10-05 2009-04-30 Hitachi Ltd Apparatus and method for creating execution code and method of managing source code

Similar Documents

Publication Publication Date Title
US7516442B2 (en) Resource manifest
US5761510A (en) Method for error identification in a program interface
US7992141B2 (en) Method and apparatus for building executable computer programs using compiled program libraries
US5956479A (en) Demand based generation of symbolic information
WO2018072493A1 (en) Compiling method and compiling system
KR101795844B1 (en) Runtime system
US9471282B2 (en) System and method for using annotations to automatically generate a framework for a custom javaserver faces (JSF) component
US7305376B2 (en) Multiple language-dependent resources compacted into a single resource file
US7162502B2 (en) Systems and methods that synchronize data with representations of the data
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
US20090260000A1 (en) Method, apparatus, and manufacture for software difference comparison
JP2003050715A (en) Compiler and debugging device
US8561032B2 (en) Visualizing thread life time in eclipse
US7966600B2 (en) Distributed resource understanding tool management
US20090249021A1 (en) Method And Systems For Invoking An Advice Operation Associated With A Joinpoint
JP2009176064A (en) Software refactoring support device and method
JP2018156133A (en) Compiler program, information processing apparatus and compilation method
TW201324347A (en) System and method for managing commands of function module
CN111488144A (en) Data processing method and equipment
JP5377522B2 (en) Efficiently correlate nominally incompatible types
Ruprecht et al. Automatic feature selection in large-scale system-software product lines
US7389515B1 (en) Application deflation system and method
KR20190060561A (en) THE INTERGRATED IoT PROGRAMMING METHOD AND SYSTEM WITH SELECTIVE ABSTRACTION OF THIRD-PARTY DEVICES
JP2005242879A (en) Performance information acquiring device and method, and control program
US9720660B2 (en) Binary interface instrumentation

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20071225

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20080214

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080226

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20080312

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20080708