- System requirements
- Profiler architecture
- Profiler installation
- Uninstall profiler
- Running the profiler
- Profiler activation
- Welcome screen
- Start profiling
- Profiling overhead
- Snapshots
- Solving performance problems
- CPU profiling
- Thread profiling
- Virtual threads support
- Object allocation profiling
- Memory profiling
- Monitor profiling
- Exception profiling
- JFR (Java Flight Recorder)
- Telemetry
- Probes: monitor events of various kinds
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Automatic deobfuscation
- Summary
- Filters
- Profiler command line
- Export of profiling results to external formats
- Profiler Java API
- Profiler HTTP API
- Settings
- Troubleshooting and FAQ
Profiler Java API
Agent controller
The controller API allows you to control profiling programmatically from your Java application. You can use the controller API to implement self-monitoring applications.
Please also consider using the profiler HTTP API. In some cases, language-neutral tools may be simpler and more convenient.
Requirements
The controller API classes are located in
<Profiler Installation Directory>/lib/yjp-controller-api-redist.jar
in com.yourkit.api.controller.v3 package.
This JAR is required both at compile time and at runtime.
The JAR is compiled with Java 8 bytecode level.
yjp-controller-api-redist.jar is distributed under the BSD license.
You can add this JAR to your source code repository to compile your code
and distribute it with your application.
The JAR does not require a license key or an installed YourKit Java Profiler.
Javadoc and samples
See package com.yourkit.api.controller.v3 for the complete API Javadoc documentation.
The sample application
<Profiler Installation Directory>/samples/sample1/src/ApiDemo1.java
demonstrates how a Java application can create an instance of
com.yourkit.api.controller.v3.Controller and capture its
own memory snapshot.
Probes
The probes API is intended for writing custom probes.
The API classes are located in
<Profiler Installation Directory>/lib/yjp-probe-api-redist.jar
in the com.yourkit.probes package.
Requirements
yjp-probe-api-redist.jar
is a compile-time dependency and is not required at runtime.
At runtime, the YourKit profiler agent loads all classes required for
probe execution automatically.
The JAR is compiled with Java 8 bytecode level.
yjp-probe-api-redist.jar is distributed under the BSD license.
You can add this JAR to your source code repository to compile your probes.
The JAR does not require a license key or an installed YourKit Java Profiler.
Javadoc and samples
See package
com.yourkit.probes
for the complete Probes API Javadoc documentation.
Sample probes are available in the
<Profiler Installation Directory>/probes
directory of the YourKit installation.
Snapshot analyzes
Classes com.yourkit.api.MemorySnapshot and
com.yourkit.api.Annotations
support the analysis of captured memory snapshots and snapshot annotation.
To use this part of the API, include
<Profiler Installation Directory>/lib/yourkit.jar in the classpath.
Requirements
yourkit.jar is required both at compile time and at runtime.
The JAR is compiled with Java 25 bytecode level.
If Java 25 is not installed on your system, you can use the JRE bundled
with the YourKit Java Profiler from the
<Profiler Installation Directory>/jre64/
directory.
To use the API from yourkit.jar, you must have the profiler
installed and activated.
Do not move or copy yourkit.jar.
The API will not work if yourkit.jar is copied to another
directory, because it depends on other files from the installation.
Javadoc and samples
See package com.yourkit.api for the complete API Javadoc documentation.
The sample application
<Profiler Installation Directory>/samples/sample2/src/ApiDemo1.java
demonstrates how a Java application can capture and analyze its
own memory snapshot.
The sample shows how to obtain the number of objects of a particular class,
as well as their shallow and retained sizes.