From f57c4e6d78cefc617ec06f2e6233eb8a076a11be Mon Sep 17 00:00:00 2001 From: David Peter Date: Mon, 5 Oct 2026 14:18:45 +0200 Subject: [PATCH] Support minutes and hours --- src/cli.rs | 6 ++++-- src/export/markup.rs | 4 ++-- src/options.rs | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 9a4aeeb..0a38675 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -291,13 +291,15 @@ fn build_command() -> Command { .short('u') .action(ArgAction::Set) .value_name("UNIT") - .value_parser(["µs", "us", "microsecond", "microseconds", "ms", "millisecond", "milliseconds", "s", "second", "seconds"]) + .value_parser(["µs", "us", "microsecond", "microseconds", "ms", "millisecond", "milliseconds", "s", "second", "seconds", "min", "minute", "minutes", "h", "hour", "hours"]) .help("Set the time unit to be used. If the option is not given, the time unit is determined automatically. \ This option affects the standard output as well as all export formats except for CSV and JSON.\n\ Possible values:\n \ * 'µs', 'us', 'microsecond', 'microseconds'\n \ * 'ms', 'millisecond', 'milliseconds'\n \ - * 's', 'second', 'seconds'"), + * 's', 'second', 'seconds'\n \ + * 'min', 'minute', 'minutes'\n \ + * 'h', 'hour', 'hours'"), ) .arg( Arg::new("export-asciidoc") diff --git a/src/export/markup.rs b/src/export/markup.rs index 576d3f1..3b8bc63 100644 --- a/src/export/markup.rs +++ b/src/export/markup.rs @@ -125,11 +125,11 @@ impl Exporter for T { fn serialize( &self, results: &[BenchmarkResult], - unit: Option, + time_unit: Option, sort_order: SortOrder, reference_index: Option, ) -> Result> { - let unit = unit.unwrap_or_else(|| determine_unit_from_results(results)); + let unit = time_unit.unwrap_or_else(|| determine_unit_from_results(results)); // Do not report ratios against another benchmark while the selected // reference is still pending in an intermediate export. let reference_pending = reference_index.is_some_and(|i| i >= results.len()); diff --git a/src/options.rs b/src/options.rs index 634e2b5..35eceb6 100644 --- a/src/options.rs +++ b/src/options.rs @@ -437,6 +437,8 @@ impl Options { Some("µs" | "us" | "microsecond" | "microseconds") => Some(TimeUnit::MicroSecond), Some("ms" | "millisecond" | "milliseconds") => Some(TimeUnit::MilliSecond), Some("s" | "second" | "seconds") => Some(TimeUnit::Second), + Some("min" | "minute" | "minutes") => Some(TimeUnit::Minute), + Some("h" | "hour" | "hours") => Some(TimeUnit::Hour), _ => None, };