3

YourKit 提供用于捕获 CPU 分析(采样/跟踪)的 API。像下面这样的东西......

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);

    }
}

我找不到用于分析捕获数据的 API。是否有用于分析捕获数据的 yourkit API?

4

1 回答 1

3

有允许查询内存快照的 API。请参阅 MemorySnapshot 类的 JavaDoc http://www.yourkit.com/docs/java/api/com/yourkit/api/MemorySnapshot.html和“设置描述语言” http://www.yourkit.com/docs/java/帮助/语言.jsp

您还可以导出快照数据以进行进一步分析http://www.yourkit.com/docs/java/help/export.jsp

于 2014-03-11T13:30:06.493 回答