Stream: git-wasmtime

Topic: wasmtime / issue #6151 Profiling with Perf


view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2023 at 15:47):

MrSarius opened issue #6151:

I am currently following the wasmtime perf example from the documentation.

The following seem to work for me:

$ rustc --target wasm32-wasi fib.rs -O
$ perf record -k mono wasmtime fib.wasm -- --profile=jitdump
fib(42) = 267914296
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.140 MB perf.data (3618 samples) ]
$ perf inject --jit --input perf.data --output perf.jit.data

But the output of perf report --input perf.jit.data shows unresolved symbols (and just 11.19% for the top function call):

Samples: 3K of event 'cpu-clock:uhpppH', Event count (approx.): 904500000
Overhead  Command   Shared Object     Symbol
  11.19%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db37646b
   7.30%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764d0
   6.41%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376483
   6.14%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376460
   4.86%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764b0
   4.12%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376476
   3.81%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764a8
   3.65%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764a5
   3.65%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764da
   3.59%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376461
...

Any idea why? I'm following the instructions step by step.

the only thing I had to change from the documentation was
$ perf record -k mono wasmtime --profile=jitdump fib.wasm
to
$ perf record -k mono wasmtime fib.wasm -- --profile=jitdump.
The documentation seems to be outdated here?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2023 at 16:18):

jameysharp commented on issue #6151:

What does wasmtime --version say?

I think your issue may actually be that the documentation is too new: it reflects changes which are in the upcoming 8.0.0 release. On earlier versions, I believe the flag you needed was --jitdump.

I think the only reason that adding the --profile flag after -- eliminated error messages was because it made Wasmtime ignore the flag and try to pass it to your wasm program instead.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2023 at 16:39):

MrSarius commented on issue #6151:

$ wasmtime --version
wasmtime-cli 7.0.0

Thank you, that was the issue!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2023 at 16:55):

jameysharp commented on issue #6151:

Great, I'm glad I could help!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2023 at 16:55):

jameysharp closed issue #6151:

I am currently following the wasmtime perf example from the documentation.

The following seem to work for me:

$ rustc --target wasm32-wasi fib.rs -O
$ perf record -k mono wasmtime fib.wasm -- --profile=jitdump
fib(42) = 267914296
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.140 MB perf.data (3618 samples) ]
$ perf inject --jit --input perf.data --output perf.jit.data

But the output of perf report --input perf.jit.data shows unresolved symbols (and just 11.19% for the top function call):

Samples: 3K of event 'cpu-clock:uhpppH', Event count (approx.): 904500000
Overhead  Command   Shared Object     Symbol
  11.19%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db37646b
   7.30%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764d0
   6.41%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376483
   6.14%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376460
   4.86%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764b0
   4.12%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376476
   3.81%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764a8
   3.65%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764a5
   3.65%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db3764da
   3.59%  wasmtime  [JIT] tid 12785   [.] 0x00007f18db376461
...

Any idea why? I'm following the instructions step by step.

the only thing I had to change from the documentation was
$ perf record -k mono wasmtime --profile=jitdump fib.wasm
to
$ perf record -k mono wasmtime fib.wasm -- --profile=jitdump.
The documentation seems to be outdated here?


Last updated: Nov 22 2024 at 16:03 UTC