JProfiler's offline profiling capability allows you to run profiling sessions from
the command line without the need for starting JProfiler's GUI front end. Offline profiling
makes sense if you want to
-
perform profiling runs from a scripted environment (e.g. an
ant build file)
-
save snapshots on a regular basis for QA work
-
profile server components on remote machines via slow network connections
Performing an offline profiling run for your application is analogous to
remote profiling with special library parameters
passed to the profiling agent VM parameter
-agentpath:[path to jprofilerti library] :
-
offline switch
Passing offline as a library parameter enables offline profiling.
In this case, a connection with JProfiler's GUI is not possible.
-
session ID
In order for JProfiler to set the correct profiling settings, a corresponding session
has to be configured in JProfiler's GUI front end. The ID of that session has to
passed as a library parameter: 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 file location (optional)
The config file that is read for extracting the session with the specified ID has to
be passed via config={path to config.xml} . The config file is located in
the .jprofiler8 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}/.jprofiler8/config.xml.
Example:
A typical invocation for offline profiling will look like this:
java "-agentpath:C:\Program Files\jprofiler7\bin\windows\jprofilerti.dll=offline,id=109,config=C:\Users\bob\.jprofiler8\config.xml"
"-Xbootclasspath/a:C:\Program Files\jprofiler7\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.
|