Performing an offline profiling run for your application is analogous to
remote profiling with special library parameters
passed to the profiling agent VM parameter -Xrunjprofiler
for Java <=1.4.2 (JVMPI) or
-agentpath:[path to jprofilerti library]
for Java >=1.5.0 (JVMTI):
offline
as a library parameter enables offline profiling.
In this case, a connection with JProfiler's GUI is not possible.
id=nnnn
. Your settings in the
profiling settings dialog
are used for offline profiling. The session ID can be seen in the top right corner
of the application settings dialog.
config={path to config.xml}
. The config file is located in
the .jprofiler6 directory in your user home directory (on Windows, the user home
directory is typically c:\Documents and Settings\$USER). If you leave out this
parameter, JProfiler will try to detect the config file location automatically.
A summary of all library parameters is available in the remote session invocation table.
If you profile on a machine where JProfiler is not installed, you will need to transfer the contents of the bin/{your platform} directory as well as the JAR file bin/agent.jar and the config file {User home directory}/.jprofiler6/config.xml.
Example:
A typical invocation for offline profiling with Java >=1.5 (JVMTI) will look like this:
java "-agentpath:C:\Program Files\jprofiler6\bin\windows\jprofilerti.dll=offline,id=109,config=C:\Users\bob\.jprofiler6\config.xml" "-Xbootclasspath/a:C:\Program Files\jprofiler6\bin\agent.jar" -classpath myapp.jar com.mycorp.MyApp
Please study the remote session invocation table to generate the correct invocation for your JVM. Also, please don't forget that the platform-specific native library path has to be modified, just like for remote profiling.
Usage: jpanalyze [options] "snapshot file" ["snapshot file" ...] where "snapshot file" is a snapshot file with a .jps, .hprof, or .dat extension [options] is a list of options in the format -option=value Options: -format=dir|tar|tgz The format in which the analysis data should be stored. Defaults to dir. -removeUnreferenced=true|false If unreferenced or weakly referenced objects should be removed. -retained=true|false Calculate retained sizes (biggest objects). removeUnreferenced will be set to true.
The removeUnreferenced and the retained command line options correspond to the options in the heap walker options dialog.
With triggers, you can define all profiling actions in the JProfiler GUI.
On Java 1.5+, the profiling agent registers an MBean that gives access to all profiling actions. MBeans are configurable in jconsole:
Most methods of the com.jprofiler.api.agent.Controller
are reflected in the MBean. For
documentation of the MBean operations, please see the javadoc of com.jprofiler.api.agent.mbean.ControllerMBean
.
The MBean may also be accessible via configuration facilities of an application server or other tools.
With Java 1.5+, you can use the command line controller tool to interactively record profiling data and save snapshots in a convenient way without having to use a separate MBean viewer.