MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / sample

Function sample

src/commands/serve.rs:1065–1075  ·  view source on GitHub ↗
(
        mut store: StoreContextMut<Host>,
        f: impl FnOnce(&mut GuestProfiler, StoreContext<Host>),
    )

Source from the content-addressed store, hash-verified

1063 )?));
1064
1065 fn sample(
1066 mut store: StoreContextMut<Host>,
1067 f: impl FnOnce(&mut GuestProfiler, StoreContext<Host>),
1068 ) {
1069 let mut profiler = store.data_mut().guest_profiler.take().unwrap();
1070 f(
1071 Arc::get_mut(&mut profiler).expect("profiling doesn't support threads yet"),
1072 store.as_context(),
1073 );
1074 store.data_mut().guest_profiler = Some(profiler);
1075 }
1076
1077 // Hostcall entry/exit, etc.
1078 store.call_hook(|store, kind| {

Callers 2

setup_guest_profilerFunction · 0.70
setup_guest_profilerMethod · 0.70

Calls 7

get_mutFunction · 0.85
fFunction · 0.50
unwrapMethod · 0.45
takeMethod · 0.45
data_mutMethod · 0.45
expectMethod · 0.45
as_contextMethod · 0.45

Tested by

no test coverage detected