我想测量我的应用程序在数据库中花费了多少时间。
我已将 CPU Profiler 添加到 Intellij 的 Settings / Build / Java Profiler 中,但默认情况下它显示具有大多数 CPU 周期的代码,这对我来说毫无用处,因为 JDBC 驱动程序在收到响应时基本上处于休眠状态。
听起来像挂钟分析是可行的方法,但我不知道如何在 Intellij 的 CPU Profiler 配置窗口中启用它。自述文件说-e wall,而 Intellij 的代理选项看起来完全不同:threads,interval=1ms,framebuf=15000000。我如何配置 Intellij 的异步分析器以使用挂钟?
我正在尝试查看 jvm 支持的分析事件列表。正如文档中提到的,我使用了list如下所示的命令 -
root@vrni-platform:/home/ubuntu/async-profiler-2.0-linux-x64# ./profiler.sh list 10208
Basic events:
cpu
alloc
lock
wall
itimer
Java method calls:
ClassName.methodName
Perf events:
page-faults
context-switches
cycles
instructions
cache-references
cache-misses
branches
branch-misses
bus-cycles
L1-dcache-load-misses
LLC-load-misses
dTLB-load-misses
mem:breakpoint
trace:tracepoint
Run Code Online (Sandbox Code Playgroud)
我在上面的输出中没有看到这个答案中提到的事件。但是,如果我按照该答案中提到的方式执行上述事件,它似乎就可以工作。
root@vrni-platform:/home/ubuntu/async-profiler-2.0-linux-x64# ./profiler.sh -e malloc -d 30 -f /tmp/flamegraph.html 10208
Profiling for 30 seconds
Done
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我如何查看 aysnc-profiler 支持的特定 jvm 的所有事件列表吗?如果list是正确的参数,profiler.sh那么为什么 malloc 等显示在所有事件列表下?
环境
ubuntu@vrni-platform:~/async-profiler-2.0-linux-x64# ./profiler.sh --version
Async-profiler 2.0 built on Mar 14 2021
Copyright 2016-2021 …Run Code Online (Sandbox Code Playgroud)