Skip to content

Commit

Permalink
wall选项文档补充
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoGuorui666 committed Sep 21, 2024
1 parent f07cc82 commit d591257
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions site/docs/doc/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,18 @@ profiler start --loop 1h -f /var/log/profile-%t.jfr
## `--timeout` 选项

这个选项指定 profiling 自动在多久后停止。该选项和 `--loop` 选项的格式一致,可以是时间点,也可以是一个时间间隔。这两个选项都是用于 `start` action 而不是 `collect` action 的。可参考 [async-profiler Github Discussions](https://github.com/async-profiler/async-profiler/discussions/789) 了解更多信息。

## `--wall` 选项

这个选项允许同时进行 CPU 和 Wall clock 的分析。
通过设置输出格式为 jfr,可以记录每个执行样本的线程状态(STATE_RUNNABLE 或 STATE_SLEEPING)。
可使用以下命令(可以独立设置 CPU 和 Wall clock 分析的间隔):
```bash
profiler start -e cpu -i 10ms --wall 200ms -f out.jfr
```

需要注意:
* Linux 平台: 这个新功能仅在 Linux 平台上有效。macOS 上的 CPU 分析引擎已经基于 Wall clock 模式,因此没有额外的收益。
* 性能开销: 启用 Wall clock 分析会增加性能开销,因此在同时分析 CPU 和 Wall clock 时,建议增加 Wall clock 的间隔。

可参考 [async-profiler pr#740](https://github.com/async-profiler/async-profiler/issues/740) 了解更多信息。
15 changes: 15 additions & 0 deletions site/docs/en/doc/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,18 @@ profiler start --loop 1h -f /var/log/profile-%t.jfr
This option specifies the time when profiling will automatically stop. The format is the same as in loop: it is either a wall clock time (12:34:56) or a relative time interval (2h).

Both `--loop` and `--timeout` are used for `start` action but not for `collect` action, for further information refer to [async-profiler Github Discussions](https://github.com/async-profiler/async-profiler/discussions/789).

## `--wall` option
This option allows for simultaneous CPU and Wall clock profiling.
By setting the output format to jfr, you can record the thread state (STATE_RUNNABLE or STATE_SLEEPING) for each execution sample.
You can use the following command (with independent intervals for CPU and Wall clock profiling):

```bash
profiler start -e cpu -i 10ms --wall 200ms -f out.jfr
```

Please note:
* Linux Platform: This new feature is only effective on the Linux platform. The CPU profiling engine on macOS is already based on Wall clock mode, so there is no additional benefit.
* Performance Overhead: Enabling Wall clock profiling increases performance overhead. Therefore, when profiling both CPU and Wall clock, it is recommended to increase the Wall clock interval.

You can refer to [async-profiler pr#740](https://github.com/async-profiler/async-profiler/issues/740) for more information.

0 comments on commit d591257

Please sign in to comment.