Manually Adding The Profiling Agent


  Please look at the help page on starting remote sessions for list of options on how to set up remote profiling without manual modification of the Java start command. In case you need to modify the Java command manually, please see the instructions below.
  To permanently start your application or application server in such a way that you can connect to it with a remote session from JProfiler's GUI front end, add a VM parameter to your startup command that tells the VM to load the profiling agent:
  -agentpath:[full path to JProfiler library]=[agent parameters]
or, without agent parameters:
  -agentpath:[full path to JProfiler library]

For IBM JVMs, you also have to add the VM parameter -Xshareclasses:none.

The place holders [path to JProfiler library] and [agent parameters] are to be replaced by:

  • [full path to JProfiler library]

    You have to specify the absolute path to the native JProfiler agent library. The path to the agent library depends on the operating system and the architecture of the JVM (not the architecture of the operating system). All agent libraries listed below are relative to the JProfiler installation directory:

    Windows, 32-bitbin\windows\jprofilerti.dll
    Windows, 64-bitbin\windows-x64\jprofilerti.dll
    Linux x86, 32-bitbin/linux-x86/libjprofilerti.so
    Linux x86, 64-bitbin/linux-x64/libjprofilerti.so
    Linux PPC, 32-bitbin/linux-ppc/libjprofilerti.so
    Linux PPC64, 64-bitbin/linux-ppc64/libjprofilerti.so
    Solaris SPARC, 32-bitbin/solaris-sparc/libjprofilerti.so
    Solaris SPARC, 64-bitbin/solaris-sparcv9/libjprofilerti.so
    Solaris x86, 32-bitbin/solaris-x86/libjprofilerti.so
    Solaris x86, 64-bitbin/solaris-x64/libjprofilerti.so
    Mac OS, 32 and 64-bitbin/macos/libjprofilerti.jnilib
    HP-UX PA_RISC, 32-bitbin/hpux-parisc/libjprofilerti.sl
    HP-UX PA_RISC, 64-bitbin/hpux-parisc64/libjprofilerti.sl
    HP-UX IA64, 32-bitbin/hpux-ia64n/libjprofilerti.so
    HP-UX IA64, 64-bitbin/hpux-ia64w/libjprofilerti.so
    AIX, 32-bitbin/aix-ppc/libjprofilerti.so
    AIX, 64-bitbin/aix-ppc64/libjprofilerti.so
    FreeBSD x86, 32-bitbin/freebsd-x86/libjprofilerti.so
    FreeBSD x86, 64-bitbin/freebsd-x64/libjprofilerti.so
  • [agent parameters]

    If you immediately attach with a remote session from the JProfiler GUI on the default port, you do not have to specify any agent parameters. For non-default ports, deferred profiling and offline profiling, the following agent parameters are available:

    • port=nnnnn chooses the port on which the agent listens for remote connections. Be sure to use the same value in JProfiler's GUI front end.
    • address=[IP address] chooses the IP address that the socket for the remote connection should bind to. By default, the agent binds the socket to all network interfaces. If this is not desirable for security reasons, you should use this option.
    • nowait tells the profiling agent to let the JVM start up immediately. Usually, the profiled JVM will wait for a connection from the JProfiler GUI before starting up. For 1.5 JVMs or IBM JVMs, the parameters id has to be supplied as well. Optionally, you can also supply the config parameter in that case.
    • offline enables the offline profiling mode. You cannot connect with the GUI front end when using the offline profiling mode. The parameters id has to be supplied as well. Optionally, you can also supply the config parameter.
    • id=nnnnn chooses the session used with the offline or nowait parameters. This is only required for 1.5 JVMs or IBM JVMs.
    • config=[path to JProfiler config file] supplies the path to JProfiler's configuration file. This parameter is only relevant for offline profiling and profiling with the nowait parameter (in the latter case only if the profiled JVM has a version of 1.5 or is an IBM JVM). If config is not specified for those cases, the profiling agent will attempt to load the config file from its standard location. Reading the config file is necessary to retrieve profiling settings that have to be known at startup for the session that was selected with the id parameter.

    Multiple parameters are separated by commas such as in
    "offline,id=172,config=~/.jprofiler10/config.xml".

    In addition to the standard parameters above, there are the following trouble-shooting and debugging parameters:

    • jniInterception enables the detection of object allocations via JNI calls. This parameter is only relevant for Java 1.5.0_00, 1.5.0_01 and 1.5.0_02. This feature is enabled by default for Java 1.5.0_03 and higher. Due to a bug in Java 1.5.0_02 and lower, it is disabled when profiling with those releases. Please make sure not to use -Xcheck:jni when you specify this parameter for Java 1.5.0_02 and lower.
    • stack=nnnnn sets the maximum stack size for dynamic instrumentation. Only change this parameter when JProfiler emits corresponding warning messages. The default value is 10000.
    • samplingstack=nnnnn sets the maximum stack size for sampling. Only change this parameter when JProfiler emits corresponding warning messages. The default value is 200.