 |
While this code seems stable enough to demonstrate profiling, it is still pre-release quality. The changes provided here are in
NetBeans source code and will most likely undergo changes when integrated by the NetBeans team.
Running CVM with the NetBeans profiler
In order to run CVM with the NetBeans profiler (version 6.0) you will need to add/replace some NetBeans libraries.
I'll just run through a typical scenario. First install Netbeans 6.0 from here.
Cd into the install dir (e.g. C:\Program Files\NetBeans 6.0) then cd
into profiler2. Unzip netbeans-pmea-profiler.zip . Caveat emptor: it
replaces an existing jar file (lib/jfluid-server.jar), save the original one if so inclined.
These examples show windows version, linux is similar.
First you must build CVM with JVMTI enabled by adding CVM_JVMTI=true to your build command line.
Next, calibrate the profiler:
bin\cvm "-Dsun.boot.library.path=c:\program files\netbeans 6.0\profiler2\lib\deployed\cvm\windows"
"-Xbootclasspath/a:c:\program files\netbeans 6.0\profiler2\lib\jfluid-server.jar;c:\program files\netbeans
6.0\profiler2\lib\jfluid-server-cvm.jar" org.netbeans.lib.profiler.server.ProfilerCalibrator
I set up a project ( attached) in NetBeans using the existing source to
the scimark2 benchmark.
Run CVM (using scimark2 benchmark that is a project in NetBeans)
bin\cvm "-agentpath:c:\program files\netbeans 6.0\profiler2\lib\deployed\cvm\windows\profilerinterface.dll=
c:\program files\netbeans 6.0\profiler2\lib,5140
-Xbootclasspath/a:f:\javame-oss-test\trunk\build\win32-x86-vc8\btclasses.zip
-classpath j:\projects\scimark2\build\classes jnt.scimark2.commandline
CVM is now waiting for a connection from Netbeans profiler.
Run NetBeans and select Profile->Attach... menu. Select the correct project (scimark2) from the drop down box at the top.
Click on 'CPU' and click on 'Analyze Performance'. Select 'Entire application' and for the Filter setting select 'Profile only project
classes'. Click on the 'change' link near the bottom of the dialog to setup the IP address of the machine that you will attach to. Don't use 'localhost' it won't work
right. If CVM is running on the same machine use the IP address of the machine. Eventually you'll get back to the Attach profiler
screen and if all is correct, press the 'Attach' button. You will probably receive an Error 79 message box, click OK and ignore it
(Netbeans attempts to redefine a couple of romized classes even though they should be filtered out). In the left pane you can
click on VM Telemetry to get some info about memory, threads and GC. You can click on Live Results to get live updates back
from the VM. Eventually program finishes and you'll be able to look at the data gathered by the profiler either by call tree,
hotspots and so on.
There is a set of windows-arm dlls in lib/deployed/cvm/windows-arm. This will allow you to profile on a wm5 device/emulator.
You would typically have to copy the appropriate dlls, zips and jars to the device under test but the general process should be
the same. I have run the profiler against the wm5 emulator image of CVM. A typical command line would be:
bin/cvm -agentpath:\\{host}\src\netbeans-6.0\nbbuild\netbeans\profiler2\lib\deployed\cvm\windows\profilerinterface_g.dll=\\{host}\src
\netbeans-6.0\nbbuild\netbeans\profiler2\lib,5140 "-Xbootclasspath:\btclasses.zip;\foundation.zip" -classpath \scimark2\build\classes jnt.scimark2.commandline
Building NetBeans:
Download the 6.0 sources via CVS as described here
As noted on the above page, I updated the nbbuild/user.build.properties file with
build.compiler=extJavac
javac.compilerargs=-J-Xmx512m
I also added :
cluster.config=j2ee
which forces the build to default to the j2ee cluster which is what the profiler depends on due to J2EE? integration.
Then at the top level of the tree I just do:
ant -f nbbuild/build.xml
On my 2.x Ghz linux machine it takes about 20 minutes. You should end up with a usable build in nbbuild/netbeans and you can just run nbbuild/netbeans/bin/netbeans (linux) or nbbuild/netbeans/bin/netbeans.exe (win32).
You can now overlay the sources from this zip . Note that the profiler/libs/jfluid/build.xml has a hard coded path to the CVM classes. Update these to point to your CVM classes (I should fix it so it doesn't need this. Probably setup a property in the user.build.properties file).
You'll have to build the native libs by hand first. Cd into the profiler/libs/jfluid/native/build directory. Build the linux and windows libs:
On linux:
export CVM_HOME=< path to top of cvm source tree >
sh buildnative-linux-cvm.sh
On win32:
set CVM_HOME=< path to top of cvm source tree >
buildnative-windows-cvm.bat
Rerun the build and it should rebuild what needs to be rebuilt and you'll end up the proper libs and dlls in the nbbuild/netbeans/profiler2/lib directory. These are the dlls and jars you would reference when running CVM for profiling.
-- Main.billp - 19 May 2008
|