When a benchmark is sampled [S] or traced [T], Browse Execution in the Results menu is enabled. Selecting this item builds an execution tree from the selected benchmarks in the benchmark list and opens a Method Execution browser.
Note: | The Browse Execution menu items are grayed when no benchmarks are selected or when run [R] benchmarks are selected (run [R] benchmarks contain no data from the execution stack). |
Browsing method execution answers the following questions:
Browsing the method execution provides a detailed, fine-grained view of the dynamic behavior of the code. The list pane shows a sorted summary of all occurrences of a method in the execution tree. The tree widget shows the execution tree. Each method in the execution tree is annotated with information about the method. Using the Methods menu, this information is augmented and filtered. A status line gives summary information about the execution tree.
The Time menu filters raw and execution time for the execution tree. For a description of this menu, see Filtering raw time.
Total time is the time spent in a method and in every other method that the method invoked. Total time provides an overview of how time is distributed about an execution tree. When optimizing, you use total time to identify expensive subtrees that could be avoided. For example, caching a value or performing a fast Boolean check may avoid calling an expensive operation. Reducing total time in a method is done by reducing local time in methods it calls.
Local time is the time spent actually executing in a method and provides a detailed view of how time is distributed about an execution tree. When optimizing, you use local time to find hot spots in the code. Hot spots are clusters of methods that have high local time, with a single root that has little or no local time, but high total time. To draw attention to hot spots in the execution tree, they are displayed in red.
A method has high local time for these reasons:
The methods list contains every method in the execution tree that was encountered during sampling or tracing. Depending on whether the Total Time or Local Time radio buttons is selected, the list shows total or local time as a percentage of the total time spent between starting and stopping a software timer. This means that the bench method always shows 100% total time. Multiple occurrences of a method are collapsed and their times are totaled in the list.
The methods list allows you to quickly zero in on problem methods. Selecting a method from the list expands the execution tree to the first occurrence of the method in the tree. To cycle through all occurrences of a method, the two direction buttons below the list are used to go forward and backward. Reselecting the method has the same affect as selecting the forward-direction button.
The following mutually exclusive Methods menu items toggle between local and total time:
The following Methods menu items find methods in the methods list and in the execution tree:
The following mutually exclusive Methods menu items sort the methods in the methods list:
The following Methods menu items control the information displayed in the methods list and the execution tree: