5 再利用のためのgprofng
オプションの格納
スクリプトを使用して、gprofng display
オプションを保存します。
gprofng display text
コマンドの出力をカスタマイズするには多くの方法があり、他の実験ディレクトリで使用するためのオプションを含むテキスト・ファイルを指定できるように、-script
オプションが提供されています。それは、パフォーマンス・ビューを再現するためのより簡単な方法です。
たとえば、パーセント表示を含む包括的および排他的CPU合計時間の表を最初の10行に制限して取得するには、次の内容のスクリプトを作成します:
# Command to define the metrics
metrics name:i.%totalcpu:e.%totalcpu
# Limit the views to 10 lines
limit 10
# Display the function overview
functions
各オプションはスクリプト内で個別の行で指定され、先頭のダッシュ-
文字がないことに注意してください。
そのスクリプトは、次のようにgprofng display text
コマンドで使用できます:
gprofng display text -script script-name experiment-directory-name.er
# Command to define the metrics
Current metrics: name:i.%totalcpu:e.%totalcpu
Current Sort Metric: Exclusive Total CPU Time ( e.%totalcpu )
# Limit the views to 10 lines
Print limit set to 10
# Display the function overview
Functions sorted by metric: Exclusive Total CPU Time
Name Incl. Total Excl. Total
CPU CPU
sec. % sec. %
<Total> 5.775 100.00 5.775 100.00
mxv_core 5.494 95.15 5.494 95.15
init_data 0.267 4.63 0.126 2.18
erand48_r 0.104 1.80 0.068 1.17
drand48 0.142 2.45 0.038 0.66
__drand48_iterate 0.036 0.62 0.036 0.62
_int_malloc 0.013 0.22 0.008 0.14
sysmalloc 0.005 0.09 0.003 0.05
brk 0.002 0.03 0.002 0.03
__default_morecore 0.002 0.03 0. 0.