Table of Contents
This chapter explains how to collect profile data with MJP. The first step to using MJP is collecting data. To collect data, the application you want to profile must be executed with the profiler agent enabled. The profiler agent can be enabled in the following ways:
Invoking your application from the MJP GUI.
Specifying the option -Xrunmjp on the JVM command line when invoking the application to be profiled.
Specifying the option -Xrunmjp in the _JAVA_OPTIONS environment variable if using a Sun JVM or the IBM_JAVA_OPTIONS environment variable if using an IBM JVM before invoking the application to be profiled.
The first method requires the least knowledge, but is not always the most convenient. Which one you use is up to you. I will detail each of these below.
Start the MJP GUI. On Windows, this can be done by executing mjp.exe or by double clicking on %MJP_HOME%/lib/mjpgui.jar in Windows Explorer. On Linux, this can be done by executing mjp.
Select
-> .Enter the full path to the executable used to invoke your application into the Executable field or click on the button and use the file chooser. This may be a JVM (e.g. C:/j2sdk1.4.0/bin/java.exe), a DOS batch script that wraps a JVM, or anything else that eventually invokes a JVM (e.g. mjp.exe). This works because MJP GUI makes use of the environment variables _JAVA_OPTIONS and IBM_JAVA_OPTIONS to invoke the MJP profiler agent. As long as each process passes these environment variables to its child, the profiler agent will be invoked and data collection will take place.
Enter the required command line arguments for your application into the Command Line Arguments field.
Enter the full path of the directory you would like MJP to set the current working directory to before it executes your application or click on the
button and use the file chooser.If your application requires environment variables to be set, click on the Environment button and use Edit Environment Variables dialog to specify them.
Click on the Run button.