- System requirements
- Profiler architecture
- Running the profiler
- Profiler activation
- Start profiling
- Solving performance problems
- CPU profiling
- Threads
- Deadlock detector
- Memory profiling
- 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)
- Filters
- 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
- Settings
- FAQ: How to profile in my scenario?
Profiler Java API
The profiler Java API allows you to control profiling programmatically right from your Java application. You can use this API to implement self-monitoring applications, or build complex JUnit memory tests by capturing and analyzing memory snapshots via the set description language.
To control profiling programmatically, please also consider:
Using language neutral tools might be more convenient and simpler in some cases.
Documentation
Here is the complete API JavaDoc.
Agent controller
The main class which allows to control profiling modes and to capture snapshots
is com.yourkit.api.controller.Controller
.
To use this part of the API, please include
<Profiler Installation Directory>/lib/yjp-controller-api-redist.jar
in the classpath.
yjp-controller-api-redist.jar
is licensed under BDS-like license and
you can freely re-distribute it together with your application.
There is a sample
<Profiler Installation Directory>/samples/sample1/src/ApiDemo1.java
,
which demonstrates how the Java app can instantiate the
com.yourkit.api.controller.Controller
and capture own memory snapshot.
Probes and snapshot analyzes
Classes in com.yourkit.probes.*
provide API for probes.
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, please include <Profiler Installation Directory>/lib/yourkit.jar
in the classpath.
Do not delete yourkit.jar
from the installation directory
and do not use a copy of yourkit.jar
in your classpath.
The API will not work with yourkit.jar
copied to another directory,
because it needs the other files from the installation.
The sample application
<Profiler Installation Directory>/samples/sample2/src/ApiDemo1.java
demonstrates how the Java app can capture own memory snapshot and analyze it.
In this sample we obtain the number of objects of particular class,
as well as their shallow and retained sizes.