Previous Next         Current Page: NeXtMidas User's Guide / Third-Party Compatibility / Profilers / NetBeans Profiler
FAQs   
Release Information   
Getting Help   
Basic Concepts   
Result Parameters   
XML Support   
Files   
System Operation   
Macros   
Applets and WebStart   
Graphics   
X-Midas Interoperability   
Third-Party Compatibility   
   - Apache   
   + Web Browsers   
   + WebStart   
   - Profilers   
      - NetBeans Profiler   
      - JProbe   
   - NetBeans   
   - JBuilder   
   - Intel Fortran Compiler   
   - Swig   
Installation and Customization   
Glossary   





Using the NetBeans Profiler with NeXtMidas

Note: This document was written using NetBeans 4.0. Please see the NeXtMidas Training for examples using NetBeans 5.0. WARNING: Please see Profilers for important notes about using profilers with NeXtMidas.

Installing the NetBeans Profiler

NOTE: This section assumes that you have already configured NetBeans for use with NeXtMidas and have already added NeXtMidas as a project in NetBeans (please see NetBeans for details).

Please see the NetBeans Profiler web page (http://profiler.netbeans.org/) for installation instructions. You will need to install the following:

  • Java & NetBeans - Generally, both should be installed together from the JDK+NetBeans bundle available from Sun Microsystems (http://java.sun.com/).
  • NetBeans Profiler Module - Available at http://profiler.netbeans.org/.
  • JDK for compiling NeXtMidas
    • Java 1.4.2 - The standard Java 1.4.2 J2SDK.
    • Java 5.0 - Java 5.0 update 4 JDK or later (may be included with NetBeans - see above).
  • Instrumented JVM for running NeXtMidas*
    • Java 1.4.2 - Use the JFluid VM included with the NetBeans Profiler.
    • Java 5.0 - Use the standard Java VM included with the JDK.

* Take care to note that the NetBeans Profiler has very specific list of Java VM's that it is compatible with, see http://profiler.netbeans.org/ for details. (The NetBeans Profiler is not compatible with Java 5.0 prior to update 4).

The JFluid VM is an instrumented Java 1.4.2 VM from Sun Labs. Java 5.0 (update 4 or later) has the instrumentation built in to the standard Java VM included with the JDK.

NOTE: In many cases NetBeans will be using a different version of Java than that used by NeXtMidas; this is normal, even when using the NetBeans Profiler.

NetBeans should run with the version of Java it was installed with (this is the default for NetBeans).

Starting a Profiling Session

Running NeXtMidas with the profiler requires a few extra steps that are not necessary for the normal operation of NeXtMidas. This process will require the use of three shell sessions (Shell 1, Shell 2, Shell 3) if you have more than one monitor it will be helpful if the first two shell sessions are on one monitor and the third session is on another monitor.

  1. (Shell 1) Build all of NeXtMidas and build all option trees. Make sure to use the correct JDK version:
    • Java 1.4.2 - Use the standard Java 1.4.2 J2SDK to build, but use the JFluid VM to run (see below).
    • Java 5.0 - Use the standard Java 5.0 JDK (update 4 or later) to build and run.
  2. (Shell 2) Prevent NeXtMidas from using any native code for the shell and other NeXtMidas library tasks (this will disable any of the special shell functions such as use of the arrow keys). Also force all OS commands to be run inside NeXtMidas (this will prevent commands such as cd .. from working).
    $ setenv NM_USER_JVM_FLAGS "-DNONATIVE=TRUE -DNOEXTERNAL=TRUE"
    This step is optional but is included since the native conversions can result in more confusing output from the profiler and the accidental use of OS commands (such as a typo on the NeXtMidas command line) can cause the profiler to abort.
  3. (Shell 2) Java 1.4.2 Users Only: Set JAVAHOME to point to the JFluid JVM that will be used when running NeXtMidas.
    $ setenv JAVAHOME <modules>/profiler-ea-vm/
    Where <modules> is the absolute path to the NetBeans modules directory that contains the NetBeans Profiler module (this is typically /opt/netbeans-4.1/profiler1/modules/).

    Test the setup by running:
    $ $JAVAHOME/bin/java -version
    It should print out the version information for the JFluid JVM that has a line stating "JFluid Client VM".
  4. End all running instances of NeXtMidas on your system, if any.
  5. (Shell 2) Start NeXtMidas and get to the nM> prompt.
    $ nmstart
    $ nm
    nM>
  6. (Shell 3) Start NetBeans.
  7. (NetBeans) Once NetBeans is started go to the Profile menu and select Attach Profiler....
  8. (NetBeans) In the Specify Attach Settings set Attach to to "Application", set Running on to "This Computer", Attach Settings to "Dynamic Attachment"/"Select Running VM" and set Working Directory to your home directory. Then in the Select Running VM pull-down select the VM that is running NeXtMidas. Then ckick "Ok".
  9. (NetBeans) In the Attach and Profile select the type of profile you wish to run and click "Attach".

    This should start the profiler. (Starting the profiler may cause the Java VM running NeXtMidas (Shell 2) to print out information about the current state of the VM - this is normal, just hit enter once or twice to bring the nM> prompt back up.)
  10. (Shell 2) Run your NeXtMidas application from the nM> prompt.

For details on how to use the profiler, once started, please see the NetBeans Profiler web site (http://profiler.netbeans.org/).

NOTE: If the NetBeans Profiler or NeXtMidas session get stuck (problems connecting the Profiler to the VM, one of them hangs/crashes, etc.) it is best to restart both NeXtMidas and the NetBeans (all of NetBeans, not just the Profiler).