HP Caliper 5.3 User Guide (5900-1558, February 2011)

10 Producing a Sampled Call Graph Profile Analysis
HP Caliper can produce a sampled call graph profile report (using the scgprof measurement)
from any compiled program. You do not need to compile your program in any special way to use
this feature.
The call graph is produced by sampling the processor's performance monitoring unit (PMU) to
determine function calls. The call graph is not exact, because it does not show every function call,
but it is statistically useful.
This chapter provides an overview. For details about the sampled call graph profile report, see
scgprof Measurement Report Description” (p. 211).
HP Caliper can also produce an exact call graph, using the cgprof measurement, which instruments
the application code. The cgprof measurement runs on HP-UX only. For details about cgprof,
see cgprof Report Description (p. 175). Also see “Differences Between scgprof and cgprof”
(p. 120).
NOTE: Using the scgprof measurement on HP-UX 11.23 (v2) requires kernel patch PHKL_34020.
How Sampled Call Graph Profile Analysis Works
The HP Caliper sampled call graph profile analysis produces a gprof-like report. It includes these
results:
Total execution times for each function in the program
Call counts for each function in the program
Cycle information, member functions, time and call counts
Most likely hot call paths in the program
Because the calls are discovered by sampling the PMU, it cannot show every function call performed
by a process. (This is similar to how the dcache measurement works. It finds data cache misses by
sampling the PMU.)
Statistically, the sampled call graph produced by scgprof is generally accurate in terms of which
calls are more frequently made, and how much more frequent some calls are than others. The
sampled call graph produced will be more useful for longer-lived processes than shorter-lived
processes.
The --branch-sampling-spec option is used with the scgprof measurement (and used only
with this measurement). It helps produce the statistical call graph. See “--branch-sampling-spec
(p. 54).
Differences Between scgprof and cgprof
These are differences between scgprof and cgprof collection runs:
scgprof collection runs have significantly less overhead than cgprof collection runs, because
the call graphs are produced using sampling instead of instrumentation.
The --duration option is supported for use with scgprof (but not cgprof).
The --branch-sampling-spec option is supported for use with scgprof (but not cgprof).
When you are using scgprof and attaching to a process, dependent libraries do not have
to be mapped private with chatr before attaching with HP Caliper.
An scgprof report differs slightly from a cgprof report. In particular, there are two Sampling
Specification sections in the summary area: IP Sampling and Branch Sampling. See “Sampled
Call Graph Text Report Example” (p. 122).
120 Producing a Sampled Call Graph Profile Analysis