Browsing the method execution
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:
• Where does the work get done?
• Where are the hot spots?
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 and local 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 method is slow; it can be re-coded or can be changed to avoid expensive subtrees in the same way that a method with high total time is optimized.
• The method is fast, but it is called repeatedly. You can use micro-optimization techniques to gain every last bit of speed, as described in
Optimizing Smalltalk code.
The methods list and execution tree
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:
View Total Time
Shows the total time in a method (corresponds to the Total Time radio button).
View Local Time
Shows the local time in a method (corresponds to the Local Time radio button).
The following Methods menu items find methods in the methods list and in the execution tree:
Find Next Method
Finds the next occurrence of the selected method in the execution tree (corresponds to the right-direction button). It is grayed when no method is selected or when there is only one occurrence.
Find Previous Method
Finds the previous occurrence of the selected method in the execution tree (corresponds to the left-direction button). It is grayed when no method is selected or when there is only one occurrence.
Find Method
Prompts for a method name to match any method in the list.
The following mutually exclusive Methods menu items sort the methods in the methods list:
Sort By Name
Sorts the methods list alphabetically.
Sort By Time
Sorts the methods list by local time or total time.
Sort By Hits
Sorts the methods list by the number of times a method was entered and exited. When a benchmark is sampled, this number is not exact.
The following Methods menu items control the information displayed in the methods list and the execution tree:
Show Percentages
Shows the percentage of total time spent in the method.
Show Times
Shows the time spent in the method. If Show Scavenges or Show Global GCs is selected, time spent in garbage collection is also shown.
Show Hits
Shows the number of times the method was entered and exited. When a benchmark is sampled, this number is not exact.
Show Scavenges
Shows the number of scavenge operations that occurred in the method. When a benchmark is sampled, a scavenge operation may have occurred in another method.
Show Global GCs
Shows the number of global garbage collection operations that occurred in the method. When a benchmark is sampled, a global garbage collection operation may have occurred in another method.
Last modified date: 10/16/2017