Skip to content

Commit

Permalink
Upgrade profiler action: version, meminfo (alibaba#2626)
Browse files Browse the repository at this point in the history
  • Loading branch information
Winson-Huang authored Aug 23, 2023
1 parent ba63c3a commit 1c41bcd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
19 changes: 15 additions & 4 deletions site/docs/doc/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $ profiler getSamples
23
```

## 查看 profiler 状态
## 查看 profiling 状态

```bash
$ profiler status
Expand All @@ -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

### 生成火焰图格式结果
Expand Down Expand Up @@ -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 参数
Expand Down
19 changes: 15 additions & 4 deletions site/docs/en/doc/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $ profiler getSamples
23
```

## View profiler status
## View profiling status

```bash
$ profiler status
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

1 comment on commit 1c41bcd

@vercel
Copy link

@vercel vercel bot commented on 1c41bcd Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.