Oracle® Solaris Studio 12.4: Performance Analyzer

Exit Print View

Updated: January 2015

er_print Command Examples

This section provides some examples for using the er_print command.

Example 5-8  Show Summary of How Time Is Spent in Functions
er_print -functions
Example 5-9  Show Caller-Callee Relationships
er_print -callers-callees
Example 5-10  Show Which Source Lines Are Hot

Source-line information assumes the code was compiled and linked with -g. Append a trailing underscore to the function name for Fortran functions and routines. The 1 after the function name is used to distinguish between multiple instances of myfunction.

er_print -source  myfunction 1
Example 5-11  Filter Functions Named myfunc From the User Function Stack:
er_print -filters 'FNAME("myfunc") SOME IN USTACK' -functions
Example 5-12  Generate Output Similar to gprof

The following example generates a gprof-like list from an experiment. The output is a file named er_print.out which lists the top 100 functions, followed by caller-callee data sorted by attributed user time for each.

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

You can also simplify this example into the following independent commands. However, keep in mind that each call to er_print in a large experiment or application can be time intensive.

er_print -metrics  e.%user -limit 100  -functions
er_print -metrics  e.%user -callers-callees
Example 5-13  Show Only the Compiler Commentary

You do not have to run your program in order to use this command.

er_src -myfile.o
Example 5-14  Use Wall-Clock Profiling to List Functions and Callers-Callees
er_print -metrics  ei.%wall -functions
er_print -metrics aei.%wall  -callers-callees
Example 5-15  Run a Script Containing er_print Commands
er_print -script myscriptfile

The myscriptfile script contains er_print commands. A sample of the script file contents follows:

## myscriptfile

## Send script output to standard output
outfile -

## Display descriptive information about the experiments

## Write out the sample data for all experiments

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

## List functions

## Display status and names of available load objects

## 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