mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-11-22 11:43:03 +03:00
Move a few modules to util
This commit is contained in:
parent
999e7c4566
commit
5c634c9f2f
@ -9,7 +9,6 @@ use statistical::{mean, median, standard_deviation};
|
||||
|
||||
use crate::benchmark::result::BenchmarkResult;
|
||||
use crate::command::Command;
|
||||
use crate::min_max::{max, min};
|
||||
use crate::options::{CmdFailureAction, Options, OutputStyleOption, Shell};
|
||||
use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
|
||||
use crate::output::format::{format_duration, format_duration_unit};
|
||||
@ -18,7 +17,8 @@ use crate::output::warnings::Warnings;
|
||||
use crate::shell::execute_and_time;
|
||||
use crate::timer::wallclocktimer::WallClockTimer;
|
||||
use crate::timer::{TimerStart, TimerStop};
|
||||
use crate::units::Second;
|
||||
use crate::util::min_max::{max, min};
|
||||
use crate::util::units::Second;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use super::result::BenchmarkResult;
|
||||
use crate::units::Scalar;
|
||||
use crate::util::units::Scalar;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BenchmarkResultWithRelativeSpeed<'a> {
|
||||
|
@ -2,7 +2,7 @@ use std::collections::BTreeMap;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::units::Second;
|
||||
use crate::util::units::Second;
|
||||
|
||||
/// Set of values that will be exported.
|
||||
// NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::benchmark::relative_speed::{self, BenchmarkResultWithRelativeSpeed};
|
||||
use crate::benchmark::result::BenchmarkResult;
|
||||
use crate::output::format::format_duration_value;
|
||||
use crate::units::Unit;
|
||||
use crate::util::units::Unit;
|
||||
|
||||
use super::Exporter;
|
||||
|
||||
|
@ -4,7 +4,7 @@ use csv::WriterBuilder;
|
||||
|
||||
use super::Exporter;
|
||||
use crate::benchmark::result::BenchmarkResult;
|
||||
use crate::units::Unit;
|
||||
use crate::util::units::Unit;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
|
@ -3,7 +3,7 @@ use serde_json::to_vec_pretty;
|
||||
|
||||
use super::Exporter;
|
||||
use crate::benchmark::result::BenchmarkResult;
|
||||
use crate::units::Unit;
|
||||
use crate::util::units::Unit;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
|
@ -2,7 +2,7 @@ use super::Exporter;
|
||||
use crate::benchmark::relative_speed::{self, BenchmarkResultWithRelativeSpeed};
|
||||
use crate::benchmark::result::BenchmarkResult;
|
||||
use crate::output::format::format_duration_value;
|
||||
use crate::units::Unit;
|
||||
use crate::util::units::Unit;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
|
||||
|
@ -12,7 +12,7 @@ use self::json::JsonExporter;
|
||||
use self::markdown::MarkdownExporter;
|
||||
|
||||
use crate::benchmark::result::BenchmarkResult;
|
||||
use crate::units::Unit;
|
||||
use crate::util::units::Unit;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use clap::ArgMatches;
|
||||
|
@ -15,15 +15,13 @@ pub mod benchmark;
|
||||
pub mod command;
|
||||
pub mod error;
|
||||
pub mod export;
|
||||
pub mod min_max;
|
||||
pub mod number;
|
||||
pub mod options;
|
||||
pub mod outlier_detection;
|
||||
pub mod output;
|
||||
pub mod parameter;
|
||||
pub mod shell;
|
||||
pub mod timer;
|
||||
pub mod units;
|
||||
pub mod util;
|
||||
|
||||
pub fn write_benchmark_comparison(results: &[BenchmarkResult]) {
|
||||
if results.len() < 2 {
|
||||
|
@ -5,7 +5,7 @@ use atty::Stream;
|
||||
use clap::ArgMatches;
|
||||
|
||||
use crate::error::OptionsError;
|
||||
use crate::units::{Second, Unit};
|
||||
use crate::util::units::{Second, Unit};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub const DEFAULT_SHELL: &str = "sh";
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::units::{Second, Unit};
|
||||
use crate::util::units::{Second, Unit};
|
||||
|
||||
/// Format the given duration as a string. The output-unit can be enforced by setting `unit` to
|
||||
/// `Some(target_unit)`. If `unit` is `None`, it will be determined automatically.
|
||||
|
@ -2,7 +2,7 @@ use std::fmt;
|
||||
|
||||
use crate::benchmark::MIN_EXECUTION_TIME;
|
||||
use crate::output::format::format_duration;
|
||||
use crate::units::Second;
|
||||
use crate::util::units::Second;
|
||||
|
||||
/// A list of all possible warnings
|
||||
pub enum Warnings {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::number::Number;
|
||||
use crate::util::number::Number;
|
||||
|
||||
pub mod range;
|
||||
pub mod tokenize;
|
||||
|
@ -8,7 +8,7 @@ use rust_decimal::Decimal;
|
||||
use super::ParameterValue;
|
||||
use crate::command::Command;
|
||||
use crate::error::ParameterScanError;
|
||||
use crate::number::Number;
|
||||
use crate::util::number::Number;
|
||||
|
||||
trait Numeric:
|
||||
Add<Output = Self>
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::process::Child;
|
||||
|
||||
use crate::units::Second;
|
||||
use crate::util::units::Second;
|
||||
|
||||
pub mod wallclocktimer;
|
||||
|
||||
|
@ -4,7 +4,7 @@ use std::mem;
|
||||
use std::process::Child;
|
||||
|
||||
use crate::timer::{CPUInterval, CPUTimes, TimerStart, TimerStop};
|
||||
use crate::units::Second;
|
||||
use crate::util::units::Second;
|
||||
|
||||
pub fn get_cpu_timer() -> Box<dyn TimerStop<Result = (Second, Second)>> {
|
||||
Box::new(CPUTimer::start())
|
||||
|
@ -2,7 +2,7 @@ use std::process::Child;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::timer::{TimerStart, TimerStop};
|
||||
use crate::units::Second;
|
||||
use crate::util::units::Second;
|
||||
|
||||
pub struct WallClockTimer {
|
||||
start: Instant,
|
||||
|
@ -8,7 +8,7 @@ use winapi::um::processthreadsapi::GetProcessTimes;
|
||||
use winapi::um::winnt::HANDLE;
|
||||
|
||||
use crate::timer::{CPUTimes, TimerStart, TimerStop};
|
||||
use crate::units::Second;
|
||||
use crate::util::units::Second;
|
||||
|
||||
const HUNDRED_NS_PER_MS: i64 = 10;
|
||||
|
||||
|
3
src/util/mod.rs
Normal file
3
src/util/mod.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub mod min_max;
|
||||
pub mod number;
|
||||
pub mod units;
|
Loading…
Reference in New Issue
Block a user