Jinsight Guided Tour
We'll first use the Object Histogram view to visualize
the sample trace GCExample1, which comes with Jinsight in the
traces
subdirectory.
| To start Jinsight from the Windows Start menu: |
-
Choose Start => Programs => Jinsight2.0 => Jinsight Visualizer.
|
(This notation means "click on the Start menu; choose the Programs submenu;
choose the Jinsight2.0 sub-submenu; and finally choose Jinsight Visualizer."
It's a notation you'll see used throughout the tour.)
The Jinsight workspace window appears. Next, tell Jinsight to open
the GCExample1.trc sample trace.
| To open the GCExample1 sample trace and load the entire trace: |
-
Choose Workspace Window => File => Open Trace File.... An "Open trace..."
dialog box will appear.
-
Go to the traces subdirectory.
-
Double-click on GCExample1.trc.
-
Choose Load at the bottom of the workspace window.
|
The Jinsight workspace window lets you control Jinsight
and open new views.
The names of classes used in the program appear along the left of the
view. Objects appear to the right of each class name. The first,
a colored diamond, represents the class object. To the right of the
class object are colored rectangles, one for each instance of the class.
Move the mouse cursor over a class or an object to see its details in
the status line at the bottom of the view. (We call this interaction technique
fly-over.)
The colored shapes turn into outlines when the objects are garbage collected.
Classes and objects can be colored according to different criteria, the
default being "Base Time"—time spent in the object's methods. The
color scale goes from black (meaning zero time) to dark blue (a small amount
of time), through purple, violet, dark red, and finally bright red (large
amounts of time). The legend shows the range of values that the colors
represent for the current coloring criteria. The classes may be sorted
by decreasing color values.
| To sort classes by color value: |
-
Choose Histogram => Options => Sort Class Colors Now.
|
Now the classes with the most active instances appear at the top of
the histogram.
At this point, there isn't much variety in the coloring of objects—just
blue and black. That's because the default color scale doesn't have enough
range to show subtle differences in activity levels in this particular
execution. You can recalibrate the color scale so that only the most
active object is colored red, with less-active objects taking on a broader
range of colors.
| To recalibrate the color scale: |
-
Choose Histogram => Options => Recalibrate Colors.
|
Now you will see that some of the classes and objects have turned red,
pink, violet, or purple, with redder colors signifying more activity.
Note also that the number at the right end of the legend—the maximum base
time value—is much smaller than it was initially.
Base time is just one of several coloring criteria.
| To see objects according to different criteria: |
-
Choose Histogram => Object Appearance => Color by Cumulative Time.
-
Choose Histogram => Object Appearance => Color by Number of Calls.
-
Choose Histogram => Object Appearance => Color by Number of Threads.
|
You can also view various dependencies between objects.
| To show the creator of an object: |
-
Right-click on an instance of class java/lang/String (at the top
of the histogram).
-
Select Who Creates Object from the resulting menu. The red line
shows the creator of this object.
|
| To see the caller(s) of an object (that is, the objects
that have sent messages to it): |
-
Right-click on another object from class java/lang/String.
-
Select Who Calls Object. Zero or more green lines show the callers
of this object.
|
| To see the callers of every instance of a class: |
-
Right-click on the class label java/lang/StringBuffer (four classes
down from java/lang/String).
-
Select Who Calls Objects.
|
| To remove these lines: |
-
Choose Histogram => Options => Clear Lines.
|
| To see who holds a reference to a given object: |
-
Make sure you have reached the end of the trace (i.e., when all trace events
have been read, as indicated by the Workspace Window).
-
Right-click on the first instance jinsight/main/Controller object
(the red square of the second class from the top).
-
Select Who Refers to Object. The small blue line identifies the referring
object (the jinsight/main/Controller class object).
|