Performing baseline metrics differentials
Linux/UNIX

RSM Version 6.63
Date: 7-24-2005

Example Source Code: rsm_example_diff_files.tar.gz


Step 1:

Verify the operation of RSM and understand work file naming and directories.

We will assume for you RSM product is installed in /usr/bin/rsm

To execute RSM we will use literal path/file names. For Linux we use the precompiled binary rsm.lnx. For your UNIX system use the binary name for which you recompiled RSM to.

# /usr/bin/rsm/rsm.lnx

This command shows the RSM Header and syntax. Note your license number is shown along with your license and maintenance dates.

Under the Linux operating system, the precompiled RSM binary is named rsm.lnx. When you have the Universal UNIX version of RSM you can name RSM to any name you desire. Some users users use just rsm or place a file extension relative to the operating system such as rsm.sol for Sun Solaris or rsm.hpux for HPUX etc..

IMPORTANT!

When the -wd flag is used to perform line differentials, RSM creates dif files for each source code file. These files are stored into a directory named after the work file.

Work File Name: -w"file dat /usr/projects/metrics/baseline1.1.dat"
Work Dif Directory: /usr/projects/metrics/baseline1.1.dat.dif

Dif files are named relative to the work file name. If literal /path/filename is used for the work file then the dif file names are the most portable through the file system.

Work File Name: -w"file dat /usr/projects/metrics/baseline1.1.dat"
Work Dif File: /usr/projects/metrics/baseline1.1.dat.dif/MyProject_ProjectRelease1_1_HTTPSoapClient_java.dif

This implies that work file differential extraction can be performed from any location in the file system. This is preferred approach to using work files and work differential extraction.

If you use a relative work file name, then you must be in the directory where the work file will be stored and differential extraction will be processed.

Current Working Directory: /usr/projects/metrics
Work File Name: -w"file dat baseline1.1.dat"
Work Dif File: baseline1.1.dat.dif/MyProject_ProjectRelease1_1_HTTPSoapClient_java.dif

You must be in this relative directory to perform work file differential extraction.

We suggest always using literal naming to eliminate the problems of relative directory locations.


Step 2:

Identify the location of the baseline trees for both baselines.

/usr/projects/MyProject/ProjectRelease1.1
/usr/projects/MyProject/ProjectRelease1.2

We wish to determine the diffs between release 1.1 and 1.2

When using clearcase or similar CM tool, you will need to set your view to the proper specification so that you can see the correct file versions.


Step 3:

Make a directory for our metrics files.
# mkdir /usr/projects/metrics


Step 4:

Create work files for the historical baseline. RSM work files characterize the baseline so that differentials can be performed in a separate step or
at a later time. This characterization captures the baseline metrics as of the work file date/time creation. The baseline can then evolve and future
work files can be created to perform historical metrics.

We will use the following switches

/usr/bin/rsm/rsm.lnx Literal path to rsm executable
-H HTML output
-O"/usr/projects/metrics/base1.1_workfile_report.html" Output path and file name for the report
-wd Line by line differentials, do not use for basic loc size differentials
-w"create /usr/projects/MyProject/ProjectRelease1.1" Create a work file specifying the top of the baseline tree
-w"file dat /usr/projects/metrics/baseline1.1.dat" Naming the work file
-r"c,h,cpp,java /usr/projects/MyProject/ProjectRelease1.1" Recusive descent of the baseline tree using c, c++ and Java files

RSM Command Line: (Contents are all on one line)

# /usr/bin/rsm/rsm.lnx -H -O"/usr/projects/metrics/base1.1_workfile_report.html" -wd -w"create /usr/projects/MyProject/ProjectRelease1.1" -w"file dat /usr/projects/metrics/baseline1.1.dat" -r"c,h,cpp,java usr/projects/MyProject/ProjectRelease1.1"

Example Output:

RSM using output file: /usr/projects/metrics/base1.1_workfile_report.html
Acquiring Files
Building File List - Status(.) 10 files

