ANTS Performance Profiler - 7.2

ANTS Performance Profiler

Working with the call tree - ANTS Performance Profiler

The call tree shows the stack traces that were executed by your application during the time period you have selected. By default, stack traces are displayed top-down (calling method above called method). The "hottest" stack trace (the one that took the most time to run) is displayed at the top of the call tree, and is automatically expanded. If a method was called in several contexts, it is displayed once for each context in the call tree.

See Tips on using the call tree for more information on how to use the call tree effectively.

calltree2

The following data is shown for each method within the stack trace, for the selected time period:

  • Time: the total execution time for the method within this stack trace.
  • Time With Children: the total execution time for the method and all its children within this stack trace.
  • Hit Count: the number of times the call was made within this stack trace.

When time is shown as a percentage, the Time (%) for each method shows the proportion of the total execution time that the method contributed during the selected period. The total percentage for all methods can sum to over 100 on machines using multiple CPU cores.

SQL calls made by the application are also shown within the stack trace, with the following information:

  • Time: the time until the first result for the query was returned.
  • Time With Children: the total execution time for the call and all its children within this stack trace.
  • Hit Count: the number of times the method was called within this stack trace.

Each method is shown with one or more of the following icons:

calltreeleafsymbol

Root method or leaf method. Root methods are not called by any other method; leaf methods do not call any other method.

calltreetopdownarrow

Indicates call flow when the call tree direction is top-down (calling method above called method).

calltreebottomuparrow

Indicates call flow when the call tree direction is bottom-up (called method above calling method).

app_hidden_flow

Indicates one or more collapsed methods that can be expanded.

app_hidden_rootleaf

Indicates one or more collapsed methods that cannot be expanded (because they are all leaf nodes that have been filtered out of the current view - see Filtering the call tree below).

hoticon

Method is part of the hottest (longest running) stack trace. Used instead of the root/leaf or call-flow icons.

*

A method name followed by an orange asterisk: Method is optimizable.

app_sql_icon

Indicates a SQL call generated by the parent .NET method.

Methods listed in bold have source code available. To display the method's source code, click any bold method. Line-level timings are also available in the source-code pane if you use one of the Line-level ... profiling modes.

You may also see the following items in the call tree. These are shown in bold orange text, and represent time spent in your application that is in addition to time spent executing specific methods:

  • Waiting for synchronization: A thread was waiting. For example, if you have called the Monitor.Wait method, the thread will wait for synchronization until the lock is reacquired. Another cause is that the finalizer thread spends most of its time waiting. Expand the call graph to see what caused the wait. Items that are Waiting for synchronization only contribute to timings in the call tree when the Timing display option is set to Wall-clock time. To exclude time due to Waiting for synchronization items, select CPU time from the Timing display option.
  • Thread blocked: The executing thread was blocked. For example, the thread may have been sleeping, or waiting for access to a shared resource. Thread blocked items only contribute to timings in the call tree when the Timing display option is set to Wall-clock time. To exclude time due to Thread blocked items, select CPU time from the Timing display option. The call-tree display options are described below.
  • Waiting for I/O to complete: The executing thread was blocked waiting for file I/O. Waiting for I/O to complete items only contribute to timings in the call tree when the Timing display option is set to Wall-clock time. To exclude time due to Waiting for I/O to complete items, select CPU time from the Timing display option. The call-tree display options are described below.
  • Transition to unmanaged code: A transition from managed code to unmanaged code occurred at this point in the stack trace. In general, line-level and method-level timings are not available for the unmanaged code. However, for unmanaged methods that are declared with extern within managed code, method-level timings are available.
  • Transition to managed code: A transition from unmanaged code to managed code occurred at this point in the stack trace.
  • JIT overhead: JIT compilation occurred at this point in the stack trace during execution of your application. The method that needed to perform the compilation is shown as the parent of a JIT overhead item.
  • Profiler overhead: Additional overhead introduced by ANTS Performance Profiler. This is unlikely to be seen when the option to adjust timings to compensate for overhead added by the profiler is enabled.
  • Assembly load or unload: A .NET assembly was loaded or unloaded.
  • Module load or unload: A .NET module was loaded or unloaded.

