wynterr opened issue #9044:
Hi,
I was trying to use perf to do profiling when using
wasmtime serveto serve a wasm component(compiled from https://github.com/sunfishcode/hello-wasi-http without any change). The command I run isperf record wasmtime serve --profile=perfmap target/wasm32-wasi/debug/hello_wasi_http.wasm. After calling the endpoint for a couple times, I stop the serve and useperf report --input perf.datato check the profile. However, I see this line with unresolved symbol:1.84% wasmtime wasmtime [.] 0x000000000151eb88
Also, I find no perf-xxxx.map file under /tmp.
I wonder is profiling not supported for component serving, or anything I was not doing right?
To reproduce:
git clone https://github.com/sunfishcode/hello-wasi-http cargo component build perf record wasmtime serve --profile=perfmap target/wasm32-wasi/debug/hello_wasi_http.wasm # call the endpoint perf report --input perf.data
alexcrichton commented on issue #9044:
To confirm, you're on Linux?
Locally I ran
perf record wasmtime serve --profile perfmap ./target/wasm32-wasi/release/hello_wasi_http.wasmwithperf version 6.8.1andwasmtime-cli 23.0.1. I hit that a few times and then usingperf reportI see0.88% tokio-runtime-w [JIT] tid 4066067 [.] wit_bindgen::rt::run_ctors_once::hf08958e4a83e86d1which I believe is the symbolication.
wynterr commented on issue #9044:
To confirm, you're on Linux?
Locally I ran
perf record wasmtime serve --profile perfmap ./target/wasm32-wasi/release/hello_wasi_http.wasmwithperf version 6.8.1andwasmtime-cli 23.0.1. I hit that a few times and then usingperf reportI see0.88% tokio-runtime-w [JIT] tid 4066067 [.] wit_bindgen::rt::run_ctors_once::hf08958e4a83e86d1which I believe is the symbolication.Thanks for your reply. I'm on Linux with
perf version 6.5.13andwasmtime-cli 21.0.1 (cedf9aa0f 2024-05-22). Actually I made a mistake before and I do find the/tmp/perf-XXXX.mapfile now. But still seeing symbols like0.98% wasmtime [unknown] [k] 0xffffffffc02c076ffromperf reportand didn't find things likewit_bindgen::rt::run_ctors_once
I'm actually quite new to this and not very sure about how to read the perf report to find the symbol that relates to things inside my wasm component.
alexcrichton commented on issue #9044:
Under "To reproduce" above are those the exact commands you used? I ran those myself locally and apart from a missing
cd hello-wasi-httpthose worked for me. For the# call the endpointstep I ranwrk http://localhost:8080 -t 1 -d 1. In the output I see JIT symbols as expected with nothing un-symbolicated.Perhaps perfmap support was improved or something in
perfbetween 6.5 and 6.8? I don't know much aboutperfversions myself and the historicaly development of perfmap support.
wynterr commented on issue #9044:
Yes I do follow the exact commands in "To reproduce" except the missing
cd hello-wasi-http. But I was usingcurl http://localhost:8080to hit the endpoint.
After usingwrk http://localhost:8080 -t 1 -d 1to hit the endpoint I do find some[JIT] tid xxxxin shared objects and symbolwit_bindgen::rt::run_ctors_once, even though records with things like0.03% tokio-runtime-w [unknown] [k] 0xffffffffc02d1028still exist but with very small overhead.
I also tried to runcurl http://localhost:8080more times and in the end I also saw some[JIT] tid xxxxin shared objects. I guess the reason is thatperf recordonly samples a small part of records to show so you have to make more requests to make the function call visible.
alexcrichton commented on issue #9044:
Aha! The
[k]there means that it's time spent in the kernel, which I believe means that yourperfinvocation can't symbolize kernel stack traces. I belive that's unrelated to wasmtime profiling. If you're seeing[JIT]entries then profiling should be working.
wynterr closed issue #9044:
Hi,
I was trying to use perf to do profiling when using
wasmtime serveto serve a wasm component(compiled from https://github.com/sunfishcode/hello-wasi-http without any change). The command I run isperf record wasmtime serve --profile=perfmap target/wasm32-wasi/debug/hello_wasi_http.wasm. After calling the endpoint for a couple times, I stop the serve and useperf report --input perf.datato check the profile. However, I see this line with unresolved symbol:1.84% wasmtime wasmtime [.] 0x000000000151eb88
Also, I find no perf-xxxx.map file under /tmp.
I wonder is profiling not supported for component serving, or anything I was not doing right?
To reproduce:
git clone https://github.com/sunfishcode/hello-wasi-http cargo component build perf record wasmtime serve --profile=perfmap target/wasm32-wasi/debug/hello_wasi_http.wasm # call the endpoint perf report --input perf.data
Last updated: Dec 06 2025 at 06:05 UTC