2 个稳定版本

使用旧的 Rust 2015

1.1.0 2022 年 12 月 18 日
1.0.1 2019 年 1 月 26 日

#139性能分析

Download history 349/week @ 2024-03-14 434/week @ 2024-03-21 315/week @ 2024-03-28 392/week @ 2024-04-04 354/week @ 2024-04-11 353/week @ 2024-04-18 304/week @ 2024-04-25 693/week @ 2024-05-02 272/week @ 2024-05-09 432/week @ 2024-05-16 386/week @ 2024-05-23 579/week @ 2024-05-30 339/week @ 2024-06-06 457/week @ 2024-06-13 792/week @ 2024-06-20 596/week @ 2024-06-27

2,222 每月下载量
josh 中使用

MIT 许可证

18KB
345

将跟踪转换为 Chrome 的 跟踪事件格式

示例

Cargo.toml

rs_tracing = { version = "1.0", features = ["rs_tracing"] }

main.rs

fn main() {
    open_trace_file!(".").unwrap();
    {
        trace_scoped!("complete","custom data":"main");
        trace_expr!("trace_expr", println!("trace_expr"));
        trace_begin!("duration");
        println!("trace_duration");
        trace_end!("duration");
    }
    close_trace_file!();
}

也可以向所有宏添加自定义数据,格式类似于 serde_json::json! 宏,例如。

trace_scoped!("complete","custom":230,"more":"data");

lib.rs:

rs_tracing 是一个 crate,可以将跟踪事件输出到以 跟踪事件格式 的文件中。

该格式由 chrome://tracing 使用,输出也可以使用 trace2html 转换为 html。

如果 toml 文件中没有设置 rs_tracing 功能,则宏将扩展为空,但 trace_expr 仍将执行表达式,此外,还将删除 rs_tracing 的所有 crate 依赖项。

依赖项

~0–265KB