It is possible to use the NetBeans 6.8 profiler to profile the RI running with the phoneME Advanced VM. 

NOTE: Netbeans 7.1 profiler agent classes have a dependency on classes not available in the CVM.  When the Netbeans bug is resolved, this page will be updated with information on how to use a more recent version of Netbeans.  A bug was filed and the core issue was fixed, although according to the bug the Sampling support (new in Netbeans 7.1) will require more work.  Netbeans 7.1.2 does not yet work.  Profiling with Netbeans 7.2 should work.  Bug: http://netbeans.org/bugzilla/show_bug.cgi?id=209445

All profiling features are available except for the ability to generate heapdumps, which are only available with Netbeans profiler when using a Java 5 or newer JVM.

Configure NetBeans and generate a 'remote pack':

Install and start NetBeans 6.8 from http://netbeans.org/community/releases/68/

Update NetBeans and plugins (Help menu, Check for Updates, install any updates, and restart NetBeans)

Create the profiler 'remote pack'

  • Profile, attach profiler
  • Select a profiling option (Monitor, CPU or Memory)
  • Click 'attach' button
  • Target: Application
  • Attach method: remote
  • Click 'next' button
  • hostname: your -network- IP address (do not use 127.0.0.1, use your actual IP network address)
  • Host OS & VM
  • Click 'next' button
  • Click 'next button again
  • Java platform drop down box: CVM
  • Click 'generate remote pack' button
  • Save the remote pack zip file to somewhere accessible
  • Dialog appears saying 'remote pack was saved to (path and filename), click OK
  • Don't click 'finish yet' - we'll click 'finish' once we have set up the RI with this profiler
Copy and unzip the NetBeans remote pack to the RI directory structure:
  • Copy remote pack folder to $OCAPROOT/bin/$OCAPTC/env/[remotepackfoldername] - netbeansremotepack in the configuration examples below
  • Unzip the remote pack zip file in its copied location (resulting in lib and bin folders and a README.txt in the folder along with the zip file)
  • rename profilerinterface.dll to libprofilerinterface.dll
  • Make sure all dlls are set as executable (chmod +x)
Configure the RI to 'calibrate' the CVM by modifying mpeenv.ini:
  • VMOPT.0=-Djava.class.path=/syscwd/netbeansremotepack/lib/jfluid-server.jar;/syscwd/netbeansremotepack/lib/jfluid-server-cvm.jar;/syscwd/sys/ocap-classes.jar;/syscwd/sys/ocap-rez.jar;/syscwd/sys/support.jar;/syscwd/qa/ocap-test.jar;/syscwd/qa/support-test.jar;/syscwd;/syscwd/usr;/syscwd/apps/eas
  • MainClassArgs.0=org.netbeans.lib.profiler.server.ProfilerCalibrator
    • VMOPT.1=-Djava.library.path=/syscwd/../bin;/syscwd/netbeansremotepack/lib/deployed/cvm/(os folder name)
    • VMOPT.9=-Dos.name=Windows XP (or Linux)
Run the RI to generate calibration information:
  • ./runRI.sh -tunetest -setup should work fine
  • the log should show that calibration information was generated (RI.Stack.StdOut- Starting calibration.. followed by Calibration performed successfully)
  • stop the RI
  • there is no need to copy the calibration information
  • Restore the mpeenv.ini MainClassArgs entry to point back to org.cablelabs.impl.ocap.OcapMain
  • Restore the classpath setting
  • Profiler data should be written to $OCAPROOT/bin/$OCAPTC/env/.nbprofiler/machinedata.cvm - copy this file to $USERHOME/.nbprofiler if you get a message that calibration information has not been generated
Configure the RI to load the profiling agent:
  • add netbeans package as an ocap extension to final.properties
    • OCAP.extensions=org.cablelabs.debug;org.netbeans.lib.profiler.server
  • Define the agentpath entry in mpeenv.ini
    • VMOPT.8=-agentpath:netbeansremotepack\lib\deployed\cvm\windows\profilerinterface.dll=/c/work/trunk/ri/RI_Stack/bin/CableLabs/simulator/Win32/debug/env/netbeansremotepack\lib,5140
    • NOTE: the above entry (on Windows) needed for the fully-qualified path to be in the form /c/path/etc/etc/, and the first part of the agentpath contains back slashes (forward slashes on linux)
To begin profiling:
  • Start the RI
    • You should see a message in the log that it is waiting on port 5140
  • Attach the NetBeans profiler
  • No labels