Clearcase Integration

Using Resource Standard Metrics with Clearcase

© 2013 M Squared Technologies LLC

RSM Version: 6.50+

This white paper describes how to use the source code metrics and analysis tool, Resource Standard Metrics (RSM) with Clearcase.Clearcase is a source code control system copyrighted by Rational Software.It is assumed that the reader is familiar with the use of Clearcase and the basic operation of RSM.

Use Cases:

UC1:The user desires LOC and complexity metrics between two versions of source code baselines.The user shall run RSM recursively down a source tree, processing source code metrics.

UC2:The user desires metrics between two baselines where RSM will only recurse the "source" directory and not recurse the "include" directory, the test directory will not be processed.

UC3:The user desires metrics differentials between two specific directories in order to monitor developer productivity over time.

Approach:

RSM can create a metrics file called a "Work" file that contains file metrics in a date stamped format.This file can be created from any tree or directory of source code."Work" files can be created from two different views of the source tree.RSM can then process two "Work" files and create metrics differential reports.The metrics differential reports are available in Text, HTML and CSV (Spreadsheet Import) formats.

In Clearcase the files seen are governed by your "config spec".The "config spec" can have rules based upon code branches or labels.The use of Clearcase labels is a very valuable technique for creating interim baseline views that can allow RSM to create metric differential reports.

"Work" files created over time, from the same Clearcase view, can be used to generate developer productivity of LOC per hour, week etc.

Example Source Tree:

\vobs\proj\ctrl | |- Gui | |- src | |- inc | |- test | |- Engine |- src |- inc |- test 

Implementation of Use Cases with RSM and Clearcase

Use Case 1:

Unix Command

Narration

% cleartool setview BUILD1

Set the Clearcase view to see the code for Build 1

% cd /vobs/proj/ctrl

Change to the base of the code tree.

% rsm.sol -w"create ." -r"h,cpp,java ."

Create a RSM "Work" file from arecursive descent of the code tree, processing metrics for *.h *.cpp and *.java files.

% mv workfile.dat ~/build1_metrics.dat

Move the RSM "Work" file to a specific file in your home directory.

% cleartool setview BUILD2

Set the Clearcase view to see the code for Build 2

% cd /vobs/proj/ctrl

Change to the base of the code tree.

% rsm.sol -w"create ." -r"h,cpp,java ."

Create a RSM "Work" file from arecursive descent of the code tree, processing metrics for *.h *.cpp and *.java files.

% mv workfile.dat ~/build2_metrics.dat

Move the RSM "Work" file to a specific file in your home directory.

% cd ~/

Change directory to your home directory

% rsm.sol -H -w"x build1_metrics.dat, build2_metrics.dat" > metrics_diff_1_2.html

Use RSM to extract the metrics differentials between the two "Work" files.Specify the ancestor file first followed by the newer baseline "Work" file.

% netscape metrics_diff_1_2.html

Use a WWW browser to examine the metrics differential file.

Use Case 2:

Unix Command

Narration

% cd ~/

Change directory to your home directory

% vi metrics_file_list.txt

-n h ./Gui/inc

-r cpp,java ./Gui/src

-n h ./Engine/inc

-r cpp,java ./Engine/src

Use a text editor to create a file of the specified format so that the "inc" directories are not recursed and "src" directories are recursed.

% cleartool setview BUILD1

Set the Clearcase view to Build 1

% cd /vobs/proj/ctrl

Enter the top of the code tree in the vob.

% rsm.sol -w"create ."
-F"~/metrics_file_list.txt"

Run RSM with the -wcreate option for "Work" file generation in the file list mode.

% mv workfile.dat ~/build1_metrics.dat

Move the "Work" file to your home directory

% cleartool setview BUILD2

Set the Clearcase view to Build 2

% cd /vobs/proj/ctrl

Enter the top of the code tree in the vob.

% rsm.sol -w"create ."
-F"~/metrics_file_list.txt"

Run RSM with the -wcreate option for "Work" file generation in the file list mode.

% mv workfile.dat ~/build2_metrics.dat

Move the "Work" file to your home directory

% cd ~/

Change directory to your home directory

% rsm.sol -H -w"x build1_metrics.dat, build2_metrics.dat" > metrics_diff_1_2.html

Use RSM to extract the metrics differentials between the two "Work" files.Specify the ancestor file first followed by the newer baseline "Work" file.

% netscape metrics_diff_1_2.html

Use a WWW browser to examine the metrics differential file.

Use Case 3:

Unix Command

Narration

% cleartool setview BUILD2

Set the Clearcase view to Build 2

% cd /vobs/proj/ctrl/GUI

Enter the top of the specific directory in the code tree.

% rsm.sol -w"create ." -r"h,cpp.java ."

Run RSM with the -wcreate option for "Work" file generation in the recursive mode.

% mv workfile.dat ~/GUI_metrics_10_20_2000.dat

Move the "Work" file to your home directory

One Month Later repeat the process

% cd /vobs/proj/ctrl/GUI

Go to vob location

% rsm.sol -w"create ." -r"h,cpp.java ."

Re-run RSM with the -wcreate option for "Work" file generation in the recursive mode.

% mv workfile.dat ~/GUI_metrics_11_20_2000.dat

Move the "Work" file to your home directory and name it with a date stamp

% cd ~/

Change directory to your home directory

% rsm.sol -H -w"x GUI_metrics_10_20_2000.dat,GUI_metrics_11_20_2000.dat" > GUI_metrics_productivity_10_11_2000.html

Use RSM to extract the metrics differentials between the two "Work" files.Specify the ancestor file first followed by the newer baseline "Work" file.

% netscape GUI_metrics_productivity_10_11_2000.html

Use a WWW browser to examine the metrics differential file.

Note: UNIX commands are all on one line.

Summary:

These techniques are just an example of what can be done with RSM.RSM is not limited to Clearcase or UNIX.Similar techniques can be applied to other operating systems and source code control tools.All of the above commands can be scripted for ease of operation and to automate your metrics collection.RSM is available for all UNIX and Windows systems and is in use in over 26 countries by thousands of end users.