Sun Studio 12: Performance Analyzer

## Function-Level Metrics: Exclusive, Inclusive, and Attributed

The Performance Analyzer computes three types of function-level metrics: exclusive metrics, inclusive metrics and attributed metrics.

• Exclusive metrics for a function are calculated from events which occur inside the function itself: they exclude metrics coming from calls to other functions.

• Inclusive metrics are calculated from events which occur inside the function and any functions it calls: they include metrics coming from calls to other functions.

• Attributed metrics tell you how much of an inclusive metric came from calls from or to another function: they attribute metrics to another function.

For a function that only appears at the bottom of call stacks (a leaf function), the exclusive and inclusive metrics are the same.

Exclusive and inclusive metrics are also computed for load objects. Exclusive metrics for a load object are calculated by summing the function-level metrics over all functions in the load object. Inclusive metrics for load objects are calculated in the same way as for functions.

Exclusive and inclusive metrics for a function give information about all recorded paths through the function. Attributed metrics give information about particular paths through a function. They show how much of a metric came from a particular function call. The two functions involved in the call are described as a caller and a callee. For each function in the call tree:

• The attributed metrics for a function’s callers tell you how much of the function’s inclusive metric was due to calls from each caller. The attributed metrics for the callers sum to the function’s inclusive metric.

• The attributed metrics for a function’s callees tell you how much of the function’s inclusive metric came from calls to each callee. Their sum plus the function’s exclusive metric equals the function’s inclusive metric.

The relationship between the metrics can be expressed by the following equation:

Comparison of attributed and inclusive metrics for the caller or the callee gives further information:

• The difference between a caller’s attributed metric and its inclusive metric tells you how much of the metric came from calls to other functions and from work in the caller itself.

• The difference between a callee’s attributed metric and its inclusive metric tells you how much of the callee’s inclusive metric came from calls to it from other functions.

To locate places where you could improve the performance of your program:

• Use exclusive metrics to locate functions that have high metric values.

• Use inclusive metrics to determine which call sequence in your program was responsible for high metric values.

• Use attributed metrics to trace a particular call sequence to the function or functions that are responsible for high metric values.