Running the application on the local computer and generating statistics for dynamic instrumentation

After you dynamically instrument you classes and generate probescript and baseline files on your local computer, you can generate code coverage statistics for your application.

About this task

To generate code coverage statistics outside the workbench on your local computer for dynamically instrumented classes, you must correctly configure the runtime environment for your Ant script.
The JVM arguments needed in your Ant script are in the following table:
JVM argument parameter Description
<jvmarg value="-Dcoverage.out.file=<absolute path to output file>" /> This is the output file of the coverage statistics.
<jvmarg value="-Xbootclasspath/a:<path to code coverage engine>/com.ibm.rational.llc.engine_<date>/RLC.jar" /> Because the code has been instrumented with callbacks to the code coverage data collection engine, the RLC.jar file needs to be on the classpath at runtime.
<jvmarg value="-agentpath:<path to JPIBootLoader>=JPIAgent:server=standalone,file=;ProbekitAgent:ext-pk -BCILibraryName=BCIEngProbe,ext-pk-probescript=<path to probescript> "/> This argument registers the instrumentation engine with the JVM so that Code Coverage can instrument the classes when loaded.

The variable <path to probescript> is the path to the probescript file created in the previous task when you instrumented your classes.

The value for the variable <path to JPIBootLoader> depends on your environment:
  • Windows: <product shared installation directory>\plugins\org.eclipse.tptp.platform.jvmti.runtime_<date>\agen t_files\win_ia32\JPIBootLoader
  • Linux:<product shared installation directory>/plugins/org.eclipse.tptp.platform.jvmti.runtime_<date>/agen t_files/linux_ia32/libJPIBootLoader.so

Example

In the following example, an Ant call is made the runs the application and generates code coverage statistics:
<target name="execute">
	<jar basedir="VehicleProject\bin" destfile="VehicleProject.jar" />
	<java classname="com.ibm.vehicles.tests.MainTest" fork="true"
	newenvironment="true">
	<jvmarg
		value="-Dcoverage.out.file=VehicleProject.coveragedata" />
	<jvmarg value="-Xbootclasspath/a:<product shared installation directory>/plugins/com.ibm.rational.llc.engine_<date>/RLC.jar" />
	<jvmarg value="-agentpath:<path to
		JPIBootLoader>=JPIAgent:server=standalone,file=;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=<path to probescript
		file>"/>
<classpath>
	<pathelement path="VehicleProject.jar" />
</classpath>
</java>
</target>

Feedback