https://github.com/thoren-d/tracing-chrome
A library for generating chrome://tracing traces in Rust.
https://github.com/thoren-d/tracing-chrome
chrome profiling rust tracing
Last synced: about 2 months ago
JSON representation
A library for generating chrome://tracing traces in Rust.
- Host: GitHub
- URL: https://github.com/thoren-d/tracing-chrome
- Owner: thoren-d
- License: mit
- Created: 2020-08-20T06:48:41.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2024-03-15T21:30:00.000Z (about 1 year ago)
- Last Synced: 2025-03-28T14:08:22.392Z (2 months ago)
- Topics: chrome, profiling, rust, tracing
- Language: Rust
- Homepage:
- Size: 97.7 KB
- Stars: 104
- Watchers: 2
- Forks: 20
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
tracing-chrome
======[](https://crates.io/crates/tracing-chrome)
[](https://docs.rs/tracing-chrome/)

# Overview
tracing-chrome is a Layer for [tracing-subscriber](https://crates.io/crates/tracing-subscriber) that outputs traces in Chrome's trace viewer format that can be viewed with `chrome://tracing` or [ui.perfetto.dev](https://ui.perfetto.dev).
# Usage
Add this near the beginning of `main`:
```rust
use tracing_chrome::ChromeLayerBuilder;
use tracing_subscriber::{registry::Registry, prelude::*};let (chrome_layer, _guard) = ChromeLayerBuilder::new().build();
tracing_subscriber::registry().with(chrome_layer).init();
```When `_guard` is dropped, your trace will be in a file like `trace-1668480819035032.json`.
Open that file with [ui.perfetto.dev](https://ui.perfetto.dev) (or `chrome://tracing`) and take a look at your pretty trace.

# License
Licensed under the [MIT license](http://opensource.org/licenses/MIT)
## Contributions
Unless you state otherwise, any contribution intentionally submitted for inclusion in the work shall be licensed as above.