2 stable releases

Uses old Rust 2015

1.1.0 Dec 18, 2022
1.0.1 Jan 26, 2019

#144 in Profiling

Download history 445/week @ 2024-01-04 243/week @ 2024-01-11 359/week @ 2024-01-18 306/week @ 2024-01-25 319/week @ 2024-02-01 588/week @ 2024-02-08 307/week @ 2024-02-15 218/week @ 2024-02-22 365/week @ 2024-02-29 591/week @ 2024-03-07 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 336/week @ 2024-04-18

1,436 downloads per month
Used in josh

MIT license

18KB
345 lines

Traces to Chrome's trace_event format

Example

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!();
}

also possible to add custom data to all the macros formated like the serde_json::json! macro e.g.

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

lib.rs:

rs_tracing is a crate that outputs trace events to a file in the trace event format.

This format is used by chrome://tracing the output can also be converted to html with trace2html.

If the feature rs_tracing is not set in the toml file the macros expand to nothing, with the exception of trace_expr that will still execute the expression, also all crate dependencies of rs_tracing will be removed.

Dependencies

~0–270KB