Skip to content
Myr

Support minutes and hours

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

authored by David Peter · committed by David Peter · parent 418e43a · Browse files · 3 files+8 added−4 removed
This commit

State

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

Diff stats

3 files+8 added−4 removed

  • other:+8 added−4 removed

3 files+8 added−4 removed

modified:src/export/markup.rs+2 added-2 removed
123 unmodified lines
124impl<T: MarkupExporter> Exporter for T {125 fn serialize(126 &self,127 results: &[BenchmarkResult],128 unit: Option<TimeUnit>,128 time_unit: Option<TimeUnit>,129 sort_order: SortOrder,130 reference_index: Option<usize>,131 ) -> Result<Vec<u8>> {132 let unit = unit.unwrap_or_else(|| determine_unit_from_results(results));132 let unit = time_unit.unwrap_or_else(|| determine_unit_from_results(results));133 // Do not report ratios against another benchmark while the selected134 // reference is still pending in an intermediate export.135 let reference_pending = reference_index.is_some_and(|i| i >= results.len());136 let entries = relative_speed::compute(
10 unmodified lines
modified:src/cli.rs+4 added-2 removed
289 unmodified lines
290 .long("time-unit")291 .short('u')292 .action(ArgAction::Set)293 .value_name("UNIT")294 .value_parser(["µs", "us", "microsecond", "microseconds", "ms", "millisecond", "milliseconds", "s", "second", "seconds"])294 .value_parser(["µs", "us", "microsecond", "microseconds", "ms", "millisecond", "milliseconds", "s", "second", "seconds", "min", "minute", "minutes", "h", "hour", "hours"])295 .help("Set the time unit to be used. If the option is not given, the time unit is determined automatically. \296 This option affects the standard output as well as all export formats except for CSV and JSON.\n\297 Possible values:\n \298 * 'µs', 'us', 'microsecond', 'microseconds'\n \299 * 'ms', 'millisecond', 'milliseconds'\n \300 * 's', 'second', 'seconds'"),300 * 's', 'second', 'seconds'\n \301 * 'min', 'minute', 'minutes'\n \302 * 'h', 'hour', 'hours'"),303 )304 .arg(305 Arg::new("export-asciidoc")306 .long("export-asciidoc")
130 unmodified lines
modified:src/options.rs+2 added
435 unmodified lines
436 options.time_unit = match matches.get_one::<String>("time-unit").map(|s| s.as_str()) {437 Some("µs" | "us" | "microsecond" | "microseconds") => Some(TimeUnit::MicroSecond),438 Some("ms" | "millisecond" | "milliseconds") => Some(TimeUnit::MilliSecond),439 Some("s" | "second" | "seconds") => Some(TimeUnit::Second),440 Some("min" | "minute" | "minutes") => Some(TimeUnit::Minute),441 Some("h" | "hour" | "hours") => Some(TimeUnit::Hour),442 _ => None,443 };444445 if let Some(time) = matches.get_one::<String>("min-benchmarking-time") {
132 unmodified lines