3

YourKit provides API for capturing CPU profiling (sampling/tracing). Some thing like below...

import com.yourkit.api.Controller;

import java.awt.*;
import java.io.File;

/**
 * to understand yourkit api.....
 */
public class AppMain {
    public static void main(String[] args) throws Exception {
        Controller yourKitController = new Controller();

        yourKitController.startCPUSampling(null);

        AnApplication anApplication = new AnApplication();
        anApplication.count(1000090);

        yourKitController.stopCPUProfiling();
        String savedFilePath = yourKitController.captureSnapshot(Controller.SNAPSHOT_WITHOUT_HEAP);

        File savedFile = new File(savedFilePath);
        Desktop.getDesktop().open(savedFile);

    }
}

I could not find API for analysing the captured data. Is there a yourkit API for analyzing captured data?

Jayan
  • 18,003
  • 15
  • 89
  • 143

1 Answers1

3

There is API which allows to query memory snapshots. See JavaDoc of MemorySnapshot class http://www.yourkit.com/docs/java/api/com/yourkit/api/MemorySnapshot.html and "Set Description Language" http://www.yourkit.com/docs/java/help/language.jsp

Also you can export snapshot data for further analyzes http://www.yourkit.com/docs/java/help/export.jsp