Flat directory/module structure

This commit is contained in:
David Peter 2021-08-24 21:24:34 +02:00 committed by David Peter
parent d31936ec28
commit 30c381fe2a
27 changed files with 70 additions and 71 deletions

View File

@ -2,7 +2,7 @@ use std::fs;
use clap::Shell;
include!("src/hyperfine/app.rs");
include!("src/app.rs");
fn main() {
let min_version = "1.39";

View File

@ -5,17 +5,17 @@ use std::process::{ExitStatus, Stdio};
use colored::*;
use statistical::{mean, median, standard_deviation};
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::command::Command;
use crate::hyperfine::format::{format_duration, format_duration_unit};
use crate::hyperfine::internal::{get_progress_bar, max, min, MIN_EXECUTION_TIME};
use crate::hyperfine::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
use crate::hyperfine::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
use crate::hyperfine::shell::execute_and_time;
use crate::hyperfine::timer::wallclocktimer::WallClockTimer;
use crate::hyperfine::timer::{TimerStart, TimerStop};
use crate::hyperfine::units::Second;
use crate::hyperfine::warnings::Warnings;
use crate::benchmark_result::BenchmarkResult;
use crate::command::Command;
use crate::format::{format_duration, format_duration_unit};
use crate::internal::{get_progress_bar, max, min, MIN_EXECUTION_TIME};
use crate::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
use crate::shell::execute_and_time;
use crate::timer::wallclocktimer::WallClockTimer;
use crate::timer::{TimerStart, TimerStop};
use crate::units::Second;
use crate::warnings::Warnings;
/// Results from timing a single shell command
#[derive(Debug, Default, Copy, Clone)]

View File

@ -1,7 +1,7 @@
use serde::Serialize;
use std::collections::BTreeMap;
use crate::hyperfine::units::Second;
use crate::units::Second;
/// Set of values that will be exported.
// NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the

View File

@ -1,8 +1,8 @@
use super::Exporter;
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::format::format_duration_value;
use crate::hyperfine::units::Unit;
use crate::benchmark_result::BenchmarkResult;
use crate::format::format_duration_value;
use crate::units::Unit;
use std::io::Result;

View File

@ -1,7 +1,7 @@
use super::Exporter;
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::units::Unit;
use crate::benchmark_result::BenchmarkResult;
use crate::units::Unit;
use std::borrow::Cow;
use std::io::{Error, ErrorKind, Result};

View File

@ -1,6 +1,6 @@
use super::Exporter;
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::units::Unit;
use crate::benchmark_result::BenchmarkResult;
use crate::units::Unit;
use std::io::{Error, ErrorKind, Result};

View File

@ -1,9 +1,9 @@
use super::Exporter;
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::format::format_duration_value;
use crate::hyperfine::internal::{compute_relative_speed, BenchmarkResultWithRelativeSpeed};
use crate::hyperfine::units::Unit;
use crate::benchmark_result::BenchmarkResult;
use crate::format::format_duration_value;
use crate::internal::{compute_relative_speed, BenchmarkResultWithRelativeSpeed};
use crate::units::Unit;
use std::io::{Error, ErrorKind, Result};

View File

@ -11,8 +11,8 @@ use self::markdown::MarkdownExporter;
use std::fs::{File, OpenOptions};
use std::io::{Result, Write};
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::units::Unit;
use crate::benchmark_result::BenchmarkResult;
use crate::units::Unit;
/// The desired form of exporter to use for a given file.
#[derive(Clone)]

View File

@ -1,4 +1,4 @@
use crate::hyperfine::units::{Second, Unit};
use crate::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.

View File

@ -1,16 +0,0 @@
pub mod app;
pub mod benchmark;
pub mod benchmark_result;
pub mod command;
pub mod error;
pub mod export;
pub mod format;
pub mod internal;
pub mod options;
pub mod outlier_detection;
pub mod parameter_range;
pub mod shell;
pub mod timer;
pub mod types;
pub mod units;
pub mod warnings;

View File

@ -1,9 +1,9 @@
use colored::*;
use indicatif::{ProgressBar, ProgressStyle};
use crate::hyperfine::benchmark_result::BenchmarkResult;
use crate::hyperfine::options::OutputStyleOption;
use crate::hyperfine::units::{Scalar, Second};
use crate::benchmark_result::BenchmarkResult;
use crate::options::OutputStyleOption;
use crate::units::{Scalar, Second};
use std::cmp::Ordering;
use std::iter::Iterator;

View File

@ -7,18 +7,33 @@ use atty::Stream;
use clap::ArgMatches;
use colored::*;
mod hyperfine;
pub mod app;
pub mod benchmark;
pub mod benchmark_result;
pub mod command;
pub mod error;
pub mod export;
pub mod format;
pub mod internal;
pub mod options;
pub mod outlier_detection;
pub mod parameter_range;
pub mod shell;
pub mod timer;
pub mod types;
pub mod units;
pub mod warnings;
use crate::hyperfine::app::get_arg_matches;
use crate::hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
use crate::hyperfine::command::Command;
use crate::hyperfine::error::OptionsError;
use crate::hyperfine::export::{ExportManager, ExportType};
use crate::hyperfine::internal::{tokenize, write_benchmark_comparison};
use crate::hyperfine::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
use crate::hyperfine::parameter_range::get_parameterized_commands;
use crate::hyperfine::types::ParameterValue;
use crate::hyperfine::units::Unit;
use app::get_arg_matches;
use benchmark::{mean_shell_spawning_time, run_benchmark};
use command::Command;
use error::OptionsError;
use export::{ExportManager, ExportType};
use internal::{tokenize, write_benchmark_comparison};
use options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
use parameter_range::get_parameterized_commands;
use types::ParameterValue;
use units::Unit;
/// Print error message to stderr and terminate
pub fn error(message: &str) -> ! {

View File

@ -5,9 +5,9 @@ use std::str::FromStr;
use clap::Values;
use rust_decimal::Decimal;
use crate::hyperfine::command::Command;
use crate::hyperfine::error::ParameterScanError;
use crate::hyperfine::types::{NumericType, ParameterValue};
use crate::command::Command;
use crate::error::ParameterScanError;
use crate::types::{NumericType, ParameterValue};
trait Numeric:
Add<Output = Self>

View File

@ -1,7 +1,7 @@
use std::io;
use std::process::{Command, ExitStatus, Stdio};
use crate::hyperfine::timer::get_cpu_timer;
use crate::timer::get_cpu_timer;
/// Used to indicate the result of running a command
#[derive(Debug, Copy, Clone)]

View File

@ -1,4 +1,4 @@
use crate::hyperfine::units::Second;
use crate::units::Second;
#[derive(Debug, Copy, Clone)]
pub struct CPUTimes {

View File

@ -1,8 +1,8 @@
#![cfg(not(windows))]
use super::internal::{CPUInterval, CPUTimes};
use crate::hyperfine::timer::{TimerStart, TimerStop};
use crate::hyperfine::units::Second;
use crate::timer::{TimerStart, TimerStop};
use crate::units::Second;
use std::mem;
use std::process::Child;

View File

@ -1,8 +1,8 @@
use std::process::Child;
use std::time::Instant;
use crate::hyperfine::timer::{TimerStart, TimerStop};
use crate::hyperfine::units::Second;
use crate::timer::{TimerStart, TimerStop};
use crate::units::Second;
pub struct WallClockTimer {
start: Instant,

View File

@ -1,8 +1,8 @@
#![cfg(windows)]
use super::internal::CPUTimes;
use crate::hyperfine::timer::{TimerStart, TimerStop};
use crate::hyperfine::units::Second;
use crate::timer::{TimerStart, TimerStop};
use crate::units::Second;
use winapi::um::processthreadsapi::GetProcessTimes;
use winapi::um::winnt::HANDLE;

View File

@ -1,8 +1,8 @@
use std::fmt;
use crate::hyperfine::format::format_duration;
use crate::hyperfine::internal::MIN_EXECUTION_TIME;
use crate::hyperfine::units::Second;
use crate::format::format_duration;
use crate::internal::MIN_EXECUTION_TIME;
use crate::units::Second;
/// A list of all possible warnings
pub enum Warnings {