Figure 20-18 Heap view by methodsMethod invocation In the Heap view or in one of the statistics view, select the PerformTransaction.doPost method and Show Method Invocation from the cont
Trang 1Figure 20-18 Heap view by methods
Method invocation
In the Heap view or in one of the statistics view, select the
PerformTransaction.doPost method and Show Method Invocation from the context menu to display the Method Invocation view (Figure 20-19)
This view shows a representation of one method and the calls that are executed from that method and the called methods Clicking or scrolling over each method (the vertical bar) shows its cumulative time
Using the zoom icons (+ and -) you can zoom into areas of the graph
Trang 2Figure 20-19 Method Invocation view
From the context menu, click Show Caller to see the caller(s) of the selected method in the view
Figure 20-20 shows the callers of BankEJB.getAccounts The highlighted area is the selected method
Trang 3Figure 20-20 Method Invocation: show caller of getAccounts
Each time you do this, one method higher up in the calling sequence is displayed
Select the method The vertical length of the selected area indicates the base time for the method You can determine the execution time for this method by checking the vertical time scale on the right side of the view The status line gives you the cumulative time for the method
Note: Selecting Next and Previous in the context menu navigates through all
Trang 4Figure 20-21 Method Invocation: table view
Each method can be expanded to show other methods that it invoked
Method execution
Open the Method Execution view by selecting Show Method Execution from the context menu of a selected method
The Method Execution view summarizes the information in the Method Invocation view and therefore shares most of its interpretations, but at a more abstract level
Figure 20-22 shows the Method Execution view for the listAccounts.doPost
method This is an accumulation of all instances It shows the invoked methods
In our case we can see the findByPrimaryKey method took a long time
The Method Execution view displays a single pattern at a time However, it may contain hidden patterns or sub-patterns, which are points of variance in the pattern If it does display any hidden patterns or sub-patterns, you will see one or more indicators of the form n/m To see these hidden variants, click the indicator repeatedly There may be several such indicators throughout the view
Trang 5Figure 20-22 Method Execution view
Trang 6Execution flow
The Execution Flow view displays the execution of the entire program, while the method views display the execution of a single method at a time You can use the Execution Flow view to identify active threads, long-lived or frequently called methods, and phases of program execution
When you are in the Execution Flow view, or in the Method Invocation or Executions views, you can open the editor on a method by selecting Open
the Workbench
An example of an Execution Flow view is shown in Figure 20-23 When you move the cursor over the vertical bars, the status line at the bottom of the view shows the method name and other related information
Figure 20-23 Execution Flow view
Horizontally you can see the active threads, with the garbage collection thread, (GC), always shown at the far left (not shown in Figure 20-23) At the far right of the graph is the time scale showing elapsed time in seconds
Note: Zoom In from the view menu to focus on specific parts of the graph and
Trang 7Each vertical bar represents a method and the height of the bar represents the time of execution for that method The color of the bar identifies the class of the object
You can use the Zoom In action on the view menu to show parts of the graph in higher resolution As you do this, you will see the time scale at the right of the graph get more granular If you want to see more details about a method’s execution, select it in this view and then select Show Method Execution from the context menu
To reduce the amount of information in the view, you can remove threads from it
To do this, select Threads from the view’s context menu and deselect any threads that you are not interested in at the moment From the menu you can also show or hide all repetitions of methods
Sequence diagram
The Sequence Diagram view presents the execution flow of an application according to the notation defined by UML The view presents a sequence of dependent events, where events are defined as method entries and exits as well
as outbound calls and return calls
To show this view, select Window -> Show View -> Sequence Diagram Figure 20-24 shows the Sequence Diagram view
Note: By default, all objects show the same color Selecting Graph Colors
from the context menu opens a dialog where you can change the preferences
so that each class has a unique color Then bars of the same color would represent methods belonging to the same class
Trang 8Figure 20-24 Sequence Diagram view
of the view The Home button returns the view to its original size
Within the Sequence Diagram view in the Profiling perspective, any two
consecutive events have the same vertical distance between them This does not take into account the time elapsed between the occurrence of these two events The vertical bar to the left of the diagram, with rectangles of equal height and different shades of red, corresponds to the representative distance between events Scrolling over the red rectangles will show the elapsed time between events
Trang 9To enable working with large-scale sequence diagrams, an overview is provided Click the Overview button in the lower right corner of the Sequence Diagram view to activate the overview (Figure 20-25)
Figure 20-25 Sequence Diagram view with overview
On activation, the button moves up along with the upper frame of the overview, and clicking it at this time closes the overview
The overview presents the same sequence diagram as the main view, but it is complete, scaled-down, and simplified to the vertical object life span lines and the call lines This compact view of the diagram provides you with the means to find interesting sections of the diagram, which may be obvious in this scaled down view On finding an interesting section of the diagram, you can move the main view to that position by double-clicking the spot or dragging and dropping the light red rectangle within the overview boundaries
Instance statistics
The Class Instance Statistics view shows the number of objects of each class (Figure 20-26)
When a class is expanded, you can see the actual objects The icons are the same as in the Package Statistics view
Trang 10The Instance Statistics view shows the same objects with their base and
cumulative times (Figure 20-27)
Figure 20-26 Class Instance Statistics view
Figure 20-27 Instance Statistics view