Performing baseline metrics differentials
Windows Command Line

RSM Version 6.63
Date: 7-24-2005

Example Source Code: rsm_example_diff_files.zip


Step 1:

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

The RSM installation will by default install to:

To execute RSM we will use literal path/file names. For windows command line operation we need to use quotation marks around any file name or path name with spaces.

To open a command shell [Start] - [run] - [cmd]

Under the Windows operating system, the precompiled RSM binary is named rsm.exe.

Issue the command to execute RSM from the command line.

Note that the RSM license shows the "Shareware License". This is the license that comes with the free download and will only process 10 source code files. Copy your rsm.lic file that was sent with your software license distribution into this directory.

Rerun the RSM command.

Now the RSM license indicates your licensed company name, license number, license date, maintenance date and run date.

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 c:\projects\metrics\baseline1.1.dat"
Work Dif Directory: c:\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 c:\projects\metrics\baseline1.1.dat"
Work Dif File: c:\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: c:\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.

c:\projects\MyProject\ProjectRelease1.1
c:\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:
We make a directory for our metrics files.
# mkdir c:\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

c:\Program Files\MSquared\M2 RSM\rsm.exe Literal path to rsm executable
-H HTML output
-O"c:\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 c:\projects\MyProject\ProjectRelease1.1" Create a work file specifying the top of the baseline tree
-w"file dat c:\projects\metrics\baseline1.1.dat" Naming the work file
-r"c,h,cpp,java c:\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)

c:\> "c:\Program Files\MSquared\M2 RSM\rsm.exe" -H -O"c:\projects\metrics\base1.1_workfile_report.html" -wd -w"create c:\projects\MyProject\ProjectRelease1.1" -w"file dat c:\projects\metrics\baseline1.1.dat" -r"c,h,cpp,java c:\projects\MyProject\ProjectRelease1.1"


Step 5:

We repeat the process for the present or latest baseline.

c:\> "c:\Program Files\MSquared\M2 RSM\rsm.exe" -H -O"c:\projects\metrics\base1.2_workfile_report.html" -wd -w"create c:\projects\MyProject\ProjectRelease1.2" -w"file dat c:\projects\metrics\baseline1.2.dat" -r"c,h,cpp,java c:\projects\MyProject\ProjectRelease1.2"


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"c:\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 c:\projects\metrics\baseline1.1.dat, c:\projects\metrics\baseline1.2.dat" Baseline differentials extracted from the old and newer work files


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:

base1.1_workfile_report.htm RSM Report from creating the baseline 1.1 work file
base1.2_workfile_report.htm 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.htm RSM Report for baseline differentials
workfile.dat Default RSM work file

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

Batch File Programming:

All of these commands can be quite a lot of typing so try batch file programming.

The following Batch Program executes all the above commands then executes the Internet Explorer to show the differential report. You can download this tutorial: baseline_metrics

rem "baseline_metrics.bat"
@echo off
echo Batch File Begin

rem "setup some shell variables"

set RSMEXE=c:\Program Files\MSquared\M2 RSM\rsm.exe
set BASE1.1=c:\projects\MyProject\ProjectRelease1.1
set BASE1.2=c:\projects\MyProject\ProjectRelease1.2
set DAT1.1=c:\projects\metrics\baseline1.1.dat
set DAT1.2=c:\projects\metrics\baseline1.2.dat
set WORK1.1RPT=c:\projects\metrics\base1.1_workfile_report.htm
set WORK1.2RPT=c:\projects\metrics\base1.2_workfile_report.htm
set DIFFRPT=c:\projects\metrics\diff_1.1_1.2.htm

echo.

echo "Process the work files for baseline 1.1"
echo.
"%RSMEXE%" -H -O"%WORK1.1RPT%" -wd -w"create %BASE1.1%" -w"file dat %DAT1.1%" -r"c,h,cpp,java %BASE1.1%"
echo.
echo.

echo "Process the work files for baseline 1.2"
echo .
"%RSMEXE%" -H -O"%WORK1.2RPT%" -wd -w"create %BASE1.2%" -w"file dat %DAT1.2%" -r"c,h,cpp,java %BASE1.2%"
echo.

echo "Process Differentials"
echo.
"%RSMEXE%" -H -O"%DIFFRPT%" -wd -w"x %DAT1.1%, %DAT1.2%"

echo.
"%DIFFRPT%"

pause

 


M2 Support Team
support@mSquaredTechnologies.com