YourKit提供API for capturing CPU profiling(采样/跟踪)。有些事情如下......
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?
答案 0 :(得分:3)
有API可以查询内存快照。请参阅MemoryDnapshot类http://www.yourkit.com/docs/java/api/com/yourkit/api/MemorySnapshot.html的JavaDoc和"设置描述语言" http://www.yourkit.com/docs/java/help/language.jsp
您也可以导出快照数据以进行进一步分析http://www.yourkit.com/docs/java/help/export.jsp