import com.yourkit.api.controller.v2.Controller;

public class ApiDemo1 {
  public static void main(final String[] args) throws Exception {
    // Create the controller to profile the application itself.
    // To profile another application use the builder's methods host() and port() instead of self().
    final Controller controller = Controller.newBuilder().self().build();

    final String snapshotFilePath = controller.captureMemorySnapshot();
    System.out.println("Own memory snapshot captured: " + snapshotFilePath);
  }
}
