Code: Select all
import com.yourkit.api.controller.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);
}
}
By manually opening `snapshotFilePath` in the GUI, I can see the snapshot. It looks as I expect.
However, I would like the snapshot to open automatically. I looked through the API javadocs, but could not find any functions that allow direct control over the YourKit GUI. Is there a way I can, in essence, do something like `controller.openMemorySnapshot(snapshotFilePath)`. Is it possible?