Skip to content
Myr

Add --min-runs, closes #2

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by sharkdp · parent 5cdf013 · Browse files · 1 file+18 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−3 removed

  • other:+18 added−3 removed

1 file+18 added−3 removed

modified:src/main.rs+18 added-3 removed
1 unmodified line
2#[macro_use]3extern crate clap;4extern crate indicatif;56use std::cmp;7use std::process::{Command, Stdio};8use std::time::Instant;910use indicatif::{ProgressBar, ProgressStyle};
156 unmodified lines
167 .takes_value(true)168 .value_name("NUM")169 .help("Perform NUM warmup runs before the actual benchmark"),170 )171 .arg(172 Arg::with_name("min-runs")173 .long("min-runs")174 .short("m")175 .takes_value(true)176 .value_name("NUM")177 .help("Perform at least NUM runs for each command"),178 )179 .get_matches();180181 let str_to_u64 = |n| u64::from_str_radix(n, 10).ok();182183 // Process command line options184 let mut options = HyperfineOptions::default();173 options.warmup_count = matches174 .value_of("warmup")175 .and_then(|n| u64::from_str_radix(n, 10).ok());185 options.warmup_count = matches.value_of("warmup").and_then(&str_to_u64);186187 if let Some(min_runs) = matches.value_of("min-runs").and_then(&str_to_u64) {188 options.min_runs = cmp::max(1, min_runs);189 }190191 // Run the benchmarks192 let commands = matches.values_of("command").unwrap();193 for cmd in commands {194 run_benchmark(&cmd, &options);195 }
1 unmodified line