The CVM Inspector is a set of utility functions and a shell script included with phoneME Advanced which can assist in diagnostics and inspection of the state of the RI's JVM.  Along with other utility functions, CVM Inspector can generate heap dumps and deltas between heap dumps.

For more information on CVM Inspector, see these blog posts:

To configure the RI to generate heap dumps, build the RI's JVM with the CVM Inspector enabled and then enable the 'server' mode of the CVM Inspector, which accepts socket connections from a CVM Inspector client and allows commands to be ran.

To build the RI JVM with the CVM Inspector enabled, modify $OCAPROOT/target/$OCAPTC/buildrules.properties:

  • Add CVM_INSPECTOR=true to build.jvm.BUILD_TARGET
  • Enable building of the JVM if necessary by commenting out the build.jvm.exclude=true line
  • Build the jvm by running 'ant' from $OCAPROOT

The CVM Inspector is also built when CVM_DEBUG is set to true, but I ran in to issues with the JVM when running CVM Inspector on a DEBUG build of the JVM.

To configure the RI to enable CVM Inspector:

  • Copy testclasses.zip (was in $OCAPROOT/jvm/phoneME/cdc/build/mpe-x86-linuxgcc on Linux) to $OCAPROOT/bin/$OCAPTC/env/sys (the CVM Inspector classes are in testclasses.zip)

Modify mpeenv.ini:

  • Add /syscwd/sys/testclasses.zip to the VMOPT.0=-Djava.class.path entry
  • MainClassArgs.0=cvmsh
  • MainClassArgs.1=--X
  • MainClassArgs.2=verbose;port=2000;startServer
  • MainClassArgs.3=org.cablelabs.impl.ocap.OcapMain

Run the RI.  The verbose output should result text describing that cvmsh is listening on port 2000.

Run the cvmclient. The client can be ran using any standard JVM.

  • java -classpath testclasses.zip cvmclient -host hostIP -port 2000

The commands are case-sensitive and sometimes take a little while to take effect.  When creating heap dumps, run GC first.  Cybergarage events come in at arbitrary times so XML parser-related objects may show up in the delta even when unexpected.

Example commands for generating a heap dump diff:

>gc
>captureHeapState
(perform some action in the RI for which you'd like to evaluate a heap diff)
>gc
>captureHeapState
>listHeapStates
>compareHeapState 1 2

  • No labels