You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/perf_tune.md
+14-9
Original file line number
Diff line number
Diff line change
@@ -98,17 +98,22 @@ You should only use this method for well tested wasm applications and make sure
98
98
Linux perf is a powerful tool to analyze the performance of a program, developer can use it to find the hot functions and optimize them. It is one profiler supported by WAMR. In order to use it, you need to add `--perf-profile` while running _iwasm_. By default, it is disabled.
99
99
100
100
> [!CAUTION]
101
-
> For now, only llvm-jit mode supports linux-perf.
101
+
> For now, only llvm-jit mode and aot mode supports linux-perf.
102
102
103
103
Here is a basic example, if there is a Wasm application _foo.wasm_, you'll execute.
104
104
105
105
```
106
-
$ perf record --output=perf.data.raw -- iwasm --perf-profile foo.wasm
106
+
$ perf record --output=perf.data.raw -- iwasm --enable-linux-perf foo.wasm
107
107
```
108
108
109
-
This will create a _perf.data_ and a _jit-xxx.dump_ under _~/.debug.jit/_ folder. This extra file is WAMR generated at runtime, and it contains the mapping between the JIT code and the original Wasm function names.
109
+
This will create a _perf.data_ and
110
+
- a _jit-xxx.dump_ under _~/.debug/jit/_ folder if running llvm-jit mode
111
+
- or _/tmp/perf-<pid>.map_ if running AOT mode
110
112
111
-
The next thing need to do is to merge _jit-xxx.dump_ file into the _perf.data_.
113
+
114
+
This file is WAMR generated. It contains information which includes jitted(precompiled) code addresses in memory, names of jitted (precompiled) functions which are named as *aot_func#N* and so on.
115
+
116
+
If running with llvm-jit mode, the next thing is to merge _jit-xxx.dump_ file into the _perf.data_.
[Flamegraph](https://www.brendangregg.com/flamegraphs.html) is a powerful tool to visualize stack traces of profiled software so that the most frequent code-paths can be identified quickly and accurately. In order to use it, you need to [capture graphs](https://github.com/brendangregg/FlameGraph#1-capture-stacks) when running `perf record`
0 commit comments