Offline Profiling |
|
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
Performing an offline profiling run for your application is analogous to
remote profiling with special library parameters
passed to the profiling agent VM parameter
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}/.jprofiler7/config.xml. Example: A typical invocation for offline profiling with Java >=1.5 (JVMTI) will look like this:
java "-agentpath:C:\Program Files\jprofiler7\bin\windows\jprofilerti.dll=offline,id=109,config=C:\Users\bob\.jprofiler7\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. |
|
If the generated snapshots have heap dumps in them, you can use the jpanalyze
executable to prepare the heap dump analysis in advance.
Opening the snapshot in the JProfiler GUI will then be very fast.
The executable is named jpanalyze.exe on Windows and jpanalyze
on Unix-based operating systems and is located in the bin directory of
a JProfiler installation. If you execute it with the -help option, you will
get help on its usage:
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. |
| If you start your application from an ant build file, you can use the ant task to easily profile your application in offline mode. |
| If you already have a launched "Application" session defined, you can generate a start script for offline profiling with the local to offline conversion wizard on the "Convert" tab of the start center or by selecting Session->Conversion wizards->Convert application session to offline from the main menu. |
|
To control CPU profiling, triggering of heap dumps and saving of snapshots during
an offline profiling session, you can use the
|
| If wish to analyze profiling information at run-time, you can use the profiling platform that is part of JProfiler. Please see the javadoc in $JPROFILER_HOME/api/javadoc and the sample in $JPROFILER_HOME/api/samples/platform for more information. |