Fully featured low overhead profiler for Java EE and Java SE platforms.
Performance monitoring and profiling of Jenkins, TeamCity, Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Profiler API

The profiler API allows you to control profiling programmatically. Also, in your automatic memory tests you can open saved memory snapshots and examine them via the set description language.

To control profiling programmatically, also consider command line tool which in some cases may be a simpler approach.

Please find API JavaDoc here

Class com.yourkit.api.Controller allows you to profile (i.e. turn on and off profiling modes and capture snapshots) the application itself or another Java application. To use this part of the API, please include <Profiler Installation Directory>/lib/yjp-controller-api-redist.jar in the classpath.

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. Important: Do not remove yourkit.jar from the installation directory. The API will not work with yourkit.jar moved to an arbitrary directory, because it needs the other files from the installation.