diff --git a/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java b/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java index fdbe9abbf9..d21ac9331e 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java @@ -385,7 +385,7 @@ private AsyncProfiler profilerInstance() { */ public enum ProfilerAction { // start, resume, stop, dump, check, status, meminfo, list, collect, - start, resume, stop, dump, status, list, + start, resume, stop, dump, status, meminfo, list, version, load, @@ -535,14 +535,13 @@ public void run() { String executeArgs = executeArgs(ProfilerAction.resume); String result = execute(asyncProfiler, executeArgs); appendExecuteResult(process, result); - } else if (ProfilerAction.list.equals(profilerAction)) { - String result = asyncProfiler.execute("list"); - appendExecuteResult(process, result); } else if (ProfilerAction.version.equals(profilerAction)) { - String result = asyncProfiler.execute("version"); + String result = asyncProfiler.execute("version=full"); appendExecuteResult(process, result); - } else if (ProfilerAction.status.equals(profilerAction)) { - String result = asyncProfiler.execute("status"); + } else if (ProfilerAction.status.equals(profilerAction) + || ProfilerAction.meminfo.equals(profilerAction) + || ProfilerAction.list.equals(profilerAction)) { + String result = asyncProfiler.execute(profilerAction.toString()); appendExecuteResult(process, result); } else if (ProfilerAction.dumpCollapsed.equals(profilerAction)) { if (actionArg == null) { diff --git a/site/docs/doc/profiler.md b/site/docs/doc/profiler.md index 923a6414d0..22e6077ff2 100644 --- a/site/docs/doc/profiler.md +++ b/site/docs/doc/profiler.md @@ -41,7 +41,7 @@ $ profiler getSamples 23 ``` -## 查看 profiler 状态 +## 查看 profiling 状态 ```bash $ profiler status @@ -50,6 +50,17 @@ $ profiler status 可以查看当前 profiler 在采样哪种`event`和采样时间。 +## 查看 profiler 自身的内存占用 + +``` +$ profiler meminfo +Call trace storage: 10244 KB + Dictionaries: 72 KB + Code cache: 12890 KB +------------------------------ + Total: 23206 KB +``` + ## 停止 profiler ### 生成火焰图格式结果 @@ -173,15 +184,15 @@ profiler execute 'stop,file=/tmp/result.html' ```bash $ profiler actions -Supported Actions: [resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status] +Supported Actions: [resume, dumpCollapsed, getSamples, start, list, version, execute, meminfo, stop, load, dumpFlat, dump, actions, dumpTraces, status] ``` ## 查看版本 ```bash $ profiler version -Async-profiler 1.6 built on Sep 9 2019 -Copyright 2019 Andrei Pangin +Async-profiler 2.9 built on May 8 2023 +Copyright 2016-2021 Andrei Pangin ``` ## 配置 framebuf 参数 diff --git a/site/docs/en/doc/profiler.md b/site/docs/en/doc/profiler.md index 5e6a24d926..3235710231 100644 --- a/site/docs/en/doc/profiler.md +++ b/site/docs/en/doc/profiler.md @@ -41,7 +41,7 @@ $ profiler getSamples 23 ``` -## View profiler status +## View profiling status ```bash $ profiler status @@ -50,6 +50,17 @@ $ profiler status Can view which `event` and sampling time. +## View profiler memory usage + +``` +$ profiler meminfo +Call trace storage: 10244 KB + Dictionaries: 72 KB + Code cache: 12890 KB +------------------------------ + Total: 23206 KB +``` + ## Stop profiler ### Generating flame graph results @@ -173,15 +184,15 @@ Specific format reference: [arguments.cpp](https://github.com/jvm-profiling-tool ```bash $ profiler actions -Supported Actions: [resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status] +Supported Actions: [resume, dumpCollapsed, getSamples, start, list, version, execute, meminfo, stop, load, dumpFlat, dump, actions, dumpTraces, status] ``` ## View version ```bash $ profiler version -Async-profiler 1.6 built on Sep 9 2019 -Copyright 2019 Andrei Pangin +Async-profiler 2.9 built on May 8 2023 +Copyright 2016-2021 Andrei Pangin ``` ## Configure framebuf option