Specifying -Xrunmjp on the command line

The MJP profiler agent can be invoked by using the -Xrunmjp command line option of the JVM. For example:

Example 3.1. Invoking the profiler agent from the command line

java -Xrunmjp -Djava.compiler=NONE com.foo.Bar

The -Djava.compiler=NONE option is needed to disable the Just-in-Time Compiler (JIT). There are known problems with JVMPI and the JIT.

There are also a number of options that can be specified on the command line in a comma delimited list following a colon. The syntax is as follows.

java -Xrunmjp[:<option>=<value>, ...]

The following options are available:

suspended

Values: y or n; the default is n

Start the profiler agent in suspended mode.

mode

Values: times or samples; the default is times

Collect data using the times mode or the samples mode.

rate

Values: a integer between 1 and 1000; the default is 100

When collecting data using the samples mode, this determines the sampling rate (samples-per-second).

The following example starts the profiler agent in suspended mode and when the profiler is started via the JNI interface it will collect data by sampling the call stack of each thread in the application 100 times a second.

Example 3.2. Invoking the profiler agent from the command line with options

java -Xrunmjp:suspended=y,mode=samples,rate=100 com.foo.Bar -Djava.compiler=NONE