diff --git a/async-profiler/libasyncProfiler-linux-arm.so b/async-profiler/libasyncProfiler-linux-arm.so deleted file mode 100755 index 330a5552..00000000 Binary files a/async-profiler/libasyncProfiler-linux-arm.so and /dev/null differ diff --git a/async-profiler/libasyncProfiler-linux-arm64.so b/async-profiler/libasyncProfiler-linux-arm64.so new file mode 100755 index 00000000..aac47930 Binary files /dev/null and b/async-profiler/libasyncProfiler-linux-arm64.so differ diff --git a/async-profiler/libasyncProfiler-linux-x64.so b/async-profiler/libasyncProfiler-linux-x64.so index 4e406721..ddee9003 100755 Binary files a/async-profiler/libasyncProfiler-linux-x64.so and b/async-profiler/libasyncProfiler-linux-x64.so differ diff --git a/async-profiler/libasyncProfiler-mac-x64.so b/async-profiler/libasyncProfiler-mac-x64.so deleted file mode 100755 index 898bfd50..00000000 Binary files a/async-profiler/libasyncProfiler-mac-x64.so and /dev/null differ diff --git a/async-profiler/libasyncProfiler-mac.so b/async-profiler/libasyncProfiler-mac.so new file mode 100755 index 00000000..75daf6ea Binary files /dev/null and b/async-profiler/libasyncProfiler-mac.so differ 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 bc8b82de..bf773e06 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 @@ -51,7 +51,7 @@ import one.profiler.Counter; + " profiler list # list all supported events\n" + " profiler actions # list all supported actions\n" + " profiler start --event alloc\n" - + " profiler stop --format svg # output file format, support svg,html,jfr\n" + + " profiler stop --format html # output file format, support html,jfr\n" + " profiler stop --file /tmp/result.html\n" + " profiler stop --threads \n" + " profiler start --include 'java/*' --include 'demo/*' --exclude '*Unsafe.park*'\n" @@ -62,7 +62,7 @@ import one.profiler.Counter; + " profiler dumpCollapsed # Dump profile in 'collapsed stacktraces' format\n" + " profiler dumpTraces # Dump collected stack traces\n" + " profiler execute 'start,framebuf=5000000' # Execute an agent-compatible profiling command\n" - + " profiler execute 'stop,file=/tmp/result.svg' # Execute an agent-compatible profiling command\n" + + " profiler execute 'stop,file=/tmp/result.html' # Execute an agent-compatible profiling command\n" + Constants.WIKI + Constants.WIKI_HOME + "profiler") //@formatter:on public class ProfilerCommand extends AnnotatedCommand { @@ -75,7 +75,7 @@ public class ProfilerCommand extends AnnotatedCommand { private String file; /** - * output file format, default value is svg. + * output file format, default value is html. */ private String format; @@ -125,14 +125,13 @@ public class ProfilerCommand extends AnnotatedCommand { static { String profierSoPath = null; if (OSUtils.isMac()) { - profierSoPath = "async-profiler/libasyncProfiler-mac-x64.so"; + // FAT_BINARY support both x86_64/arm64 + profierSoPath = "async-profiler/libasyncProfiler-mac.so"; } if (OSUtils.isLinux()) { profierSoPath = "async-profiler/libasyncProfiler-linux-x64.so"; - if (OSUtils.isArm32()) { - profierSoPath = "async-profiler/libasyncProfiler-linux-arm.so"; - } else if (OSUtils.isArm64()) { - profierSoPath = "async-profiler/libasyncProfiler-linux-aarch64.so"; + if (OSUtils.isArm64()) { + profierSoPath = "async-profiler/libasyncProfiler-linux-arm64.so"; } } @@ -186,8 +185,8 @@ public class ProfilerCommand extends AnnotatedCommand { } @Option(longName = "format") - @Description("dump output file format(svg, html, jfr), default valut is svg") - @DefaultValue("svg") + @Description("dump output file format(html, jfr), default valut is html") + @DefaultValue("html") public void setFormat(String format) { this.format = format; } @@ -533,7 +532,7 @@ public class ProfilerCommand extends AnnotatedCommand { CompletionUtils.complete(completion, events()); return; } else if (token_2.equals("-f") || token_2.equals("--format")) { - CompletionUtils.complete(completion, Arrays.asList("svg", "html", "jfr")); + CompletionUtils.complete(completion, Arrays.asList("html", "jfr")); return; } } diff --git a/core/src/main/java/one/profiler/AsyncProfiler.java b/core/src/main/java/one/profiler/AsyncProfiler.java index c61fdbe3..d813837b 100644 --- a/core/src/main/java/one/profiler/AsyncProfiler.java +++ b/core/src/main/java/one/profiler/AsyncProfiler.java @@ -58,6 +58,9 @@ public class AsyncProfiler implements AsyncProfilerMXBean { */ @Override public void start(String event, long interval) throws IllegalStateException { + if (event == null) { + throw new NullPointerException(); + } start0(event, interval, true); } @@ -71,6 +74,9 @@ public class AsyncProfiler implements AsyncProfilerMXBean { */ @Override public void resume(String event, long interval) throws IllegalStateException { + if (event == null) { + throw new NullPointerException(); + } start0(event, interval, false); } @@ -116,7 +122,10 @@ public class AsyncProfiler implements AsyncProfilerMXBean { * @throws IOException If failed to create output file */ @Override - public String execute(String command) throws IllegalArgumentException, IOException { + public String execute(String command) throws IllegalArgumentException, IllegalStateException, IOException { + if (command == null) { + throw new NullPointerException(); + } return execute0(command); } @@ -129,7 +138,7 @@ public class AsyncProfiler implements AsyncProfilerMXBean { @Override public String dumpCollapsed(Counter counter) { try { - return execute0("collapsed,counter=" + counter.name().toLowerCase()); + return execute0("collapsed," + counter.name().toLowerCase()); } catch (IOException e) { throw new IllegalStateException(e); } @@ -144,7 +153,7 @@ public class AsyncProfiler implements AsyncProfilerMXBean { @Override public String dumpTraces(int maxTraces) { try { - return execute0("summary,traces=" + maxTraces); + return execute0(maxTraces == 0 ? "traces" : "traces=" + maxTraces); } catch (IOException e) { throw new IllegalStateException(e); } @@ -159,7 +168,7 @@ public class AsyncProfiler implements AsyncProfilerMXBean { @Override public String dumpFlat(int maxMethods) { try { - return execute0("summary,flat=" + maxMethods); + return execute0(maxMethods == 0 ? "flat" : "flat=" + maxMethods); } catch (IOException e) { throw new IllegalStateException(e); } @@ -186,7 +195,7 @@ public class AsyncProfiler implements AsyncProfilerMXBean { } private void filterThread(Thread thread, boolean enable) { - if (thread == null) { + if (thread == null || thread == Thread.currentThread()) { filterThread0(null, enable); } else { // Need to take lock to avoid race condition with a thread state change @@ -201,6 +210,6 @@ public class AsyncProfiler implements AsyncProfilerMXBean { private native void start0(String event, long interval, boolean reset) throws IllegalStateException; private native void stop0() throws IllegalStateException; - private native String execute0(String command) throws IllegalArgumentException, IOException; + private native String execute0(String command) throws IllegalArgumentException, IllegalStateException, IOException; private native void filterThread0(Thread thread, boolean enable); -} \ No newline at end of file +} diff --git a/core/src/main/java/one/profiler/AsyncProfilerMXBean.java b/core/src/main/java/one/profiler/AsyncProfilerMXBean.java index 0bc24bf7..90abf830 100644 --- a/core/src/main/java/one/profiler/AsyncProfilerMXBean.java +++ b/core/src/main/java/one/profiler/AsyncProfilerMXBean.java @@ -35,7 +35,7 @@ public interface AsyncProfilerMXBean { long getSamples(); String getVersion(); - String execute(String command) throws IllegalArgumentException, java.io.IOException; + String execute(String command) throws IllegalArgumentException, IllegalStateException, java.io.IOException; String dumpCollapsed(Counter counter); String dumpTraces(int maxTraces); diff --git a/site/src/site/sphinx/en/profiler.md b/site/src/site/sphinx/en/profiler.md index 9ab5a9af..5a004982 100644 --- a/site/src/site/sphinx/en/profiler.md +++ b/site/src/site/sphinx/en/profiler.md @@ -48,25 +48,9 @@ Can view which `event` and sampling time. ### Stop profiler -#### Generate svg format results - -``` -$ profiler stop -profiler output file: /tmp/demo/arthas-output/20191125-135546.svg -OK -``` - -By default, the generated results are saved to the `arthas-output` directory under the application's `working directory`. The output result path can be specified by the `--file` parameter. such as: - -```bash -$ profiler stop --file /tmp/output.svg -profiler output file: /tmp/output.svg -OK -``` - #### Generating html format results -By default, the result file is `svg` format. If you want to generate the `html` format, you can specify it with the `--format` parameter: +By default, the result file is `html` format. You can also specify it with the `--format` parameter: ```bash $ profiler stop --format html @@ -161,7 +145,7 @@ profiler execute 'start,framebuf=5000000' Stop sampling and save to the specified file: ```bash -profiler execute 'stop,file=/tmp/result.svg' +profiler execute 'stop,file=/tmp/result.html' ``` Specific format reference: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v1.8.1/src/arguments.cpp#L50) @@ -184,7 +168,7 @@ Copyright 2019 Andrei Pangin ### Configure framebuf option -> If you encounter `[frame_buffer_overflow]` in the generated svg image, you need to increase the framebuf (the default value is 1'000'000), which can be configured explicitly, such as: +> If you encounter `[frame_buffer_overflow]` in the generated result, you need to increase the framebuf (the default value is 1'000'000), which can be configured explicitly, such as: ```bash profiler start --framebuf 5000000 diff --git a/site/src/site/sphinx/profiler.md b/site/src/site/sphinx/profiler.md index 1b97705b..62500ee5 100644 --- a/site/src/site/sphinx/profiler.md +++ b/site/src/site/sphinx/profiler.md @@ -48,26 +48,9 @@ $ profiler status 可以查看当前profiler在采样哪种`event`和采样时间。 ### 停止profiler - -#### 生成svg格式结果 - -``` -$ profiler stop -profiler output file: /tmp/demo/arthas-output/20191125-135546.svg -OK -``` - -默认情况下,生成的结果保存到应用的`工作目录`下的`arthas-output`目录。可以通过 `--file`参数来指定输出结果路径。比如: - -```bash -$ profiler stop --file /tmp/output.svg -profiler output file: /tmp/output.svg -OK -``` - #### 生成html格式结果 -默认情况下,结果文件是`svg`格式,如果想生成`html`格式,可以用`--format`参数指定: +默认情况下,结果文件是`html`格式,也可以用`--format`参数指定: ```bash $ profiler stop --format html @@ -163,7 +146,7 @@ profiler execute 'start,framebuf=5000000' 停止采样,并保存到指定文件里: ```bash -profiler execute 'stop,file=/tmp/result.svg' +profiler execute 'stop,file=/tmp/result.html' ``` 具体的格式参考: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v1.8.1/src/arguments.cpp#L50) @@ -186,7 +169,7 @@ Copyright 2019 Andrei Pangin ### 配置 framebuf 参数 -> 如果遇到生成的svg图片有 `[frame_buffer_overflow]`,则需要增大 framebuf(默认值是 1'000'000),可以显式配置,比如: +> 如果遇到生成的火焰图有 `[frame_buffer_overflow]`,则需要增大 framebuf(默认值是 1'000'000),可以显式配置,比如: ```bash profiler start --framebuf 5000000 diff --git a/tunnel-common/src/main/java/com/alibaba/arthas/tunnel/common/MethodConstants.java b/tunnel-common/src/main/java/com/alibaba/arthas/tunnel/common/MethodConstants.java index 9c97636f..41792a17 100644 --- a/tunnel-common/src/main/java/com/alibaba/arthas/tunnel/common/MethodConstants.java +++ b/tunnel-common/src/main/java/com/alibaba/arthas/tunnel/common/MethodConstants.java @@ -52,7 +52,7 @@ public class MethodConstants { /** *
- * tunnel server向 tunnel client请求 http中转,比如访问 http://localhost:3658/arthas-output/xxx.svg + * tunnel server向 tunnel client请求 http中转,比如访问 http://localhost:3658/arthas-output/xxx.html **/ public static final String HTTP_PROXY = "httpProxy"; diff --git a/tutorials/katacoda/command-profiler-cn/profiler.md b/tutorials/katacoda/command-profiler-cn/profiler.md index 94314175..93d41af4 100644 --- a/tutorials/katacoda/command-profiler-cn/profiler.md +++ b/tutorials/katacoda/command-profiler-cn/profiler.md @@ -71,29 +71,9 @@ $ profiler status ### 停止profiler -#### 生成svg格式结果 - -`profiler stop`{{execute T2}} - -``` -$ profiler stop -profiler output file: /tmp/demo/arthas-output/20191125-135546.svg -OK -``` - -默认情况下,生成的结果保存到应用的`工作目录`下的`arthas-output`目录。可以通过 `--file`参数来指定输出结果路径。比如: - -`profiler stop --file /tmp/output.svg`{{execute T2}} - -```bash -$ profiler stop --file /tmp/output.svg -profiler output file: /tmp/output.svg -OK -``` - #### 生成html格式结果 -默认情况下,结果文件是`svg`格式,如果想生成`html`格式,可以用`--format`参数指定: +默认情况下,结果文件是`html`格式。也可以用`--format`参数指定: `profiler stop --format html`{{execute T2}} @@ -199,10 +179,10 @@ profiler execute 'start,framebuf=5000000' 停止采样,并保存到指定文件里: -`profiler execute 'stop,file=/tmp/result.svg'`{{execute T2}} +`profiler execute 'stop,file=/tmp/result.html'`{{execute T2}} ```bash -profiler execute 'stop,file=/tmp/result.svg' +profiler execute 'stop,file=/tmp/result.html' ``` 具体的格式参考: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v1.8.1/src/arguments.cpp#L50) diff --git a/tutorials/katacoda/command-profiler-en/profiler.md b/tutorials/katacoda/command-profiler-en/profiler.md index 7145a7dd..bcdb64e7 100644 --- a/tutorials/katacoda/command-profiler-en/profiler.md +++ b/tutorials/katacoda/command-profiler-en/profiler.md @@ -71,29 +71,10 @@ Can view which `event` and sampling time. ### Stop profiler -#### Generate svg format results - -`profiler stop`{{execute T2}} - -``` -$ profiler stop -profiler output file: /tmp/demo/arthas-output/20191125-135546.svg -OK -``` - -By default, the generated results are saved to the `arthas-output` directory under the application's `working directory`. The output result path can be specified by the `--file` parameter. such as: - -`profiler stop --file /tmp/output.svg`{{execute T2}} - -```bash -$ profiler stop --file /tmp/output.svg -profiler output file: /tmp/output.svg -OK -``` #### Generating html format results -By default, the result file is `svg` format. If you want to generate the `html` format, you can specify it with the `--format` parameter: +By default, the result file is `html` format. You can also specify it with the `--format` parameter: `profiler stop --format html`{{execute T2}} @@ -199,10 +180,10 @@ profiler execute 'start,framebuf=5000000' Stop sampling and save to the specified file: -`profiler execute 'stop,file=/tmp/result.svg'`{{execute T2}} +`profiler execute 'stop,file=/tmp/result.html'`{{execute T2}} ```bash -profiler execute 'stop,file=/tmp/result.svg' +profiler execute 'stop,file=/tmp/result.html' ``` Specific format reference: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v1.8.1/src/arguments.cpp#L50)