Stream: git-wasmtime

Topic: wasmtime / issue #10362 Question about perf profiling in ...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 10 2025 at 10:54):

Yeeyooo opened issue #10362:

Hello, I'm profiling the execution of WebAssembly program in wasmtime by using perf tool, which is supported by wasmtime. By following the chapter "Using perf on Linux" in official documentation, I can get perf output as expected. However, the amount of information generated is staggering, which not only has function overhead in the given wasm program, but also has many other function symbols, which is not what I want. Below is an example:

![Image](https://github.com/user-attachments/assets/7afb120f-8162-4908-ab8f-689851e69a28)
Aftering reading source code of wasmtime, I find that the actual call into wasm program happens in the function call_impl_do_call. I wonder if it is possible to limit the sample scope to the execution of this function, so I can get information about the overhead of each function called during this process, ruling out many other unnecessary functions? If it is possible, how can I do that? Thank you very much for your help!

view this post on Zulip Wasmtime GitHub notifications bot (Mar 10 2025 at 11:06):

bjorn3 commented on issue #10362:

I see wasmtime, node and a gpu driver component (kms_swrast_dri.so) in your profile. I think you are profiling not just wasmtime but the entire system. You need to run wasmtime directly from perf through perf record wasmtime ... to only include wasmtime in your profile.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 10 2025 at 11:12):

Yeeyooo commented on issue #10362:

Thank you for your reply! That's just an example. Can I further limit the sample scope to the function call_impl_do_call and find what happens during this call?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 10 2025 at 11:21):

bjorn3 commented on issue #10362:

If you select call_impl_do_call and then press e, you can expand it to show the functions this function called. I don't think perf report has an option to filter to just the functions called by a specific function.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 10 2025 at 15:41):

cfallin closed issue #10362:

Hello, I'm profiling the execution of WebAssembly program in wasmtime by using perf tool, which is supported by wasmtime. By following the chapter "Using perf on Linux" in official documentation, I can get perf output as expected. However, the amount of information generated is staggering, which not only has function overhead in the given wasm program, but also has many other function symbols, which is not what I want. Below is an example:

![Image](https://github.com/user-attachments/assets/7afb120f-8162-4908-ab8f-689851e69a28)
Aftering reading source code of wasmtime, I find that the actual call into wasm program happens in the function call_impl_do_call. I wonder if it is possible to limit the sample scope to the execution of this function, so I can get information about the overhead of each function called during this process, ruling out many other unnecessary functions? If it is possible, how can I do that? Thank you very much for your help!

view this post on Zulip Wasmtime GitHub notifications bot (Mar 10 2025 at 15:41):

cfallin commented on issue #10362:

perf is fundamentally a tool that is meant to profile whole processes (or the whole system), and I'm not aware of a way to tell it to stop profiling to "hide" the runtime (any such interface would also likely have high overhead on every Wasm call). As @bjorn3 notes, this is more properly a UI concern -- the functionality to scope down to a subtree of the results is the way to do this.

I believe the question has been answered so I'll go ahead and close the issue; if you have further questions please don't hesitate to ask though!


Last updated: Apr 17 2025 at 14:03 UTC