To create a new call graph based on a particular method, select the method in the call tree, and click the new call graph button newcallgraph in the Method column.

To switch to view a SQL query in Database Calls view, select the method in the call tree, and click the app_sql_icon button in the Method column.

Changing the call-tree display options

You can change the way data is displayed in the call tree, using the display options on the results toolbar:

app_calltreedisplayoptions2

  • Scope: Controls which methods are displayed in the call tree:
    • All methods: Shows all methods called during the selected period, including .NET framework class-library methods.
    • Methods with source: Shows only those methods for which the profiler can locate source code.
    • If you have selected methods with source and are not seeing certain methods that you expect,
    • Filtered methods: Shows methods according to filters you have selected. For details on filtering, see Filtering below.
  • Threads: filters the display of stack traces by thread.
  • Timing: controls the way in which method timings are calculated. You can choose from:
    • Wall-clock time: includes blocking, such as waiting for I/O. Can be less reliable on virtual machines.
    • CPU time: excludes blocking.

    Note that the profiler initially records timings in CPU ticks, and converts them to milliseconds when Wall-clock time is selected. CPU tick recording can be unreliable if a process runs on more than one processor.

  • Direction: controls whether the call tree is displayed top-down (calling methods above called methods) or bottom-up (called methods above calling methods)

You can also:

  • Change the time unit. On the View menu, click Percentages, Ticks, Milliseconds, or Seconds.
  • Reorder the call tree. To change the stack-trace order, click the Time With Children (%) column heading.

Filtering the call tree

You can apply filters to limit the methods shown in the call tree. To apply filters, right-click on a method in the call tree, and choose:

  • Hide: Stops displaying the selected method, class, or namespace from the results shown in the call tree.
  • Show only: Removes all but the selected method, class, or namespace from the results shown in the call tree.
  • Show hidden methods: Remove all applied filters and display all methods in the call tree.

When filters are applied, the Scope control for the call tree switches automatically to Filtered methods. After applying or removing a filter, ANTS Performance Profiler redraws the call tree. The timings shown for other methods are not affected.

app_filtering

Tips on using the call tree

To locate methods that may be good candidates for optimization:

  1. Order the call tree with the slowest stack traces at the top (top-down). If necessary, click the Time With Children column heading to change the stack-trace order.
  2. Starting with the slowest stack traces, look for method pairs where subsequent values for Time With Children reduce substantially as you move down the stack trace. Methods with higher values in such pairs may be good candidates for optimization.

    ANTS Performance Profiler can optionally suggest methods that may be good candidates for optimization. To show suggested methods, on the Tools menu, click Suggest methods to optimize. Suggested method names are marked with an asterisk (*).

    In general, the better you understand the structure and meaning of your code, the more easily you will be able to interpret the data collected by the profiler.

To reduce the number of methods shown, you can do any of the following:

  • Choose a "(methods with source)" option from the Direction and scope list in the display options.

    APP_calltreedisplayoptions_tips

  • Select the Hide insignificant methods check box in the display options.
  • Select a shorter region on the timeline.

To find a particular method:

  1. On the Tools menu, click Find.

    The Find bar is displayed beneath the call tree.

  2. Type all or part of the method name you are looking for, and press ENTER.

    The first matching row in the call tree is highlighted.

Click previousarrow Previous or nextarrow Next to move between matching method names.

Waiting for synchronization

The Call Tree may display '(Waiting for synchronization)'. This means that a thread is waiting for another thread to finish.

If '(Waiting for synchronization)' is the only item in the Call Tree, it is likely that you are viewing the garbage collector thread only. To see all results, select Top-down (Any method), (All threads), Wall-clock time and Hide insignificant methods.

Was this article helpful?

Search support
Forums

ANTS Performance Profiler

all products