5 Storing gprofng Options for Reuse

Use Scripts to save gprofng display options.

There can be many ways to customize the output of the gprofng display text command, and the -script option has been provided so that you can supply a text file containing options for use with other experiment directories. That can be a more straightforward way to reproduce performance views.

For example, to get a table with the inclusive and exclusive total CPU times with percentages, limited to the first 10 lines, create a script with the following content:

# Command to define the metrics
metrics name:i.%totalcpu:e.%totalcpu
# Limit the views to 10 lines
limit 10
# Display the function overview
functions

Note that each option has its own line in the script and no leading dash - character.

That script can then be used with the gprofng display text command as follows:

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.