Skip to main content

Crate tricord

Crate tricord 

Source
Expand description

tricord — scan a process tree’s wall time, CPU time, peak memory, and disk I/O, then write the result in Snakemake’s benchmark: directive TSV format (or, optionally, JSON). The companion binary is named tricorder.

The library exposes the same components the binary uses, so you can embed the sampler in another Rust tool when the CLI shape doesn’t fit (for example: pipeline coordinators that already manage their own subprocesses and just need the resource numbers).

§Quick start

use std::time::Duration;
use tricord::{
    run::{run_command, RunOptions},
    format::OutputFormat,
    SchemaMode,
};

let options = RunOptions {
    interval: Duration::from_millis(500),
    output_path: std::path::Path::new("/tmp/timing.tsv").into(),
    format: OutputFormat::Tsv,
    force_summary: false,
    trace_path: None,
    markdown_path: None,
    schema_mode: SchemaMode::Full,
};
let outcome = run_command("echo", &["hello".to_string()], &options).unwrap();
assert_eq!(outcome.exit_code(), 0);

Re-exports§

pub use format::OutputFormat;
pub use record::BenchmarkRecord;
pub use record::SchemaMode;
pub use record::TSV_HEADER;
pub use record::TSV_HEADER_FULL;
pub use record::tsv_header;
pub use run::RunOptions;
pub use run::RunOutcome;
pub use run::run_command;

Modules§

cli
Command-line argument schema.
format
Output writers: TSV (Snakemake-compatible), JSON, and a stderr summary.
record
The aggregate benchmark record.
run
End-to-end orchestration: spawn the child, run the sampler, write output.