|
|
A slice is a subset of the trace information you may define to correspond to a feature in your program you would like to analyze. You may use slices to filter out extraneous information and focus your analysis on one area. You may also use slices to combine related information into your own groupings. These groupings are then available as an additional dimension for analyzing the trace information in many of the views.
An important feature of slices is they give you an extra dimension for measuring your run. You may compute any measurement about your program relative to any slice you've defined. For example, if you have defined a number of slices to represent functional areas of your program, you may measure execution time in each thread, method, method invocation, etc. spent in each functional area you have defined.
You may define slices to study either execution activity or memory. You may define a slice based on a static aspect of your program, such as a particular set of classes or methods, or a dynamic aspect of your program's behavior, such as a particular set of method invocations, instances, or threads. A slice may also be defined to contain any combination of the above.
In addition to slices, workspaces are provided that maintain a working context for you as you are studying your program. A workspace consists of a base slice that lets you limit the focus of your study, subset slices you may define to group the information within that focus, and any number of views for exploring the trace using this filtering and grouping you have defined.
To analyze a particularly complex problem, you may also set up multiple workspaces as your study progresses, so you can explore a single trace from various angles.
When you start the Jinsight visualizer you automatically get one workspace to start working in. The workspace by default has a base slice named "Workspace", and will contain all of the trace information that was loaded into the visualizer.
You may limit the focus of your study by setting up filtering criteria for the workspace base slice. From any view, select the items of interest and, either using the popup menu (right-click) or the Selected menu, choose Limit an Existing Slice --> Workspace (or the actual name of your workspace base slice) --> to Selected Items. Various views will then show only elements that are in the workspace base slice. Moreover, many of the measurements shown in the views will reflect only activity within the slice.
To illustrate these features we show an example below, where we are studying a transaction-processing application. We would like to study only transaction processing activity and exclude everything else. From a Table of methods, we select the five transaction processing methods and limit the workspace base slice to cover activity only from these methods.
Below you can see the execution view as it appears before and after this base slice filtering is in effect. In the view on the right, activity that is not in the workspace base slice is rendered in an almost invisible color.
Execution view before filtering Execution view with workspace base filtering in effect
Continuing with this example, we may now want to look at the time spent in each class, but only time spent on transaction processing activity. Below we see a table view of classes, before and after the base slice filtering is in effect. The view on the right shows only the time spent in transaction processing for each class.
Before filtering: all time spent in each class With filtering: time in each class spent on transaction processingSee Using Slices in Views for a more detailed discussion of how the base slice filtering may be used in each of the views.
You may define additional slices to group information together that you want to study, in effect creating your own units for analysis. Each new slice you create will contain a subset of the contents of the base slice of the workspace.
To create a new slice: from any view, select the item(s) of interest and, either using the popup menu (right-click) or the Selected menu, choose Create a New Slice --> From Selected Items. You may also create a number of slices at once by selecting multiple items in any of the views, and choosing Create a New Slice --> From Each Selected Item.
We illustrate creating slices by continuing our transaction processing example. We would like to analyze the way our transaction processing application uses the database. Below we show how we can create two slices: one slice for database queries (based on both the initial executeQuery() method and subsequent calls to next() for each record), and one slice for database updates.
Creating two slices, to study database query vs. update activity
The system automatically assigns each of the slices a name and a color. We may open a Table view of slices, shown below, to see a summary of information about the slices in the workspace. Note that by default the base slice is assigned a dark gray color, and subset slices are assigned bright contrasting colors. To modify, rename, or perform other operations on slices, you may use the menus in the Table view of slices. See Slice Operations for details.
Summary of slices
The slices we have defined may now be used as an additional dimension for analyzing the trace information in various views. Below we show how we may use the Table view to study our program's use of the database query vs. update operations at various levels of detail. The first view below shows how we may analyze each type of transaction separately, to understand its use of the database. Each column labeled "cumulative time" shows the time spent in a particular slice of activity: in transaction processing as a whole, in database queries, and in database updates. In this view we have also chosen to show the numbers in the two rightmost columns as percentages of the workspace base slice. The numbers in the two rightmost columns show the percentage of time each method spends in database query or update activity.
Time in each transaction processing method, broken down into database query vs. update activity
The next view shows how we may analyze one of these transaction types in finer detail: to understand how each invocation of a particular transaction method makes use of the database. Each row shows how much of the time of a single invocation of a transaction method is due to database query or update activity. In this example we have also chosen to show the data as a bar chart.
Time in individual invocations of a transaction processing method, broken down into database query vs. update
To obtain the above Table views, in the Columns menu we selected Choose Slices..., which brings up a dialog to select which slices will appear in the columns. To show the numbers as percentages, in the Columns menu we selected Display Percentage of Base. In the second view, we also choose Display Bars from the Columns menu.
We may also use slices in the Execution view to understand when and in which threads each type of database activity is occuring. Below we show the Execution view, and from the Options menu we have selected Color by Slice.
Execution activity colored by slice (transaction processing = dark gray, query = green, update = blue)
Above we have shown just two of the ways that slices may be used in views. See Using Slices in Views for more ways that slices may be used in each of the views.
An important concept to understand when using slices is that when you define a slice by selecting items in one of the views, various items related to the items you selected will automatically be included or excluded from the slice. For example, we created our slices in the above examples by selecting methods, yet we are automatically able to visualize and measure invocations of these methods, including method invocation activity called by these invocations. This feature lets you define a slice simply, and then use it in various views. You may adjust the rules that determine exactly what is included in a slice by editing the slice definition. See What's in a Slice, Precisely? for a detailed discussion of how the contents of a slice are determined.
There are also a number of other ways to create slices based on more complex criteria. See Undocumented "Advanced" Features.
Note: there is currently a limit of 32 slices active at one time in a Jinsight session.
|
|