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

Method sample

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

Source from the content-addressed store, hash-verified

615 };
616
617 fn sample(
618 mut store: StoreContextMut<Host>,
619 f: impl FnOnce(&mut GuestProfiler, StoreContext<Host>),
620 ) {
621 let mut profiler = store.data_mut().guest_profiler.take().unwrap();
622 f(
623 Arc::get_mut(&mut profiler).expect("profiling doesn't support threads yet"),
624 store.as_context(),
625 );
626 store.data_mut().guest_profiler = Some(profiler);
627 }
628
629 store.call_hook(|store, kind| {
630 sample(store, |profiler, store| profiler.call_hook(store, kind));

Callers 2

setup_guest_profilerFunction · 0.45
setup_guest_profilerMethod · 0.45

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