Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy-to-use performance and memory .NET profiler for Windows, Linux and macOS.
Secure and easy profiling in cloud, containers and clustered environments.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

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 HTTP API. 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.v2.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.v2.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.

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.