CyVis Software Metrics Collection, Analysis and Visualisation Tool

 

SourceForge.net Logo

Starting CyVis

After extracting the zip file to the desired location, double click on the cyvis.jar file to run the application. This will launch the application. If your machine does not support double clicking on jar files, you can run the cyvis.bat in the bin folder.

Creating and Saving a Project

Click on the File->New Project to create a new Project. This brings a screen as shown here. Then follow the steps given below to create a project

  • Give the project a name
  • Select the directory where you want the project file to be located.
  • Then add *.jar or *.class files to your project by clicking on Add. Once you have added all the files you want. You may also remove files by selecting them and clicking on Remove.
  • To save the project Click on Save. This creates a project file with the name that you have provided, in the specified directory (in this instance myproject.cys will be created in C:\projectWorkspace\).
  • Once you have saved the project, you can click on Finish for CyVis to extract metrics and display it.

Viewing Metrics

Once the metrics has been extracted you are presented with a screen as shown here. The screen is divided into two basic components.

  1. Tree Structure:
    By default the tree structure shows you all the packages in your project. Each of these packages when expanded will display the classes and interfaces it contains.

  2. Metrics Panel:
    This metrics panel is further subdivided into
    • ToolBar
    • Chart Panel
    • Metrics Table
    Let us first have a look at the Chart Panel and revisit the toolbar later for better understanding.

Chart Panel

What do the charts mean or what can you infer by looking at them? This section answers this question. The chart panel visualises the metrics.The charting is done in three levels

  1. Project View:

    As soon as the metrics are extracted the chart panel will display many blocks like this. Each of these blocks represents a separate package in your project. The package name will be displayed at the top of each chart. Each package chart consists of numerous vertical bars, representing a Class or an Interface in that package. By clicking on any of these blocks you will be taken to the Package View for that package.

  2. Package View:

    Package view will show all the classes and Interfaces in a particular package. The difference between this view and the Project view is that here you look at only one package whereas in the project view you can look at all the packages. In addition to that, when you move the mouse over any specific vertical bar, a tool tip pops up with the metrics of that particular class/Interface as shown in this diagram. You may also click on the vertical bars to see a particular Class/Interface in detail (which brings up the Class View). The classes are arranged based on their size with the biggest class placed in the left hand side and the smaller ones in the right.

  3. Class View:

    The class view will show one vertical bar representing the class/interface selected as shown in this diagram . This vertical bar is divided into many smaller rectangles, each representing a method in that class/interface. These smaller rectangles vary in size indicating their size with respect to other methods. The most complex method is at the top and the least at the bottom.

Colouring and Metrics:

The colouring of the methods in each of the views is done according to their Cyclomatic Complexity. By default any method with a Cyclomatic Complexity less that or equal to three is coloured green, anything beyond that and less than seven is coloured yellow and everything else is red. Interfaces are coloured grey, and empty interfaces are white. You can change these defaults (colours and cyclomatic complexity ranges) in the preferences dialog.

Metric Table:

The table is just below the chart panel. It displays the metrics for that particular view.

ToolBar:

The toolbar looks like this. Please refer to the picture to find what the numbers actually mean.

  1. Moves to previous view
  2. Go one level up (i.e. if you are in class level to package level or from package level to project level)
  3. Moves to next view.
  4. When relative is selected all the classes in a package are shown as having the same size, whereas the absolute view displays the classes in relation to one another. This diagram shows the two views in package level.
  5. Lets you zoom in and out.
  6. Just Legend.

Changing Preferences:

To change the Cyclomatic Complexity, Chart Colouring and the directory where report should generated in click Metrics->Preferences in the menubar. Doing so shows this dialog. The dialog shows the defaults. The report directory by default is the directory where the project is saved (the *.cys file) which can be changed if you choose to. The Metrics section allows you to change the range of cyclomatic complexity and the color that represents them. Clicking on the colours launches a colour palette. Remember to save any changes you have made, so that they get applied. Restore Defaults restores the default for you.

Editing Projects:

When you click File->Edit Project, CyVis can take different actions based on whether a project is currently open or not. If a project is already open, CyVis displays the edit dialog with all the information of the current project. You can add/remove files, change the workspace or even the project name. Once you have finished editing save the project like you generally do.

On the other hand if a project is not currently open, CyVis pops up an open dialog. Select the project file(*.cys) which you want to modify. Once you have selected your project, CyVis opens the edit menu.

Generating reports:

Two types of reports are possible, HTML and TXT formats. The reports can be generated by either clicking Metrics->Generate HTML Report or Metrics->Generate TXT Report.

You may also choose to do an XML Dump by clicking on Metric->Generate XML Dump.

The report and the dump files are automatically generated at the report directory. The report directory is the same as the project directory unless changed via preferences dialog.