Multi-Visualizer
Charles
Zhang, Gilbert Gao and Arno Jacobsen
Department of Electrical and Computer Engineering
Middleware Systems Research Group, Technical Communications
University of Toronto
Multi-visualizer is an extension of the visualization functionality of AMT, initially developed at UBC [1]. It is designed to provide more powerful and easy-to-use management functionality for aspect mining of large projects, typically consisting of hundreds or thousands of classes. All original functionality of AMT are preserved as well. You can download the executable from here.
Typical tasks that the multi-visualizer can well perform are:
1. Give me lists of classes that contain synchronization and exception handling primitives , respectively.
2. Give me top 20 (this number is changeable) classes that scatter the most, that is, are used most heavily in the application.
The mechanism of the multi-Visualzer is centred on profile-based mining. A mining profile can be considered as an analysis task for a certain interest. It consists of a target, a pattern and a metric. By further defining those sub-elements of a profile, it is quite flexible to perform a large variety of mining tasks. The following explains those sub-elements in detail.
Target
A target is a subset of all classes that an application under investigation contains. A profile can use the concept of target to divide the large code space into smaller, more relevant groups to better capture results. In Java, natural lines of such divisions are packages. In multi-visualizer, the target is defined as an inclusion, a set of packages or classes that are under inspection, together with an exclusion, a set of packages or classes that are not of interest. By default, the inclusion contains all the classes in the application.
Pattern
A typical mining task in the context of AMT is to find recurrences of a particular usage of certain class types or regular expressions. Those class types and regular expressions can be group together to form a particular usage pattern such that, if any of the types or regular expressions is found in a class implementation, that class is added to the result collection.
Metric
Metric defines the purpose of the mining activity. Currently, two types of metrics are supported: 1.) collection of pattern matching class types and 2.) a ranking of indicated number of classes that are most heavily used in the application. Those two metrics can be collected separately or together in one profile.
The multi-visualizer allows user to define a number of profiles. It is able to process them efficiently in a batch style. User can create, browse, edit profiles, and view the mining results of those profiles.
Multi-visualizer is simple and straightforward to use. (Hopefully). The following example illustrates how to use the tool by going through the process of mining exception usage of Tomcat, an open source Java Servlet container.
Step 1: Loading an AMT file
The command “java AMT.multiview.Visualizer” brings up the following dialog to load the AMT file. (For details of AMT file, please refer to the original AMT documentation [1])

Step 2: The profile table window
The following window is displayed after loading of the AMT file is finished. It displays a list of existing previously defined profiles.
We need to create a new profile to do the mining work for exceptions. The window for creating a new profile can be brought up in two ways: 1. via the selection of the “New” item on the “Profile” menu as illustrated by the screen shot above. 2. via the “New” item on the popup menu when the right mouse button is clicked.
Step 3: The profile detail window
The following window allows us to fill in the details of a profile. We can define the target, usage pattern and the metric.

Step 3.1 Define Target
The GUI supports drag and drop. Therefore, suppose that we want to look into classes except for those located in the org.apache.naming package, we can drag the top “org” package into the Inclu: area on the left and the “naming” package into the Exclu: area on the right. The following screen shot reflects the GUI changes.

Changes are made via a delete-and-reselect fashion. Select the to-be-deleted
item and right click the mouse button. Click “Delete” would remove the
selection as illustrated by the following:

Step 3.2: Define Usage Pattern
For exception handling, we can look at the scattering of the class type java.lang.Exception and the application specific exception “org.apache.catalina.LifeCycleException”. We drag and drop the application exception into the “classtypes” area on the left and type “java.lang.Exception” using the input box. We don’t need to specific any regular expressions in this case.

Step 3.3 Define Metric
Our goal is to find all classes that contain exception handling. Therefore, option 1 is selected. Although option 2 can be selected as well, we skip that in this example.

Step 4 Save the profile
Clicking “Save” button on the bottom of the window will save the profile onto disk. If it is the first time, we are prompted for giving a name. Let’s name the profile we just created “exception”
Step 5. Process the profile
After saving the profile, we come back to the profile table window, where the “exception” profile we have just created appears as an entry like the following:

Via the “Process” command on the popup menu, we can ask the tool to process the profile.
Step 6. Checking the result
Upon completion of processing, the status of the profile under the “Result” column changes and we can view the result via the “Result” item of the popup menu. The following is a snapshot of the result of the mining. It shows the size of the target as number of classes and also the number of matches, that is, number of classes that contain the specified usage pattern as defined in step 3.2:
Step 7. Export result
The results of profile processing can be exported to a text file as a report. That can be done via the menu or the pop up menu. Notice the tool allows us to consolidate several profile results together as one big report.
Step 8. Refine Profile
Let us suppose that we realize that, to better capture the spreading of the exception handling aspect, it might be more accurate to search coding patterns, such as “try” and “catch” statements, which symbolize exception handling in Java. Therefore, we want to edit the “exception” profile we just defined to include regular expressions that match “try” and “catch”. That can be done from the profile table window, as illustrated in step 2, in two ways, either from the “AMT/Edit” menu command or the “Edit” command of the popup menu after selecting the “exception” profile on the table. That brings up the profile table. And we can type in regular expressions like the following:

We then click “Save” on the bottom of the window and come back to the profile table. Processing of the profile can proceed as normal. Notice that the processing time takes much longer because the tool is performing textual matches line by line. The result set of the profile is much larger than just using class types, as shown by the following screen shot.

This section explains all the menu commands on the profile table window.
1. Profile Menu
This menu contains all the profile related actions. The pop up menu is identical to this menu.
1.1. Profile/Process
Process the selected profile. Note that if multiple profiles are selected (mouse click while pressing the Ctrl key), all the profiles are processed simultaneously.
1.2. Profile/New
Brings up the profile window to define a new profile
1.3. Profile/Edit
After selecting an existing profile on the table, the profile window is brought up to allow the profile to be edited.
1.4. Profile/Result
After selecting an existing profile, this command display the result of the mining
1.5. Profile/Stop
This command stops the profile processing
1.6. Profile/Delete (Multiple selection supported)
This command deletes the selected profile(s).
1.7. Profile/Create Report (Multiple selection supported)
This command creates the report of mining results and exports it to a text file.
2. AMT menu
This menu contains all the AMT file related actions.
2.1. AMT/Switch
This command switches to another AMT file without restarting the application.
This project was partially funded by NSERC. Aslo thanks to Jan Hannemann, who created the aspect mining tool and helped via emails during the implementation of the extension.
For bugs, improvements or suggestions, please contact:
Charles Zhang, czhang@eecg.utoronto.ca
Gilbert Gao, gao@ecf.utoronto.ca
H-Arno Jacobsen jacobsen@eecg.utoronto.ca
[1] The aspect mining tool, Jan Hannemann, University of British Comlumbia URL: http://www.cs.ubc.ca/~jan/amt/