Processing 8 Files - Status(.) 10 Files

Processing Files Complete
Reporting and Post Processing
RSM Processed - 8 Files

This lengthy command can be simplified is you use shell scripts and shell variables. Any UNIX manual will show you how to write shell scripts.


Step 5:

Repeat the process for the present or latest baseline.

# /usr/bin/rsm/rsm.lnx -H -O"/usr/projects/metrics/base1.2_workfile_report.html" -wd -w"create /usr/projects/MyProject/ProjectRelease1.2" -w"file dat /usr/projects/metrics/baseline1.2.dat" -r"c,h,cpp,java /usr/projects/MyProject/ProjectRelease1.2"

Example Output:

RSM using output file: /usr/projects/metrics/base1.2_workfile_report.html
Acquiring Files
Building File List - Status(.) 10 files

Processing 9 Files - Status(.) 10 Files

Processing Files Complete
Reporting and Post Processing
RSM Processed - 9 Files


Step 6:

Now that both baselines are characterized, we can extract the differentials between the baselines at any time regarless of how the files changes.

Using the following command and RSM options;

/usr/bin/rsm/rsm.lnx Literal path to rsm executable
-H HTML output
-O"/usr/projects/metrics/diff_1.1_1.2.html" Output path and file name for the report
-wd Line by line differentials, do not use for basic loc size differentials
-wd -w"x /usr/projects/metrics/baseline1.1.dat, /usr/projects/metrics/baseline1.2.dat" Baseline differentials extracted from the old and newer work files

# /usr/bin/rsm/rsm.lnx -H -O"/usr/projects/metrics/diff_1.1_1.2.html" -wd -w"x /usr/projects/metrics/baseline1.1.dat, /usr/projects/metrics/baseline1.2.dat"

Example Output:

RSM using output file: /usr/projects/metrics/diff_1.1_1.2.html
Work Differential Extraction
Loading Report Configuration: /usr/bin/rsm/rsm_workdiff.cfg
Loading Historical Workfile: /usr/projects/metrics/baseline1.1.dat
Loading Present Workfile: /usr/projects/metrics/baseline1.2.dat

Reporting Differentials
8 Historical Work Files
9 Present Work Files
Work File Differential Extraction Complete


Step 7:

Load and show the output report using your web browser. Note the path/file name used for the output file.

The results of this processing result in the following files:

[root@localhost metrics]# ls -la
total 84
drwxr-xr-x 4 root root 4096 Jul 24 11:07 .
drwxr-xr-x 4 root root 4096 Jul 24 11:03 ..
-rw-r--r-- 1 root root 3988 Jul 24 11:07 base1.1_workfile_report.html
-rw-r--r-- 1 root root 3988 Jul 24 11:07 base1.2_workfile_report.html
-rw-r--r-- 1 root root 1424 Jul 24 11:07 baseline1.1.dat
drwx------ 2 root root 4096 Jul 24 11:07 baseline1.1.dat.dif
-rw-r--r-- 1 root root 1602 Jul 24 11:07 baseline1.2.dat
drwx------ 2 root root 4096 Jul 24 11:07 baseline1.2.dat.dif
-rw-r--r-- 1 root root 6789 Jul 24 11:07 diff_1.1_1.2.html
-rw-r----- 1 root root 1602 Jul 24 11:07 workfile.dat

base1.1_workfile_report.html RSM Report from creating the baseline 1.1 work file
base1.2_workfile_report.html RSM Report from creating the baseline 1.2 work file
baseline1.1.dat Work file for baseline 1.1
baseline1.2.dat Work file for baseline 1.2
baseline1.1.dat.dif Directory of baseline 1.1 dif files
baseline1.2.dat.dif Directory of baseline 1.2 dif files
diff_1.1_1.2.html RSM Report for baseline differentials
workfile.dat Default RSM work file

Any errors in the process will show in the output report.


M2 Support Team
support@mSquaredTechnologies.com