jameysharp opened issue #7668:
Feature
The Firefox profiler format supports annotating timestamps or time-ranges with "markers", to show particular events on the same timeline as the profile. We could use markers in the guest profiler to indicate when profiling was suspended due to running a host-call.
Benefit
The guest profiler specifically only profiles WebAssembly guest code, so any time spent in host-calls is just absent from the profile. We'd present a more complete picture by marking those intervals so the user can see where host-calls happened, how long they took, and ideally what host-call was issued.
Implementation
As a starting point, Wasmtime's
Store::call_hook
, or its async variant, allows registering a callback for both exit from and entry to the guest. I don't think we can find out _what_ host-call triggered the exit that way, though.Also we don't get a reference to the
Store
in the callback, so we can't sample the stack at that point. That might be an oversight in the call-hook API.Alternatives
The profiler is usable without these markers. A long-running host-call just appears as a gap in the profile's timeline.
We might be able to do something with the
Linker
to wrap all the configured host-calls, rather than using thecall_hook
. That should at least allow us to record which host-call triggered each exit.
jameysharp added the enhancement label to Issue #7668.
jameysharp added the wasmtime label to Issue #7668.
Last updated: Nov 22 2024 at 16:03 UTC