Stream: git-wasmtime

Topic: wasmtime / PR #10507 Guest Profiling suport for component...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 23:14):

posborne requested wasmtime-core-reviewers for a review on PR #10507.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 23:14):

posborne requested fitzgen for a review on PR #10507.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 23:14):

posborne opened PR #10507 from posborne:guest-profiling-component-model to bytecodealliance:main:

This change adds support for using guest profiling with the component model. In addition to the core change to support attributing stack frames to constituent modules within a component, the cli run and serve commands are also updated to support using the --profile=guest cli option with components.

https://github.com/bytecodealliance/wasmtime/issues/8773
https://github.com/bytecodealliance/wasmtime/issues/7669

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 01 2025 at 23:22):

posborne commented on PR #10507:

Here's a couple samples from some simple components for the CLI and wasi-http. There's a couple frames missing from the CLI example so I think I am missing something from the component that isn't part of static_modules() individual functions which I'll try to find.

I'm also not at all confident on the API which would be best for all use cases for GuestProfiler in terms of how users are likely to want to register various components and modules. Here we support 1 component + multiple additional modules which was biased by the potential registrations in the run and serve commands with prelinking but definitely welcome ideas. I considered having a ProfileTarget enum or similar to abstract over things -- some approaches are a bit more challenging due to conditional compilation concerns.

wasmtime-run-profile-data.json
wasmtime-serve-profile-data.json

![image](https://github.com/user-attachments/assets/0adda5dd-939a-4778-97ee-1c2bda12a93a)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 00:44):

fitzgen submitted PR review:

LGTM modulo a couple nitpicks :+1:

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 00:44):

fitzgen created PR review comment:

Nitpick for here and elsewhere: we generally try to capitalize sentences and such in comments.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 00:44):

fitzgen created PR review comment:

"linarly"

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 00:44):

fitzgen created PR review comment:

It probably makes sense to use a builder-style API in the limit here, to allow users to specify all the various components and modules they are profiling, but this is totally fine for the moment.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 10:44):

FrankReh submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 10:44):

FrankReh created PR review comment:

Super nits: Is "past this point, ... from this point forward" redundant? Maybe I should understand the context better. Also, while here, I'll point out the title has "suport" in it, probably a typo.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 11:54):

FrankReh commented on PR #10507:

Drive-by comment:

I cloned the branch and was successful in creating a wasmtime-guest-profile.json with it that profiler.firefox.com accepted. The flame graph aspect of that UI didn't seem to work but presumably that has nothing to do with what this PR is accomplishing.

Thanks for making this feature possible!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 16:10):

posborne commented on PR #10507:

@FrankReh thanks for doing a check. In my testing, I was getting the flamegraph to work fine for both run and serve; what was your test setup? Usually when I didn't get flame graphs in the UI it was due to some part of the sampling not working correctly (but I can't discount something else going sideways unrelated to the profile itself).

Does the call tree view work?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 16:30):

FrankReh commented on PR #10507:

My bad. Even the flamegraph aspect is working. Embarrassing but I didn't recognize the pane as a valid flamegraph simply because of the grey color and my test case having very little happening besides two function calls writing to stdout repeatedly. In my defense, first time running profiling for a wasm module and first time using profiler.firefox.com web app.

Thanks again for working to get this functionality added.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 18:13):

posborne submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 18:13):

posborne created PR review comment:

Yeah, I noticed that as well when I was making updates. Should be addressed with the fixup.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 18:41):

posborne updated PR #10507.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 18:44):

posborne commented on PR #10507:

My fixups got autosquashed when I rebased to resolve a trivial conflict in run.rs but updates were all very minor:

For now, keeping the API as-is to keep the collateral for this change smaller and (mostly) not require updates for users of the API (may require very minor updates to type hint).

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 18:48):

posborne updated PR #10507.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 19:33):

fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 02 2025 at 19:56):

fitzgen merged PR #10507.


Last updated: Apr 17 2025 at 23:03 UTC