The Effects of Recursion

If you have not already done so, you must collect performance data for synprog. See Collecting Data for the synprog Example for instructions. Once you have collected performance data, you must open the experiment test.1.er.

This part of the example demonstrates how the Performance Analyzer assigns metrics to functions in a recursive sequence. In the data collected by the Sampling Collector, each instance of a function call is recorded, but in the analysis, the metrics for all instances of a given function are aggregated. The synprog program contains two examples of recursive calling sequences:

In either case, exclusive metrics belong only to the function in which the actual work is done, in these cases real_recurse() and bounce_a(). These metrics are passed up as inclusive metrics to every function that calls the final function.

Direct Recursion

  1. In the Functions tab, find function recurse() and select it.

    Instead of scrolling the function list you can use the Find tool.

    Function recurse() has inclusive user CPU time, but its exclusive user CPU time is zero because all recurse() does is to call real_recurse().

    Note: Because profiling experiments are statistical in nature, the experiment that you run on synprog might record one or two profile events in recurse(), and recurse() might show a small exclusive CPU time value. However, the exclusive time due to these events is much less than the inclusive time.

  2. Click the Callers-Callees tab.

    The selected function, recurse(), is shown in the center pane. The function real_recurse(), which is called by recurse(), is shown in the lower pane. This pane is termed the Callees pane.

  3. Click real_recurse().

    The Callers-Callees tab now displays information for real_recurse():

Indirect Recursion

  1. Find function bounce() in the Functions tab and select it.

    Function bounce() shows inclusive user CPU time, but its exclusive user CPU time is zero. This is because all bounce() does is to call bounce_a().

  2. Click the Callers-Callees tab.

    The Callers-Callees tab shows that bounce() calls only one function, bounce_a().

  3. Click bounce_a().

    The Callers-Callees tab now displays information for bounce_a():

  4. Click bounce_b().

    The Callers-Callees tab now displays information for bounce_b(). bounce_a() appears in both the Callers pane and the Callees pane. The callee attributed time is shown correctly , because bounce_b() is not a leaf function, and accumulates inclusive time from its call to the instance of bounce_a() in which the work is done.

See also
The Callers-Callees Tab
Exclusive, Inclusive, and Attributed Metrics

Can't find what you are looking for? Email docfeedback@sun.com with your comments.
Legal Notices