#wasmtime #profiler

wasmprof

wasmprof 允许分析运行在wasmtime内部的代码

6个版本 (破坏性更新)

新增 0.7.0 2024年8月2日
0.5.0 2024年4月9日
0.4.0 2024年4月2日
0.3.0 2023年11月16日
0.1.0 2023年5月9日

#341性能分析

Download history 19/week @ 2024-04-14 198/week @ 2024-04-21 17/week @ 2024-04-28 25/week @ 2024-05-05 39/week @ 2024-05-12 12/week @ 2024-05-19 13/week @ 2024-05-26 8/week @ 2024-06-02 42/week @ 2024-06-09 27/week @ 2024-06-16 6/week @ 2024-06-23 61/week @ 2024-06-30 11/week @ 2024-07-07 16/week @ 2024-07-14 1/week @ 2024-07-21 172/week @ 2024-07-28

每月下载 217

MIT 许可证

22KB
406

wasmprof

一个库,允许分析运行在wasmtime内部的代码

如何使用

// First you want to create a `ProfilerBuilder` like so:
// Here we are assuming that you have a `Wasmtime::Store` to pass to the builder.
let builder = ProfilerBuilder::new(&mut store);

// Then you can set the frequency at which it's going to sample and the kind of weight to use:
// Here we are setting the frequency to 1000 (sampling 1000 in a second) and we chose `Fuel` as the weight
let builder = builder
    .frequency(1000)
    .weight_unit(wasmprof::WeightUnit::Fuel);

// finally we can start profiling
builder.profile(|store| {
    // here you would invoke some wasm function though wasmtime, something like this:
    let func = instance
                .get_typed_func::<i32, i32>(store.as_context_mut(), "fib")
                .unwrap();
    func.call(store.as_context_mut(), 40).unwrap()
})

在示例文件夹中可以找到一个完整的示例: 完整示例

依赖项

~14–22MB
~327K SLoC