| Crates.io | ninjatracing |
| lib.rs | ninjatracing |
| version | 0.1.0 |
| created_at | 2026-01-19 12:28:58.796712+00 |
| updated_at | 2026-01-19 12:28:58.796712+00 |
| description | Rust port of ninjatracing: converts Ninja build logs to Chrome Tracing format |
| homepage | https://github.com/BingHanLin/ninjatracing-rs |
| repository | https://github.com/BingHanLin/ninjatracing-rs |
| max_upload_size | |
| id | 2054515 |
| size | 83,701 |
Rust port of the ninjatracing Python script (originally from https://github.com/nico/ninjatracing). Converts Ninja build logs (.ninja_log) to Chrome Tracing format, enabling visualization of build performance in chrome://tracing or perfetto.dev.
From crates.io (Recommended)
cargo install ninjatracing
From source
cargo install --path .
Add this to your Cargo.toml:
[dependencies]
ninjatracing = "0.1"
Or with only the library (without CLI):
[dependencies]
ninjatracing = { version = "0.1", default-features = false }
ninjatracing [OPTIONS] <LOG_FILES>... > trace.json
| Argument | Description |
|---|---|
<LOG_FILES>... |
One or more .ninja_log files to parse. |
-a, --showall |
Report on last build step for all outputs. Default is to report just on the last (possibly incremental) build. |
-g, --granularity <US> |
Minimum length time-trace event to embed in microseconds (default: 50000). |
-e, --embed-time-trace |
Embed clang -ftime-trace json file found adjacent to a target file. |
# Basic usage
ninjatracing .ninja_log > trace.json
# Show all incremental steps
ninjatracing --showall .ninja_log > trace.json
# Embed clang traces
ninjatracing --embed-time-trace .ninja_log > trace.json
use ninjatracing::{log_to_dicts, TracingOptions};
use std::fs::File;
use std::io::BufReader;
fn main() -> anyhow::Result<()> {
let file = File::open(".ninja_log")?;
let reader = BufReader::new(file);
let options = TracingOptions {
show_all: false,
granularity: 50000,
embed_time_trace: false,
};
let events = log_to_dicts(reader, None, 42, &options)?;
println!("Found {} events", events.len());
Ok(())
}