Oracle® Solaris Studio 12.4: パフォーマンスアナライザ

印刷ビューの終了

更新: 2015 年 1 月
 
 

er_print コマンドの例

ここでは、er_print コマンドの使用例を示します。

使用例 5-8  関数にかかる時間のサマリーを表示
er_print -functions test.1.er
使用例 5-9  呼び出し元-呼び出し先関係を表示
er_print -callers-callees test.1.er
使用例 5-10  ホットなソース行を表示

ソース行情報は、コードのコンパイルとリンクで -g が指定されていることを前提にしています。Fortran の関数とルーチンの場合は、関数名の最後に下線を付けてください。関数名のあとの 1 は、myfunction の複数インスタンスを区別するためのものです。

er_print -source  myfunction 1 test.1.er
使用例 5-11  ユーザー関数スタックから myfunc という名前の関数をフィルタリング
er_print -filters 'FNAME("myfunc") SOME IN USTACK' -functions test.1.er
使用例 5-12  gprof に似た出力を生成

次の例は、実験から gprof 形式に似た一覧を生成します。出力は er_print.out というファイルで、先頭の 100 個の関数と、関数ごとの属性ユーザー時間でソートされた呼び出し元-呼び出し先データの一覧です。

er_print -outfile  er_print.out -metrics e.%user -sort e.user \
-limit 100 -func -callers-callees test.1.er

この例のコマンドを分解して、次の独立した 2 つのコマンドにすることもできます。ただし、大規模な実験またはアプリケーションでは、er_print の呼び出しのたびに、かなりの時間がかかることがありますので注意してください。

er_print -metrics  e.%user -limit 100  -functions test.1.er
er_print -metrics  e.%user -callers-callees test.1.er
使用例 5-13  コンパイラ解説のみを表示

このコマンドを使用するためにプログラムを実行する必要はありません。

er_src -myfile.o
使用例 5-14  時計時間プロファイリングを使用して、関数および呼び出し元-呼び出し先を一覧表示
er_print -metrics  ei.%wall -functions test.1.er
er_print -metrics aei.%wall  -callers-callees test.1.er
使用例 5-15  er_print コマンドを含むスクリプトを実行
er_print -script myscriptfile test.1.er

myscriptfile スクリプトに er_print コマンドが含まれます。スクリプトファイルの例を次に示します。

## myscriptfile

## Send script output to standard output
outfile -

## Display descriptive information about the experiments
header

## Write out the sample data for all experiments
overview

## Write out execution statistics, aggregated over 
## the current sample set for all experiments
statistics

## List functions
functions

## Display status and names of available load objects
object_list


## Write out annotated disassembly code for systime, 
## to file disasm.out
outfile disasm.out
disasm systime


## Write out annotated source code for synprog.c 
## to file source.out
outfile source.out
source synprog.c

## Terminate processing of the script
quit