bench/examples/readside-probe.rs
//! A counting probe over the serving path, so "gunnar reads the whole pack"
//! stops being an inference off page-cache residency and becomes a per-call
//! tally of what `upload-pack` asks the object store for.
//!
//! Not a bencher: it prints one JSON object and registers nothing. The driver
//! lives in [`gunnar_bench::readside`] because `gunnar.fetch_readside` runs the
//! same one (one implementation, not two).
//!
//! ```text
//! CARGO_TARGET_DIR=~/scratch/cargo/gunnar-amp \
//! cargo run --release --example readside-probe --manifest-path bench/Cargo.toml \
//! -- <repo.git> [from-ref] [to-ref]
//! ```
use anyhow::{Context, Result};
fn main() -> Result<()> {
let args: Vec<String> = std::env::args().collect();
let repo = std::path::PathBuf::from(
args.get(1)
.context("usage: readside-probe <repo.git> [from-ref] [to-ref]")?,
);
let from = args
.get(2)
.map(String::as_str)
.unwrap_or("refs/heads/yesterday");
let to = args.get(3).map(String::as_str).unwrap_or("refs/heads/main");
println!("{}", gunnar_bench::readside::probe(&repo, from, to)?);
Ok(())
}