4 gprofng Command Reference

This table provides information about the gprofng command.

Action Command Description
Collect performance data. gprofng collect app

Collects performance data about a running application and stores it in the experiment directory.

Review performance results in a terminal. gprofng display text

Displays performance data from the specified experiment directories in ASCII plain-text format.

Review performance data in a web browser. gprofng display html

Generates a HTML structure from the specified experiment directories.

Review the source and disassembly code. gprofng display src

Displays the source code interleaved with instructions.

Archive an experiment directory. gprofng archive

Copies shared libraries, object files, and source code to the experiment directory for later analysis.

Open a graphical user interface for collecting and reviewing performance data. gprofng display gui

If the gprofng-gui package is installed, starts a graphical user interface for collecting performance data and displaying experiments.

Collecting Performance Data

Use the gprofng collect app command to configure experiments and collect performance data.

When collecting performance data, it's possible to specify the experiment directory by using the -O option:

gprofng collect app -O experiment-directory-name.er /path/to/application -options

Note that .er is a required suffix for any experiment directory name.

For more information about collecting performance data, see Getting Started With gprofng.

Analyzing Performance Metrics

Use the gprofng display text command to review a range of performance data that has been collected in an experiment.

To analyze performance data collected for each function, use the -functions option with the gprofng display text command:

gprofng display text -functions experiment-directory-name.er 
Functions sorted by metric: Exclusive Total CPU Time

Excl. Total   Incl. Total    Name
CPU           CPU
 sec.      %   sec.      %
5.554 100.00  5.554 100.00   <Total>
5.274  94.95  5.274  94.95   mxv_core
0.140   2.52  0.270   4.86   init_data
0.090   1.62  0.110   1.98   erand48_r
0.020   0.36  0.020   0.36   __drand48_iterate
0.020   0.36  0.130   2.34   drand48
0.010   0.18  0.010   0.18   _int_malloc
0.      0.    0.280   5.05   __libc_start_main
0.      0.    0.010   0.18   allocate_data
0.      0.    5.274  94.95   collector_root
0.      0.    5.274  94.95   driver_mxv
0.      0.    0.280   5.05   main
0.      0.    0.010   0.18   malloc
0.      0.    5.274  94.95   start_thread

To limit the number of functions displayed, use the -limit option as follows:

gprofng display text -limit 5 -functions experiment-directory-name.er 
Print limit set to 5
Functions sorted by metric: Exclusive Total CPU Time

Excl. Total   Incl. Total    Name
CPU           CPU
 sec.      %   sec.      %
5.775 100.00  5.775 100.00   <Total>
5.494  95.15  5.494  95.15   mxv_core
0.126   2.18  0.267   4.63   init_data
0.068   1.17  0.104   1.80   erand48_r
0.038   0.66  0.142   2.45   drand48

To list all the metrics that have been collected in an experiment directory, use the -metric_list option without any other options:

gprofng display text -metric_list experiment-directory-name.er
Current metrics: e.%totalcpu:i.%totalcpu:name
Current Sort Metric: Exclusive Total CPU Time ( e.%totalcpu )
Available metrics:
Exclusive Total CPU Time: e.%totalcpu
Inclusive Total CPU Time: i.%totalcpu
                    Size: size
              PC Address: address
                    Name: name

After you have established which metrics have been collected in an experiment directory, select the displayed metrics by using the -metrics options, separating each with a : character:

gprofng display text -metrics name:i.%totalcpu:e.%totalcpu -limit 10 -functions experiment-directory-name.er 
Current metrics: name:i.%totalcpu:e.%totalcpu
Current Sort Metric: Exclusive Total CPU Time ( e.%totalcpu )
Print limit set to 10
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.

To sort the performance data according to a specific metric, for example name, add the -sort option:

gprofng display text -metrics name:i.%totalcpu:e.%totalcpu -sort name -limit 10 -functions experiment-directory-name.er 
Current metrics: name:i.%totalcpu:e.%totalcpu
Current Sort Metric: Exclusive Total CPU Time ( e.%totalcpu )
Current Sort Metric: Name ( name )
Print limit set to 10
Functions sorted by metric: Name

Name                Incl. Total   Excl. Total
                    CPU           CPU
                     sec.      %   sec.      %
 <Total>            5.775 100.00  5.775 100.00
 __default_morecore 0.002   0.03  0.      0.
 __drand48_iterate  0.036   0.62  0.036   0.62
 __libc_start_main  0.280   4.85  0.      0.
 _int_malloc        0.013   0.22  0.008   0.14
 allocate_data      0.013   0.22  0.      0.
 brk                0.002   0.03  0.002   0.03
 collector_root     5.494  95.15  0.      0.
 drand48            0.142   2.45  0.038   0.66
 driver_mxv         5.494  95.15  0.      0.

Use the -disasm option and specify the function name to review metrics at an instruction or assembly level:

gprofng display text -metrics e.totalcpu -disasm function-name experiment-directory-name.er

For more information, see https://sourceware.org/binutils/wiki/gprofng and the gprofng(1) manual page.

Working With gprofng-gui

Use the gprofng display gui command to open a GUI front-end for the gprofng command, if the gprofng-gui package is installed.

To review an experiment containing performance data in a graphical user interface, use the gprofng display gui command, which is provided by the gprofng-gui package:

gprofng display gui experiment1.er

If more than one experiment is specified, they're aggregated together.

To compare two experiments containing performance data in a graphical user interface, use the -c option:

gprofng display gui -c experiment1.er experiment2.er

For more information about working with the gprofng-gui tool, see Using the Gprofng GUI.