5. gprof-compatible output (opgprof)

If you're familiar with the output produced by GNU gprof, you may find opgprof useful. It takes a single binary as an argument, and produces a gmon.out file for use with gprof -p. If call-graph profiling is enabled, then this is also included.

$ opgprof `which oprofiled` # generates gmon.out file
$ gprof -p `which oprofiled` | head
Flat profile:

Each sample counts as 1 samples.
  %   cumulative   self              self     total
 time   samples   samples    calls  T1/call  T1/call  name
 33.13 206237.00 206237.00                             odb_insert
 22.67 347386.00 141149.00                             pop_buffer_value
  9.56 406881.00 59495.00                             opd_put_sample
  7.34 452599.00 45718.00                             opd_find_image
  7.19 497327.00 44728.00                             opd_process_samples

5.1. Usage of opgprof

--help / -? / --usage

Show help message.

--image-path / -p [paths]

Comma-separated list of additional paths to search for binaries. This is needed to find kernel modules.

--root / -R [path]

A path to a filesystem to search for additional binaries.

--output-filename / -o [file]

Output to the given file instead of the default, gmon.out

--threshold / -t [percentage]

Only output data for symbols that have more than the given percentage of total samples.

--verbose / -V [options]

Give verbose debugging output.

--session-dir=dir_path

Use sample database from the specified directory dir_path instead of the default location. If this option is not specified, then opgprof will search for samples in <cur_dir>/oprofile_data first. If that directory does not exist, the standard session-dir of /var/lib/oprofile is used as the session directory.

--version / -v

Show version.