#tracing-layer #trace-logging #perfetto #tracing-subscriber #subscriber #tracing

tracing-perfetto

Tracing layer for recording spans and events as perfetto event format

6 releases

0.1.5 Jan 2, 2025
0.1.4 Dec 30, 2024
0.1.3 Nov 25, 2024
0.1.1 Jul 2, 2024

#233 in Debugging

Download history 300/week @ 2024-09-18 514/week @ 2024-09-25 603/week @ 2024-10-02 612/week @ 2024-10-09 686/week @ 2024-10-16 581/week @ 2024-10-23 697/week @ 2024-10-30 667/week @ 2024-11-06 508/week @ 2024-11-13 748/week @ 2024-11-20 474/week @ 2024-11-27 579/week @ 2024-12-04 661/week @ 2024-12-11 657/week @ 2024-12-18 440/week @ 2024-12-25 787/week @ 2025-01-01

2,627 downloads per month
Used in sparkles

MIT license

1.5MB
26K SLoC

tracing-perfetto

Overview

tracing-perfetto is a Layer for tracing-subscriber that outputs traces in perfetto's trace packet format that can be viewed with ui.perfetto.dev.

Usage

Add this near the beginning of main:

use tracing_perfetto::PerfettoLayer;
use tracing_subscriber::{registry::Registry, prelude::*};

let layer = PerfettoLayer::new(std::sync::Mutex::new(std::fs::File::create("/tmp/test.pftrace").unwrap()));
tracing_subscriber::registry().with(layer).init();

Open that file with ui.perfetto.dev:

Upgrade perfetto_trace.proto

  1. Download the latest perfetto_trace.proto into protos/peffetto_trace.proto.

  2. Run upgrade.rs

    • Windows cargo +nightly -Zscript upgrade.rs
    • *nix ./upgrade.rs
  3. Create a pull request with the changes.

License

Licensed under the MIT license

Dependencies

~3.5MB
~54K SLoC