Skip to content
Myr

Use uom

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 9ec7a9c · Browse files · 15 files+441 added−425 removed
This commit

State

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

Diff stats

15 files+441 added−425 removed

  • other:+441 added−425 removed

15 files+441 added−425 removed

modified:src/benchmark/benchmark_result.rs+2 added-2 removed
1use std::collections::BTreeMap;23use serde::Serialize;45use crate::benchmark::{measurement::Measurements, quantity::Second};5use crate::benchmark::{measurement::Measurements, quantity::Time};67/// Parameter value and whether it was used in the command line template8#[derive(Debug, Default, Clone, Serialize, PartialEq)]9pub struct Parameter {
26 unmodified lines
36}3738impl BenchmarkResult {39 /// The average wall clock time40 pub fn mean_wall_clock_time(&self) -> Second {40 pub fn mean_wall_clock_time(&self) -> Time {41 self.measurements.time_wall_clock_mean()42 }4344 /// The full command line of the program that is being benchmarked, possibly including a list of
19 unmodified lines
modified:src/benchmark/executor.rs+18 added-14 removed
2 unmodified lines
3use std::process::ExitStatus;45use crate::benchmark::measurement::Measurement;6use crate::benchmark::measurement::Measurements;7use crate::benchmark::quantity::Byte;8use crate::benchmark::quantity::Second;7use crate::benchmark::quantity::Information;8use crate::benchmark::quantity::InformationQuantity;9use crate::benchmark::quantity::{Time, TimeQuantity};10use crate::command::Command;11use crate::options::{12 CmdFailureAction, CommandInputPolicy, CommandOutputPolicy, Options, OutputStyleOption, Shell,13};
158 unmodified lines
172 fn calibrate(&mut self) -> Result<()> {173 Ok(())174 }175175 fn time_overhead(&self) -> Second {176 Second::zero()176 fn time_overhead(&self) -> Time {177 Time::zero()178 }179}180181pub struct ShellExecutor<'a> {
41 unmodified lines
223 &command.get_command_line(),224 )?;225226 // Subtract shell spawning time226 fn ensure_non_negative(time: Second) -> Second {227 if time < Second::zero() {228 Second::zero()227 fn ensure_non_negative(time: Time) -> Time {228 if time < Time::zero() {229 Time::zero()230 } else {231 time232 }233 }
76 unmodified lines
310311 Ok(())312 }313313 fn time_overhead(&self) -> Second {314 fn time_overhead(&self) -> Time {315 self.shell_spawning_time.as_ref().unwrap().time_wall_clock316 }317}318
8 unmodified lines
327 }328329 fn extract_time<S: AsRef<str>>(sleep_command: S) -> Time {330 assert!(sleep_command.as_ref().starts_with("sleep "));330 Second::new(331 Time::from_seconds(332 sleep_command333 .as_ref()334 .trim_start_matches("sleep ")335 .parse::<f64>()
23 unmodified lines
359 };360361 Ok(Measurement {362 time_wall_clock: Self::extract_time(command.get_command_line()),362 time_user: Second::zero(),363 time_system: Second::zero(),364 peak_memory_usage: Byte::new(0),363 time_user: Time::zero(),364 time_system: Time::zero(),365 peak_memory_usage: Information::from_bytes(0),366 exit_status,367 })368 }369
2 unmodified lines
372 }373374 fn time_overhead(&self) -> Time {375 match &self.shell {375 None => Second::zero(),376 None => Time::zero(),377 Some(shell) => Self::extract_time(shell),378 }379 }380}381382#[test]383fn test_mock_executor_extract_time() {383 assert_eq!(MockExecutor::extract_time("sleep 0.1"), Second::new(0.1));384 assert_eq!(385 MockExecutor::extract_time("sleep 0.1"),386 Time::from_seconds(0.1)387 );388}
modified:src/benchmark/measurement.rs+22 added-15 removed
1use std::process::ExitStatus;23use serde::Serialize;45use crate::benchmark::quantity::{max, mean, median, min, standard_deviation, Byte, Second};5use crate::benchmark::quantity::{6 max, mean, median, min, second, serialize_information, serialize_time, standard_deviation,7 Information, Time, TimeQuantity,8};9use crate::outlier_detection::modified_zscores;10use crate::util::exit_code::extract_exit_code;1112fn serialize_exit_status<S>(exit_status: &ExitStatus, serializer: S) -> Result<S::Ok, S::Error>
9 unmodified lines
22/// Performance metric measurements and exit code for a single run23#[derive(Debug, Clone, Default, Serialize, PartialEq)]24pub struct Measurement {25 /// Elapsed wall clock time (real time)26 #[serde(serialize_with = "serialize_time")]23 pub time_wall_clock: Second,27 pub time_wall_clock: Time,2829 /// Time spent in user mode30 #[serde(serialize_with = "serialize_time")]26 pub time_user: Second,31 pub time_user: Time,3233 /// Time spent in kernel mode34 #[serde(serialize_with = "serialize_time")]29 pub time_system: Second,35 pub time_system: Time,3637 /// Maximum memory usage of the process38 #[serde(serialize_with = "serialize_information")]32 pub peak_memory_usage: Byte,39 pub peak_memory_usage: Information,4041 // The exit status of the process42 #[serde(rename = "exit_code", serialize_with = "serialize_exit_status")]43 pub exit_status: ExitStatus,
20 unmodified lines
64 pub fn push(&mut self, measurement: Measurement) {65 self.measurements.push(measurement);66 }6761 pub fn wall_clock_times(&self) -> Vec<Second> {68 pub fn wall_clock_times(&self) -> Vec<Time> {69 self.measurements70 .iter()71 .map(|m| m.time_wall_clock)72 .collect()73 }7475 /// The average wall clock time69 pub fn time_wall_clock_mean(&self) -> Second {76 pub fn time_wall_clock_mean(&self) -> Time {77 mean(&self.wall_clock_times())78 }7980 /// The standard deviation of all wall clock times. Not available if only one run has been performed74 pub fn stddev(&self) -> Option<Second> {81 pub fn stddev(&self) -> Option<Time> {82 let times = self.wall_clock_times();8384 if times.len() < 2 {85 None
2 unmodified lines
88 }89 }9091 /// The median wall clock time85 pub fn median(&self) -> Second {92 pub fn median(&self) -> Time {93 median(&self.wall_clock_times())94 }9596 /// The minimum wall clock time90 pub fn min(&self) -> Second {97 pub fn min(&self) -> Time {98 min(&self.wall_clock_times())99 }100101 /// The maximum wall clock time95 pub fn max(&self) -> Second {102 pub fn max(&self) -> Time {103 max(&self.wall_clock_times())104 }105106 /// The average user time100 pub fn time_user_mean(&self) -> Second {107 pub fn time_user_mean(&self) -> Time {108 mean(109 &self110 .measurements111 .iter()
2 unmodified lines
114 )115 }116117 /// The average system time111 pub fn time_system_mean(&self) -> Second {118 pub fn time_system_mean(&self) -> Time {119 mean(120 &self121 .measurements122 .iter()
1 unmodified line
124 .collect::<Vec<_>>(),125 )126 }127121 pub fn peak_memory_usage_mean(&self) -> Byte {128 pub fn peak_memory_usage_mean(&self) -> Information {129 self.measurements130 .iter()131 .map(|m| m.peak_memory_usage)132 .max_by(|a, b| a.partial_cmp(b).unwrap()) // TODO
4 unmodified lines
137 modified_zscores(138 &self139 .wall_clock_times()140 .iter()134 .map(|t| t.value_in::<Second>()) // TODO141 .map(|t| t.value_in::<second>()) // TODO142 .collect::<Vec<_>>(),143 )144 }145
4 unmodified lines
modified:src/benchmark/mod.rs+6 added-6 removed
10 unmodified lines
1112use crate::benchmark::benchmark_result::Parameter;13use crate::benchmark::executor::BenchmarkIteration;14use crate::benchmark::measurement::{Measurement, Measurements};15use crate::benchmark::quantity::{MilliSecond, Second};15use crate::benchmark::quantity::{const_time_from_seconds, Time, TimeQuantity};16use crate::command::Command;17use crate::options::{18 CmdFailureAction, CommandOutputPolicy, ExecutorKind, Options, OutputStyleOption,19};
12 unmodified lines
3233use self::executor::Executor;3435/// Threshold for warning about fast execution time36pub const MIN_EXECUTION_TIME: MilliSecond = MilliSecond::new(5.);36pub const MIN_EXECUTION_TIME: Time = const_time_from_seconds(0.005);3738pub struct Benchmark<'a> {39 number: usize,40 command: &'a Command<'a>,
220 unmodified lines
261 None262 };263264 let preparation_result = run_preparation_command()?;265 let preparation_overhead = preparation_result.map_or(Second::zero(), |res| {265 let preparation_overhead = preparation_result.map_or(Time::zero(), |res| {266 res.time_wall_clock + self.executor.time_overhead()267 });268269 // Initial timing run
20 unmodified lines
290 );291 }292293 let conclusion_result = run_conclusion_command()?;294 let conclusion_overhead = conclusion_result.map_or(Second::zero(), |res| {294 let conclusion_overhead = conclusion_result.map_or(Time::zero(), |res| {295 res.time_wall_clock + self.executor.time_overhead()296 });297298 // Determine number of benchmark runs
1 unmodified line
300 / (result.time_wall_clock301 + self.executor.time_overhead()302 + preparation_overhead303 + conclusion_overhead))304 .get::<ratio>() as u64;304 .get::<quantity::ratio>() as u64;305306 let count = {307 let min = cmp::max(runs_in_min_time, self.options.run_bounds.min);308
122 unmodified lines
431 if matches!(self.options.executor_kind, ExecutorKind::Shell(_))432 && measurements433 .wall_clock_times()434 .iter()435 .any(|&t| t < MIN_EXECUTION_TIME.convert_to::<Second>())435 .any(|&t| t < MIN_EXECUTION_TIME)436 {437 warnings.push(Warnings::FastExecutionTime);438 }439
63 unmodified lines
modified:src/benchmark/quantity.rs+130 added-198 removed
1use std::{2 fmt::{self, Display, Formatter},3 ops::{Add, Div, Sub},4};1use core::f64;2use std::marker::PhantomData;36use serde::{ser::SerializeStruct, Serialize, Serializer};4use serde::ser::SerializeStruct;5use serde::Serializer;6use uom::{si, Conversion};78pub trait IsQuantity {9 type Value;8pub use uom::si::information::{byte, kibibyte};9pub use uom::si::ratio::ratio;10pub use uom::si::time::{microsecond, millisecond, nanosecond, second};1111 const IS_TIME: bool;12 const METRIC_PREFIX_TIME: i32;13 const IS_INFORMATION: bool;14 const BINARY_PREFIX_INFORMATION: i32;12pub use si::f64::Ratio;13pub use si::f64::Time;14pub use si::u64::Information;1516 fn unsafe_from(value: Self::Value) -> Self;17}1819#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd)] // TODO: check partialord20pub struct Quantity<21 Value,22 const IS_TIME: bool,23 const METRIC_PREFIX_TIME: i32,24 const IS_INFORMATION: bool,25 const BINARY_PREFIX_INFORMATION: i32,26>(Value);2728impl<29 Value,30 const IS_TIME: bool,31 const METRIC_PREFIX_TIME: i32,32 const IS_INFORMATION: bool,33 const BINARY_PREFIX_INFORMATION: i32,34 > IsQuantity35 for Quantity<Value, IS_TIME, METRIC_PREFIX_TIME, IS_INFORMATION, BINARY_PREFIX_INFORMATION>36{37 type Value = Value;38 const IS_TIME: bool = IS_TIME;39 const METRIC_PREFIX_TIME: i32 = METRIC_PREFIX_TIME;40 const IS_INFORMATION: bool = IS_INFORMATION;41 const BINARY_PREFIX_INFORMATION: i32 = BINARY_PREFIX_INFORMATION;4243 fn unsafe_from(value: Self::Value) -> Self {44 Self(value)16pub trait TimeQuantity {17 fn zero() -> Time {18 Time::new::<second>(0.0)19 }46}2048type Time<const PREFIX: i32> = Quantity<f64, true, PREFIX, false, 0>;49type Information<const PREFIX: i32> = Quantity<u64, false, 0, true, PREFIX>;5051pub type Second = Time<0>;52pub type MilliSecond = Time<-3>;53pub type MicroSecond = Time<-6>;5455pub type Byte = Information<0>;56pub type KibiByte = Information<10>;57pub type MebiByte = Information<20>;58pub type GibiByte = Information<30>;59pub type TebiByte = Information<40>;6061impl<62 Value: Copy + Default,63 const IS_TIME: bool,64 const METRIC_PREFIX_TIME: i32,65 const IS_INFORMATION: bool,66 const BINARY_PREFIX_INFORMATION: i32,67 > Quantity<Value, IS_TIME, METRIC_PREFIX_TIME, IS_INFORMATION, BINARY_PREFIX_INFORMATION>68{69 pub const fn new(value: Value) -> Self {70 Self(value)21 fn from_seconds(value: f64) -> Time {22 Time::new::<second>(value)23 }2473 pub fn zero() -> Self {74 Self::new(Value::default())25 fn from_milliseconds(value: f64) -> Time {26 Time::new::<millisecond>(value)27 }2877 pub fn value_in<TargetUnit: IsQuantity>(&self) -> Value {78 const {79 assert!(IS_TIME == TargetUnit::IS_TIME);80 assert!(METRIC_PREFIX_TIME == TargetUnit::METRIC_PREFIX_TIME);81 assert!(IS_INFORMATION == TargetUnit::IS_INFORMATION);82 assert!(BINARY_PREFIX_INFORMATION == TargetUnit::BINARY_PREFIX_INFORMATION);83 }8485 self.029 fn from_microseconds(value: f64) -> Time {30 Time::new::<microsecond>(value)31 }3288 const fn unit_name(&self) -> &'static str {89 match (IS_TIME, IS_INFORMATION) {90 (true, false) => match METRIC_PREFIX_TIME {91 -6 => "µs",92 -3 => "ms",93 0 => "s",94 _ => unreachable!(),95 },96 (false, true) => match BINARY_PREFIX_INFORMATION {97 0 => "B",98 10 => "KiB",99 20 => "MiB",100 30 => "GiB",101 40 => "TiB",102 _ => unreachable!(),103 },104 _ => unreachable!(),105 }33 fn from_nanoseconds(value: f64) -> Time {34 Time::new::<nanosecond>(value)35 }36108 const fn unit_name_long(&self) -> &'static str {109 match (IS_TIME, IS_INFORMATION) {110 (true, false) => match METRIC_PREFIX_TIME {111 -6 => "microsecond",112 -3 => "millisecond",113 0 => "second",114 _ => unreachable!(),115 },116 (false, true) => match BINARY_PREFIX_INFORMATION {117 0 => "byte",118 10 => "kibibyte",119 20 => "mebibyte",120 30 => "gibibyte",121 40 => "tebibyte",122 _ => unreachable!(),123 },124 _ => unreachable!(),125 }126 }127}37 // fn square(&self) -> Time;38129impl<const METRIC_PREFIX_TIME: i32> Time<METRIC_PREFIX_TIME> {130 pub fn convert_to<TargetUnit: IsQuantity<Value = f64>>(&self) -> TargetUnit {131 let factor = 10_f64.powi(METRIC_PREFIX_TIME - TargetUnit::METRIC_PREFIX_TIME);39 fn value_in<U>(&self) -> f6440 where41 U: si::time::Unit + Conversion<f64, T = f64>;42133 TargetUnit::unsafe_from(self.0 * factor)134 }43 fn to_string<U>(&self, u: U) -> String44 where45 U: si::time::Unit + Conversion<f64, T = f64>;46}47137impl<const METRIC_PREFIX_TIME: i32> Add<Time<METRIC_PREFIX_TIME>> for Time<METRIC_PREFIX_TIME> {138 type Output = Time<METRIC_PREFIX_TIME>;48impl TimeQuantity for Time {49 fn value_in<U>(&self) -> f6450 where51 U: si::time::Unit + Conversion<f64, T = f64>,52 {53 self.get::<U>()54 }55140 fn add(self, rhs: Time<METRIC_PREFIX_TIME>) -> Self::Output {141 Time::new(self.0 + rhs.0)56 fn to_string<U>(&self, u: U) -> String57 where58 U: si::time::Unit + Conversion<f64, T = f64>,59 {60 format!(61 "{:.3}",62 self.into_format_args(u, uom::fmt::DisplayStyle::Abbreviation)63 )64 }65}66145impl<const METRIC_PREFIX_TIME: i32> Sub<Time<METRIC_PREFIX_TIME>> for Time<METRIC_PREFIX_TIME> {146 type Output = Time<METRIC_PREFIX_TIME>;147148 fn sub(self, rhs: Time<METRIC_PREFIX_TIME>) -> Self::Output {149 Time::new(self.0 - rhs.0)67pub const fn const_time_from_seconds(value: f64) -> Time {68 // Quantity::new in uom is not yet const: https://docs.rs/uom/0.36.0/uom/si/struct.Quantity.html69 Time {70 dimension: PhantomData,71 units: PhantomData,72 value,73 }74}75153impl<const METRIC_PREFIX_TIME: i32> Div<Time<METRIC_PREFIX_TIME>> for Time<METRIC_PREFIX_TIME> {154 type Output = f64;76pub trait InformationQuantity {77 fn zero() -> Information {78 Information::new::<byte>(0)79 }80156 fn div(self, rhs: Time<METRIC_PREFIX_TIME>) -> Self::Output {157 self.0 / rhs.081 fn from_bytes(value: u64) -> Information {82 Information::new::<byte>(value)83 }159}84161impl<const METRIC_PREFIX_TIME: i32> Display for Time<METRIC_PREFIX_TIME> {162 fn fmt(&self, f: &mut Formatter) -> fmt::Result {163 let prefix = match METRIC_PREFIX_TIME {164 -6 => "µ",165 -3 => "m",166 0 => "s",167 _ => unreachable!(),168 };169 write!(f, "{} {}s", self.0, prefix)85 fn from_kibibytes(value: u64) -> Information {86 Information::new::<kibibyte>(value)87 }8889 fn value_in<U>(&self) -> u6490 where91 U: si::information::Unit + Conversion<u64, T = uom::num_rational::Ratio<u64>>;9293 fn to_string<U>(&self, u: U) -> String94 where95 U: si::information::Unit + Conversion<u64, T = uom::num_rational::Ratio<u64>>;96}97173impl<const BINARY_PREFIX_INFORMATION: i32> Display for Information<BINARY_PREFIX_INFORMATION> {174 fn fmt(&self, f: &mut Formatter) -> fmt::Result {175 let prefix = match BINARY_PREFIX_INFORMATION {176 0 => "",177 10 => "Ki",178 20 => "Mi",179 30 => "Gi",180 40 => "Ti",181 _ => unreachable!(),182 };183 write!(f, "{} {}B", self.0, prefix)98impl InformationQuantity for Information {99 fn value_in<U>(&self) -> u64100 where101 U: si::information::Unit + Conversion<u64, T = uom::num_rational::Ratio<u64>>,102 {103 self.get::<U>()104 }185}105187impl<188 Value: Copy + Default + Serialize,189 const IS_TIME: bool,190 const METRIC_PREFIX_TIME: i32,191 const IS_INFORMATION: bool,192 const BINARY_PREFIX_INFORMATION: i32,193 > Serialize194 for Quantity<Value, IS_TIME, METRIC_PREFIX_TIME, IS_INFORMATION, BINARY_PREFIX_INFORMATION>195{196 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>106 fn to_string<U>(&self, u: U) -> String107 where198 S: Serializer,108 U: si::information::Unit + Conversion<u64, T = uom::num_rational::Ratio<u64>>,109 {200 let mut state = serializer.serialize_struct("Quantity", 2)?;201 state.serialize_field("value", &self.0)?;202 state.serialize_field("unit", self.unit_name())?;203 state.serialize_field("unit_long", self.unit_name_long())?;204 state.end()110 format!(111 "{}",112 self.into_format_args(u, uom::fmt::DisplayStyle::Abbreviation)113 )114 }115}116117pub fn serialize_time<S>(t: &Time, s: S) -> Result<S::Ok, S::Error>118where119 S: Serializer,120{121 let mut state = s.serialize_struct("Time", 3)?;122 state.serialize_field("value", &t.value)?;123 state.serialize_field("unit", "second")?;124 state.end()125}126127pub fn serialize_information<S>(i: &Information, s: S) -> Result<S::Ok, S::Error>128where129 S: Serializer,130{131 let mut state = s.serialize_struct("Information", 3)?;132 state.serialize_field("value", &i.value)?;133 state.serialize_field("unit", "byte")?;134 state.end()135}136137macro_rules! quantity_fn {138 ($name:ident, $unwrapped_values:ident, $body:expr) => {210 pub fn $name<211 const IS_TIME: bool,212 const METRIC_PREFIX_TIME: i32,213 const IS_INFORMATION: bool,214 const BINARY_PREFIX_INFORMATION: i32,215 >(216 values: &[Quantity<217 f64,218 IS_TIME,219 METRIC_PREFIX_TIME,220 IS_INFORMATION,221 BINARY_PREFIX_INFORMATION,222 >],223 ) -> Quantity<f64, IS_TIME, METRIC_PREFIX_TIME, IS_INFORMATION, BINARY_PREFIX_INFORMATION> {224 let $unwrapped_values: Vec<f64> = values.iter().map(|v| v.0).collect();139 pub fn $name(values: &[Time]) -> Time {140 let $unwrapped_values: Vec<_> = values.iter().map(|q| q.value_in::<second>()).collect();141 let result_value = $body;226 Quantity::new(result_value)142143 Time::new::<second>(result_value)144 }145 };146}147
6 unmodified lines
154 statistical::standard_deviation(&values, Some(mean_value))155});156157#[test]241fn test_quantity() {242 let time = MilliSecond::new(123.4);243 assert_eq!(time.value_in::<MilliSecond>(), 123.4);158fn test_time() {159 let time = Time::from_milliseconds(123.4);160 assert_eq!(time.value_in::<millisecond>(), 123.4);161245 let time_s = time.convert_to::<Second>();246 approx::assert_relative_eq!(time_s.value_in::<Second>(), 0.1234);162 let time_s = time.value_in::<second>();163 approx::assert_relative_eq!(time_s, 0.1234);164248 let time_us = time.convert_to::<MicroSecond>();249 approx::assert_relative_eq!(time_us.value_in::<MicroSecond>(), 123400.0);165 let time_us = time.value_in::<microsecond>();166 approx::assert_relative_eq!(time_us, 123400.0);167}168169#[test]170fn test_information() {171 let information = Information::from_kibibytes(8);172 assert_eq!(information.value_in::<byte>(), 8192);173174 let information_kib = information.value_in::<kibibyte>();175 assert_eq!(information_kib, 8);176}177178#[test]179fn test_format() {254 let time = MilliSecond::new(123.4);255 assert_eq!(time.to_string(), "123.4 ms");180 let time = Time::from_milliseconds(123.4);181 assert_eq!(time.to_string(second), "0.123 s");182 assert_eq!(time.to_string(millisecond), "123.400 ms");183 assert_eq!(time.to_string(microsecond), "123400.000 µs");184257 let peak_memory_usage = KibiByte::new(8);258 assert_eq!(peak_memory_usage.to_string(), "8 KiB");185 let peak_memory_usage = Information::from_kibibytes(8);186 assert_eq!(peak_memory_usage.to_string(byte), "8192 B");187 assert_eq!(peak_memory_usage.to_string(kibibyte), "8 KiB");188}189190#[test]191fn test_mean() {263 let values = vec![MilliSecond::new(123.4), MilliSecond::new(234.5)];192 let values = vec![193 Time::from_milliseconds(123.4),194 Time::from_milliseconds(234.5),195 ];196 let result = mean(&values);265 assert_eq!(result.to_string(), "178.95 ms");197 assert_eq!(result.to_string(millisecond), "178.950 ms");198}
modified:src/benchmark/relative_speed.rs+15 added-12 removed
1use std::cmp::Ordering;23use super::benchmark_result::BenchmarkResult;4use crate::{benchmark::quantity::Second, options::SortOrder};4use crate::{5 benchmark::quantity::{self, Ratio, Time, TimeQuantity},6 options::SortOrder,7};89#[derive(Debug)]10pub struct BenchmarkResultWithRelativeSpeed<'a> {11 pub result: &'a BenchmarkResult,
42 unmodified lines
54 // Separate benchmarks can have identical names and measurements.55 let is_reference = std::ptr::eq(result, reference);56 let relative_ordering = compare_mean_time(result, reference);5755 if result.mean_wall_clock_time() == Second::zero()56 || reference.mean_wall_clock_time() == Second::zero()58 if result.mean_wall_clock_time() == Time::zero()59 || reference.mean_wall_clock_time() == Time::zero()60 {61 return BenchmarkResultWithRelativeSpeed {62 result,63 relative_speed: if is_reference { 1.0 } else { f64::INFINITY },
4 unmodified lines
68 }6970 let ratio = match relative_ordering {71 Ordering::Less => reference.mean_wall_clock_time() / result.mean_wall_clock_time(),69 Ordering::Equal => 1.0,72 Ordering::Equal => Ratio::new::<quantity::ratio>(1.0),73 Ordering::Greater => {74 result.mean_wall_clock_time() / reference.mean_wall_clock_time()75 }76 };
39 unmodified lines
116 results: &'a [BenchmarkResult],117 reference: &'a BenchmarkResult,118 sort_order: SortOrder,119) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'a>>> {117 if fastest_of(results).mean_wall_clock_time() == Second::zero()118 || reference.mean_wall_clock_time() == Second::zero()120 if fastest_of(results).mean_wall_clock_time() == Time::zero()121 || reference.mean_wall_clock_time() == Time::zero()122 {123 return None;124 }125
5 unmodified lines
131 sort_order: SortOrder,132) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'_>>> {133 let fastest = fastest_of(results);134132 if fastest.mean_wall_clock_time() == Second::zero() {135 if fastest.mean_wall_clock_time() == Time::zero() {136 return None;137 }138139 Some(compute_relative_speeds(results, fastest, sort_order))
14 unmodified lines
154 use std::{collections::BTreeMap, process::ExitStatus};155156 use crate::benchmark::{157 measurement::{Measurement, Measurements},155 quantity::Byte,158 quantity::{Information, InformationQuantity},159 };160161 BenchmarkResult {162 command: name.into(),163 measurements: Measurements {164 measurements: vec![Measurement {162 time_wall_clock: Second::new(mean),163 time_user: Second::new(mean),164 time_system: Second::zero(),165 peak_memory_usage: Byte::new(1024),165 time_wall_clock: Time::from_seconds(mean),166 time_user: Time::from_seconds(mean),167 time_system: Time::zero(),168 peak_memory_usage: Information::from_bytes(1024),169 exit_status: ExitStatus::default(),170 }],171 },172 parameters: BTreeMap::new(),
67 unmodified lines
modified:src/benchmark/scheduler.rs+16 added-32 removed
206 unmodified lines
207 - command: sleep 0.123208 measurements:209 - time_wall_clock:210 value: 0.123211 unit: s212 unit_long: second211 unit: second212 time_user:213 value: 0215 unit: s216 unit_long: second214 unit: second215 time_system:216 value: 0219 unit: s220 unit_long: second217 unit: second218 peak_memory_usage:219 value: 0223 unit: B224 unit_long: byte220 unit: byte221 exit_code: 0222 - time_wall_clock:223 value: 0.123228 unit: s229 unit_long: second224 unit: second225 time_user:226 value: 0232 unit: s233 unit_long: second227 unit: second228 time_system:229 value: 0236 unit: s237 unit_long: second230 unit: second231 peak_memory_usage:232 value: 0240 unit: B241 unit_long: byte233 unit: byte234 exit_code: 0235 - command: sleep 0.456236 measurements:237 - time_wall_clock:238 value: 0.456247 unit: s248 unit_long: second239 unit: second240 time_user:241 value: 0251 unit: s252 unit_long: second242 unit: second243 time_system:244 value: 0255 unit: s256 unit_long: second245 unit: second246 peak_memory_usage:247 value: 0259 unit: B260 unit_long: byte248 unit: byte249 exit_code: 0250 - time_wall_clock:251 value: 0.456264 unit: s265 unit_long: second252 unit: second253 time_user:254 value: 0268 unit: s269 unit_long: second255 unit: second256 time_system:257 value: 0272 unit: s273 unit_long: second258 unit: second259 peak_memory_usage:260 value: 0276 unit: B277 unit_long: byte261 unit: byte262 exit_code: 0263 "#);264265 Ok(())
1 unmodified line
modified:src/export/csv.rs+27 added-27 removed
2 unmodified lines
3use csv::WriterBuilder;45use super::Exporter;6use crate::benchmark::benchmark_result::BenchmarkResult;7use crate::benchmark::quantity::Second;7use crate::benchmark::quantity::{second, TimeQuantity};8use crate::options::SortOrder;9use crate::quantity::{FormatQuantity, TimeUnit};1011use anyhow::Result;
40 unmodified lines
52 res.measurements.time_system_mean(),53 res.measurements.min(),54 res.measurements.max(),55 ] {56 fields.push(Cow::Owned(f.value_in::<Second>().to_string().into_bytes()))56 fields.push(Cow::Owned(f.value_in::<second>().to_string().into_bytes()))57 }58 for v in res.parameters.values() {59 fields.push(Cow::Borrowed(v.value.as_bytes()))60 }
7 unmodified lines
68#[test]69fn test_csv() {70 use crate::benchmark::benchmark_result::Parameter;71 use crate::benchmark::measurement::{Measurement, Measurements};72 use crate::benchmark::quantity::{Byte, Second};72 use crate::benchmark::quantity::{Information, InformationQuantity, Time, TimeQuantity};7374 use std::collections::BTreeMap;75 use std::process::ExitStatus;76
3 unmodified lines
80 BenchmarkResult {81 command: String::from("command_a"),82 measurements: Measurements::new(vec![83 Measurement {84 time_wall_clock: Second::new(7.0),85 time_user: Second::new(7.0),86 time_system: Second::zero(),87 peak_memory_usage: Byte::new(1024),84 time_wall_clock: Time::from_seconds(7.0),85 time_user: Time::from_seconds(7.0),86 time_system: Time::zero(),87 peak_memory_usage: Information::from_bytes(1024),88 exit_status: ExitStatus::default(),89 },90 Measurement {91 time_wall_clock: Second::new(8.0),92 time_user: Second::new(8.0),93 time_system: Second::zero(),94 peak_memory_usage: Byte::new(1024),91 time_wall_clock: Time::from_seconds(8.0),92 time_user: Time::from_seconds(8.0),93 time_system: Time::zero(),94 peak_memory_usage: Information::from_bytes(1024),95 exit_status: ExitStatus::default(),96 },97 Measurement {98 time_wall_clock: Second::new(12.0),99 time_user: Second::new(12.0),100 time_system: Second::zero(),101 peak_memory_usage: Byte::new(1024),98 time_wall_clock: Time::from_seconds(12.0),99 time_user: Time::from_seconds(12.0),100 time_system: Time::zero(),101 peak_memory_usage: Information::from_bytes(1024),102 exit_status: ExitStatus::default(),103 },104 ]),105 parameters: {
18 unmodified lines
124 BenchmarkResult {125 command: String::from("command_b"),126 measurements: Measurements::new(vec![127 Measurement {128 time_wall_clock: Second::new(17.0),129 time_user: Second::new(17.0),130 time_system: Second::zero(),131 peak_memory_usage: Byte::new(1024),128 time_wall_clock: Time::from_seconds(17.0),129 time_user: Time::from_seconds(17.0),130 time_system: Time::zero(),131 peak_memory_usage: Information::from_bytes(1024),132 exit_status: ExitStatus::default(),133 },134 Measurement {135 time_wall_clock: Second::new(18.0),136 time_user: Second::new(18.0),137 time_system: Second::zero(),138 peak_memory_usage: Byte::new(1024),135 time_wall_clock: Time::from_seconds(18.0),136 time_user: Time::from_seconds(18.0),137 time_system: Time::zero(),138 peak_memory_usage: Information::from_bytes(1024),139 exit_status: ExitStatus::default(),140 },141 Measurement {142 time_wall_clock: Second::new(19.0),143 time_user: Second::new(19.0),144 time_system: Second::zero(),145 peak_memory_usage: Byte::new(1024),142 time_wall_clock: Time::from_seconds(19.0),143 time_user: Time::from_seconds(19.0),144 time_system: Time::zero(),145 peak_memory_usage: Information::from_bytes(1024),146 exit_status: ExitStatus::default(),147 },148 ]),149 parameters: {
33 unmodified lines
modified:src/export/tests.rs+97 added-97 removed
1use super::Exporter;2use crate::benchmark::benchmark_result::BenchmarkResult;3use crate::benchmark::measurement::{Measurement, Measurements};4use crate::benchmark::quantity::{Byte, Second};4use crate::benchmark::quantity::{Information, InformationQuantity, Time, TimeQuantity};5use crate::export::asciidoc::AsciidocExporter;6use crate::export::orgmode::OrgmodeExporter;7use crate::quantity::{byte, second, Information, Time, TimeUnit, Zero};8use crate::{export::markdown::MarkdownExporter, options::SortOrder};
21 unmodified lines
30 BenchmarkResult {31 command: String::from("sleep 0.1"),32 measurements: Measurements::new(vec![33 Measurement {34 time_wall_clock: Second::new(0.09),35 time_user: Second::new(0.09),36 time_system: Second::zero(),37 peak_memory_usage: Byte::new(1024),34 time_wall_clock: Time::from_seconds(0.09),35 time_user: Time::from_seconds(0.09),36 time_system: Time::zero(),37 peak_memory_usage: Information::from_bytes(1024),38 exit_status: ExitStatus::default(),39 },40 Measurement {41 time_wall_clock: Second::new(0.10),42 time_user: Second::new(0.10),43 time_system: Second::zero(),44 peak_memory_usage: Byte::new(1024),41 time_wall_clock: Time::from_seconds(0.10),42 time_user: Time::from_seconds(0.10),43 time_system: Time::zero(),44 peak_memory_usage: Information::from_bytes(1024),45 exit_status: ExitStatus::default(),46 },47 Measurement {48 time_wall_clock: Second::new(0.14),49 time_user: Second::new(0.14),50 time_system: Second::zero(),51 peak_memory_usage: Byte::new(1024),48 time_wall_clock: Time::from_seconds(0.14),49 time_user: Time::from_seconds(0.14),50 time_system: Time::zero(),51 peak_memory_usage: Information::from_bytes(1024),52 exit_status: ExitStatus::default(),53 },54 ]),55 parameters: BTreeMap::new(),
1 unmodified line
57 BenchmarkResult {58 command: String::from("sleep 2"),59 measurements: Measurements::new(vec![60 Measurement {61 time_wall_clock: Second::new(2.0),62 time_user: Second::new(2.0),63 time_system: Second::zero(),64 peak_memory_usage: Byte::new(1024),61 time_wall_clock: Time::from_seconds(2.0),62 time_user: Time::from_seconds(2.0),63 time_system: Time::zero(),64 peak_memory_usage: Information::from_bytes(1024),65 exit_status: ExitStatus::default(),66 },67 Measurement {68 time_wall_clock: Second::new(3.0),69 time_user: Second::new(3.0),70 time_system: Second::zero(),71 peak_memory_usage: Byte::new(1024),68 time_wall_clock: Time::from_seconds(3.0),69 time_user: Time::from_seconds(3.0),70 time_system: Time::zero(),71 peak_memory_usage: Information::from_bytes(1024),72 exit_status: ExitStatus::default(),73 },74 Measurement {75 time_wall_clock: Second::new(4.0),76 time_user: Second::new(4.0),77 time_system: Second::zero(),78 peak_memory_usage: Byte::new(1024),75 time_wall_clock: Time::from_seconds(4.0),76 time_user: Time::from_seconds(4.0),77 time_system: Time::zero(),78 peak_memory_usage: Information::from_bytes(1024),79 exit_status: ExitStatus::default(),80 },81 ]),82 parameters: BTreeMap::new(),
46 unmodified lines
129 BenchmarkResult {130 command: String::from("sleep 2"),131 measurements: Measurements::new(vec![132 Measurement {133 time_wall_clock: Second::new(2.1),134 time_user: Second::new(2.1),135 time_system: Second::zero(),136 peak_memory_usage: Byte::new(1024),133 time_wall_clock: Time::from_seconds(2.1),134 time_user: Time::from_seconds(2.1),135 time_system: Time::zero(),136 peak_memory_usage: Information::from_bytes(1024),137 exit_status: ExitStatus::default(),138 },139 Measurement {140 time_wall_clock: Second::new(2.2),141 time_user: Second::new(2.2),142 time_system: Second::zero(),143 peak_memory_usage: Byte::new(1024),140 time_wall_clock: Time::from_seconds(2.2),141 time_user: Time::from_seconds(2.2),142 time_system: Time::zero(),143 peak_memory_usage: Information::from_bytes(1024),144 exit_status: ExitStatus::default(),145 },146 Measurement {147 time_wall_clock: Second::new(2.3),148 time_user: Second::new(2.3),149 time_system: Second::zero(),150 peak_memory_usage: Byte::new(1024),147 time_wall_clock: Time::from_seconds(2.3),148 time_user: Time::from_seconds(2.3),149 time_system: Time::zero(),150 peak_memory_usage: Information::from_bytes(1024),151 exit_status: ExitStatus::default(),152 },153 ]),154 parameters: BTreeMap::new(),
1 unmodified line
156 BenchmarkResult {157 command: String::from("sleep 0.1"),158 measurements: Measurements::new(vec![159 Measurement {160 time_wall_clock: Second::new(0.1),161 time_user: Second::new(0.1),162 time_system: Second::zero(),163 peak_memory_usage: Byte::new(1024),160 time_wall_clock: Time::from_seconds(0.1),161 time_user: Time::from_seconds(0.1),162 time_system: Time::zero(),163 peak_memory_usage: Information::from_bytes(1024),164 exit_status: ExitStatus::default(),165 },166 Measurement {167 time_wall_clock: Second::new(0.2),168 time_user: Second::new(0.2),169 time_system: Second::zero(),170 peak_memory_usage: Byte::new(1024),167 time_wall_clock: Time::from_seconds(0.2),168 time_user: Time::from_seconds(0.2),169 time_system: Time::zero(),170 peak_memory_usage: Information::from_bytes(1024),171 exit_status: ExitStatus::default(),172 },173 Measurement {174 time_wall_clock: Second::new(0.3),175 time_user: Second::new(0.3),176 time_system: Second::zero(),177 peak_memory_usage: Byte::new(1024),174 time_wall_clock: Time::from_seconds(0.3),175 time_user: Time::from_seconds(0.3),176 time_system: Time::zero(),177 peak_memory_usage: Information::from_bytes(1024),178 exit_status: ExitStatus::default(),179 },180 ]),181 parameters: BTreeMap::new(),
46 unmodified lines
228 BenchmarkResult {229 command: String::from("sleep 2"),230 measurements: Measurements::new(vec![231 Measurement {232 time_wall_clock: Second::new(2.1),233 time_user: Second::new(2.1),234 time_system: Second::zero(),235 peak_memory_usage: Byte::new(1024),232 time_wall_clock: Time::from_seconds(2.1),233 time_user: Time::from_seconds(2.1),234 time_system: Time::zero(),235 peak_memory_usage: Information::from_bytes(1024),236 exit_status: ExitStatus::default(),237 },238 Measurement {239 time_wall_clock: Second::new(2.2),240 time_user: Second::new(2.2),241 time_system: Second::zero(),242 peak_memory_usage: Byte::new(1024),239 time_wall_clock: Time::from_seconds(2.2),240 time_user: Time::from_seconds(2.2),241 time_system: Time::zero(),242 peak_memory_usage: Information::from_bytes(1024),243 exit_status: ExitStatus::default(),244 },245 Measurement {246 time_wall_clock: Second::new(2.3),247 time_user: Second::new(2.3),248 time_system: Second::zero(),249 peak_memory_usage: Byte::new(1024),246 time_wall_clock: Time::from_seconds(2.3),247 time_user: Time::from_seconds(2.3),248 time_system: Time::zero(),249 peak_memory_usage: Information::from_bytes(1024),250 exit_status: ExitStatus::default(),251 },252 ]),253 parameters: BTreeMap::new(),
1 unmodified line
255 BenchmarkResult {256 command: String::from("sleep 0.1"),257 measurements: Measurements::new(vec![258 Measurement {259 time_wall_clock: Second::new(0.1),260 time_user: Second::new(0.1),261 time_system: Second::zero(),262 peak_memory_usage: Byte::new(1024),259 time_wall_clock: Time::from_seconds(0.1),260 time_user: Time::from_seconds(0.1),261 time_system: Time::zero(),262 peak_memory_usage: Information::from_bytes(1024),263 exit_status: ExitStatus::default(),264 },265 Measurement {266 time_wall_clock: Second::new(0.2),267 time_user: Second::new(0.2),268 time_system: Second::zero(),269 peak_memory_usage: Byte::new(1024),266 time_wall_clock: Time::from_seconds(0.2),267 time_user: Time::from_seconds(0.2),268 time_system: Time::zero(),269 peak_memory_usage: Information::from_bytes(1024),270 exit_status: ExitStatus::default(),271 },272 Measurement {273 time_wall_clock: Second::new(0.3),274 time_user: Second::new(0.3),275 time_system: Second::zero(),276 peak_memory_usage: Byte::new(1024),273 time_wall_clock: Time::from_seconds(0.3),274 time_user: Time::from_seconds(0.3),275 time_system: Time::zero(),276 peak_memory_usage: Information::from_bytes(1024),277 exit_status: ExitStatus::default(),278 },279 ]),280 parameters: BTreeMap::new(),
45 unmodified lines
326 BenchmarkResult {327 command: String::from("sleep 2"),328 measurements: Measurements::new(vec![329 Measurement {330 time_wall_clock: Second::new(2.01),331 time_user: Second::new(2.01),332 time_system: Second::zero(),333 peak_memory_usage: Byte::new(1024),330 time_wall_clock: Time::from_seconds(2.01),331 time_user: Time::from_seconds(2.01),332 time_system: Time::zero(),333 peak_memory_usage: Information::from_bytes(1024),334 exit_status: ExitStatus::default(),335 },336 Measurement {337 time_wall_clock: Second::new(2.02),338 time_user: Second::new(2.02),339 time_system: Second::zero(),340 peak_memory_usage: Byte::new(1024),337 time_wall_clock: Time::from_seconds(2.02),338 time_user: Time::from_seconds(2.02),339 time_system: Time::zero(),340 peak_memory_usage: Information::from_bytes(1024),341 exit_status: ExitStatus::default(),342 },343 Measurement {344 time_wall_clock: Second::new(2.03),345 time_user: Second::new(2.03),346 time_system: Second::zero(),347 peak_memory_usage: Byte::new(1024),344 time_wall_clock: Time::from_seconds(2.03),345 time_user: Time::from_seconds(2.03),346 time_system: Time::zero(),347 peak_memory_usage: Information::from_bytes(1024),348 exit_status: ExitStatus::default(),349 },350 ]),351 parameters: BTreeMap::new(),
1 unmodified line
353 BenchmarkResult {354 command: String::from("sleep 0.1"),355 measurements: Measurements::new(vec![356 Measurement {357 time_wall_clock: Second::new(0.11),358 time_user: Second::new(0.11),359 time_system: Second::zero(),360 peak_memory_usage: Byte::new(1024),357 time_wall_clock: Time::from_seconds(0.11),358 time_user: Time::from_seconds(0.11),359 time_system: Time::zero(),360 peak_memory_usage: Information::from_bytes(1024),361 exit_status: ExitStatus::default(),362 },363 Measurement {364 time_wall_clock: Second::new(0.12),365 time_user: Second::new(0.12),366 time_system: Second::zero(),367 peak_memory_usage: Byte::new(1024),364 time_wall_clock: Time::from_seconds(0.12),365 time_user: Time::from_seconds(0.12),366 time_system: Time::zero(),367 peak_memory_usage: Information::from_bytes(1024),368 exit_status: ExitStatus::default(),369 },370 Measurement {371 time_wall_clock: Second::new(0.13),372 time_user: Second::new(0.13),373 time_system: Second::zero(),374 peak_memory_usage: Byte::new(1024),371 time_wall_clock: Time::from_seconds(0.13),372 time_user: Time::from_seconds(0.13),373 time_system: Time::zero(),374 peak_memory_usage: Information::from_bytes(1024),375 exit_status: ExitStatus::default(),376 },377 ]),378 parameters: BTreeMap::new(),
40 unmodified lines
modified:src/output/warnings.rs+3 added-2 removed
1use std::fmt;23use crate::benchmark::quantity::Second;3use crate::benchmark::quantity::{millisecond, Time, TimeQuantity};4use crate::benchmark::MIN_EXECUTION_TIME;5use crate::output::format::format_duration;67pub struct OutlierWarningOptions {
13 unmodified lines
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {22 match *self {23 Warnings::FastExecutionTime => write!(24 f,25 "Command took less than {MIN_EXECUTION_TIME} to complete. Note that the results might be \25 "Command took less than {min_execution_time} to complete. Note that the results might be \26 inaccurate because hyperfine can not calibrate the shell startup time much \27 more precise than this limit. You can try to use the `-N`/`--shell=none` \28 option to disable the shell completely.",29 min_execution_time = MIN_EXECUTION_TIME.to_string(millisecond)30 ),31 Warnings::NonZeroExitCode => write!(f, "Ignoring non-zero exit code."),32 Warnings::SlowInitialRun(time_first_run, ref options) => write!(33 f,
36 unmodified lines
modified:src/timer/unix_timer.rs+5 added-5 removed
6 unmodified lines
7use std::process::{Child, ExitStatus};89use anyhow::Result;1011use crate::benchmark::quantity::{Byte, Second};11use crate::benchmark::quantity::{Information, InformationQuantity, Time, TimeQuantity};1213#[derive(Debug, Copy, Clone)]14struct ResourceUsage {15 /// Total amount of time spent executing in user mode
51 unmodified lines
67 pub fn start() -> Self {68 Self {}69 }7071 pub fn stop(&self, child: Child) -> Result<(ExitStatus, Second, Second, Byte)> {71 pub fn stop(&self, child: Child) -> Result<(ExitStatus, Time, Time, Information)> {72 let (status, usage) = wait4(child)?;73 Ok((74 status,75 Second::new(usage.user_usec),76 Second::new(usage.system_usec),77 Byte::new(u64::try_from(usage.memory_usage_byte).unwrap_or(0)),75 Time::from_seconds(usage.user_usec),76 Time::from_seconds(usage.system_usec),77 Information::from_bytes(u64::try_from(usage.memory_usage_byte).unwrap_or(0)),78 ))79 }80}
modified:src/timer/wall_clock_timer.rs+4 added-3 removed
1use std::time::Instant;23use crate::benchmark::quantity::Second;3use crate::benchmark::quantity::{Time, TimeQuantity};45pub struct WallClockTimer {6 start: Instant,7}
6 unmodified lines
14 }1516 pub fn stop(&self) -> Time {17 let duration = self.start.elapsed();18 // TODO19 Second::new(duration.as_secs() as f64 + f64::from(duration.subsec_nanos()) * 1e-9)1819 Time::from_seconds(duration.as_secs() as f64)20 + Time::from_nanoseconds(duration.subsec_nanos() as f64)21 }22}
modified:src/options.rs+3 added-3 removed
5 unmodified lines
67use anyhow::{bail, ensure};8use clap::ArgMatches;910use crate::benchmark::quantity::Second;10use crate::benchmark::quantity::{Time, TimeQuantity};11use crate::command::Commands;12use crate::error::OptionsError;13use crate::util::units::Unit;14
241 unmodified lines
256 fn default() -> Options {257 Options {258 run_bounds: RunBounds::default(),259 warmup_count: 0,260 min_benchmarking_time: Second::new(3.0),260 min_benchmarking_time: Time::from_seconds(3.0),261 command_failure_action: CmdFailureAction::RaiseError,262 reference_command: None,263 reference_name: None,264 reference_index: None,
177 unmodified lines
442 _ => None,443 };444445 if let Some(time) = matches.get_one::<String>("min-benchmarking-time") {446 options.min_benchmarking_time = Second::new(446 options.min_benchmarking_time = Time::from_seconds(447 time.parse::<f64>()448 .map_err(|e| OptionsError::FloatParsingError("min-benchmarking-time", e))?,449 );450 }
127 unmodified lines
modified:Cargo.lock+87 added-9 removed
394 unmodified lines
395 "statistical",396 "tempfile",397 "thiserror",398 "uom",399 "windows-sys 0.61.2",399 "windows-sys 0.59.0",400]401402[[package]]403name = "indexmap"
101 unmodified lines
505source = "registry+https://github.com/rust-lang/crates.io-index"506checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"507508[[package]]509name = "num"510version = "0.2.1"511source = "registry+https://github.com/rust-lang/crates.io-index"512checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36"513dependencies = [514 "num-bigint",515 "num-complex",516 "num-integer",517 "num-iter",518 "num-rational 0.2.4",519 "num-traits",520]521522[[package]]523name = "num-bigint"524version = "0.2.6"525source = "registry+https://github.com/rust-lang/crates.io-index"526checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"527dependencies = [528 "autocfg 1.4.0",529 "num-integer",530 "num-traits",531]532533[[package]]534name = "num-complex"535version = "0.2.4"536source = "registry+https://github.com/rust-lang/crates.io-index"537checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"538dependencies = [539 "autocfg 1.4.0",540 "num-traits",541]542543[[package]]544name = "num-integer"545version = "0.1.46"546source = "registry+https://github.com/rust-lang/crates.io-index"547checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"548dependencies = [549 "num-traits",550]551552[[package]]553name = "num-iter"554version = "0.1.45"555source = "registry+https://github.com/rust-lang/crates.io-index"556checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"557dependencies = [558 "autocfg 1.4.0",559 "num-integer",560 "num-traits",561]562563[[package]]564name = "num-rational"565version = "0.2.4"566source = "registry+https://github.com/rust-lang/crates.io-index"567checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"568dependencies = [569 "autocfg 1.4.0",570 "num-bigint",571 "num-integer",572 "num-traits",573]574575[[package]]576name = "num-rational"577version = "0.4.2"578source = "registry+https://github.com/rust-lang/crates.io-index"579checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"580dependencies = [581 "num-integer",582 "num-traits",583]584585[[package]]586name = "num-traits"587version = "0.2.19"588source = "registry+https://github.com/rust-lang/crates.io-index"589checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
412 unmodified lines
1002 "winnow",1003]10041005[[package]]929name = "toml_parser"930version = "1.1.3+spec-1.1.0"1006name = "typenum"1007version = "1.17.0"1008source = "registry+https://github.com/rust-lang/crates.io-index"1009checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"10101011[[package]]1012name = "unicode-ident"1013version = "1.0.13"1014source = "registry+https://github.com/rust-lang/crates.io-index"1015checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"1016dependencies = [1017 "winnow",1018]
16 unmodified lines
1035source = "registry+https://github.com/rust-lang/crates.io-index"1036checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"10371038[[package]]956name = "unicode-width"957version = "0.2.2"958source = "registry+https://github.com/rust-lang/crates.io-index"959checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"960961[[package]]1039name = "uom"1040version = "0.36.0"1041source = "registry+https://github.com/rust-lang/crates.io-index"1042checksum = "ffd36e5350a65d112584053ee91843955826bf9e56ec0d1351214e01f6d7cd9c"1043dependencies = [1044 "num-rational 0.4.2",1045 "num-traits",1046 "typenum",1047]1048
213 unmodified lines
modified:Cargo.toml+6 added
26 unmodified lines
27rand = "0.10"28shell-words = "1.1"29thiserror = "2.0"30anyhow = "1.0"31uom = { version = "0.36.0", default-features = false, features = [32 "std",33 "si",34 "f64",35 "u64",36] }3738[target.'cfg(not(windows))'.dependencies]39libc = "0.2"40
48 unmodified lines