- System requirements
- Profiler architecture
- Running the profiler
- Profiler activation
- Start profiling
- Solving performance problems
- CPU profiling
- Deadlock detector
- Memory profiling
- Memory telemetry
- Memory snapshot
- Object allocation recording
- Shallow and retained sizes
- Memory views
- Memory inspections
- Comparing memory snapshots
- Support of HPROF format snapshots
- Support of Java Flight Recorder (JFR)
- Support of Portable Heap Dumps (.phd)
- Values of primitive types
- Persistent object IDs
- Useful actions
- Set description language
- Garbage collection
- Monitor profiling
- Exception profiling
- Probes: monitor events of various kinds
- Performance Charts
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Summary, snapshot annotation, automatic deobfuscation
- Time measurement (CPU time, wall time)
- Snapshot directory customization
- Export of profiling results to HTML, CSV, XML, plain text
- Profiler Java API
- Profiler HTTP API
- Command line tool to control profiling
- FAQ: How to profile in my scenario?
Support of HPROF format snapshots
Java has a built-in feature for dumping heap snapshots to files in HPROF binary format. You can analyze these snapshots by using all of the powerful features that YourKit Java Profiler provides for its own memory snapshots.
HPROF snapshots can be created in the following ways:
Automatically on OutOfMemoryError
Explicitly from within the profiler UI (Oracle JDK/OpenJDK HotSpot)
Explicitly via jmap utility (Oracle JDK/OpenJDK HotSpot)
jmaputility can connect to a running Java process and dump its Java heap:
jmap -dump:format=b,file=file_name.hprof <PID>
Hint: to learn the PID (process identifier) of running JVM, you can use
The benefit is that memory can be analyzed on demand with no additional configuration of JVM or Java application. You can dump memory of any running instance of JVM that supports this feature.
Explicitly via jconsole utility (Oracle JDK/OpenJDK HotSpot)
jconsoleallows you to connect to a running Java process for monitoring and management.
jconsole, you can dump Java heap via
Produced with Java's built-in basic level profiling capability HPROF
This approach has a lot of drawbacks and is not useful nowadays, but is mentioned here to show the complete picture.
How it works
HPROF snapshots (*.hprof) can be opened the same way as YourKit Java Profiler format snapshots (*.snapshot)
Some HPROF snapshots do not contain values of primitive types.
When such snapshots are opened in the profiler, values of
java.lang.String's will not be available.
Conversion to HPROF
The profiler format
.snapshot file can be converted to HPROF binary format
to analyze it with a 3rd party tool.
The following command creates a new HPROF file from existing
<Profiler Installation Directory>\bin\snapshot2hprof.bat <source>.snapshot <target>.hprof
<YourKit Java Profiler.app>/Contents/Resources/bin/profiler.sh <source>.snapshot <target>.hprof
Linux and other platforms:
<Profiler Installation Directory>/bin/profiler.sh -snapshot2hprof <source>.snapshot <target>.hprof
- Class references to constant pool entries are not exported because they cannot be expressed in HPROF format.