previous      content      next
Enabling profiling manually

Most likely, you will not need to configure profiling manually. Please first consider the automated ways to enable profiling in your J2SE, J2EE application or applet.

Step 1: Make profiler agent library accessible to the Java Virtual Machine

The action depends on your OS:

Windows, 32-bit Java

add <Profiler Directory>\bin\win32 to the PATH

Windows, 64-bit Java

add <Profiler Directory>\bin\win64 to the PATH

Mac OS X

add <Profiler Directory>/bin/mac to the DYLD_LIBRARY_PATH

Linux x86, 32-bit Java

add <Profiler Directory>/bin/linux-x86-32 to the LD_LIBRARY_PATH

Linux x86, 64-bit Java

add <Profiler Directory>/bin/linux-x86-64 to the LD_LIBRARY_PATH

Solaris SPARC, 32-bit Java

add <Profiler Directory>/bin/solaris-sparc-32 to the LD_LIBRARY_PATH

Solaris SPARC, 64-bit Java

add <Profiler Directory>/bin/solaris-sparc-64 to the LD_LIBRARY_PATH

Solaris x86, 32-bit Java

add <Profiler Directory>/bin/solaris-x86-32 to the LD_LIBRARY_PATH

Solaris x86, 64-bit Java

add <Profiler Directory>/bin/solaris-x86-64 to the LD_LIBRARY_PATH

You can find examples of startup scripts for your platform in <Profiler Directory>/samples

To make sure that Java can load the profiler agent, you can invoke the following command that prints a description of agent parameters:

java -agentlib:yjpagent=help

Step 2: Add -agentlib:yjpagent VM parameter to the command line of Java application

E.g., java -agentlib:yjpagent FooClass

Startup options

-agentlib:yjpagent provides additional startup options. In most cases there's no need to use them.

To profile a J2EE server (especially JBoss!), specify startup option delay=10000

The options are comma separated: -agentlib:yjpagent[=<option>, ...].

Please find detailed description of the startup options here.


java -agentlib:yjpagent FooClass
java -agentlib:yjpagent=onexit=snapshot,dir=c:\MySnapshots FooClass
java -agentlib:yjpagent=usedmem=70 FooClass

Instead of -agentlib:yjpagent, you can specify -agentpath:<full agent library path>. The benefit is that you do not have to alter PATH/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH:

Windows, 32-bit Java:
-agentpath:<Profiler Directory>\bin\win32\yjpagent.dll

Windows, 64-bit Java:
-agentpath:<Profiler Directory>\bin\win64\yjpagent.dll

Linux, 32-bit Java:
-agentpath:<Profiler Directory>/bin/linux-x86-32/

Linux, 64-bit Java:
-agentpath:<Profiler Directory>/bin/linux-x86-64/

Solaris SPARC, 32-bit Java:
-agentpath:<Profiler Directory>/bin/solaris-sparc-32/

Solaris SPARC, 64-bit Java:
-agentpath:<Profiler Directory>/bin/solaris-sparc-64/

Solaris x86, 32-bit Java:
-agentpath:<Profiler Directory>/bin/solaris-x86-32/

Solaris x86, 64-bit Java:
-agentpath:<Profiler Directory>/bin/solaris-x86-64/

Mac OS X:
-agentpath:<Profiler Directory>/bin/mac/libyjpagent.jnilib

previous      content      next