diff --git a/build.rs b/build.rs index f413251..ebd143f 100644 --- a/build.rs +++ b/build.rs @@ -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"; diff --git a/src/hyperfine/app.rs b/src/app.rs similarity index 100% rename from src/hyperfine/app.rs rename to src/app.rs diff --git a/src/hyperfine/benchmark.rs b/src/benchmark.rs similarity index 95% rename from src/hyperfine/benchmark.rs rename to src/benchmark.rs index 2c03d3d..e453a96 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/benchmark.rs @@ -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)] diff --git a/src/hyperfine/benchmark_result.rs b/src/benchmark_result.rs similarity index 98% rename from src/hyperfine/benchmark_result.rs rename to src/benchmark_result.rs index 4c64640..f7a1664 100644 --- a/src/hyperfine/benchmark_result.rs +++ b/src/benchmark_result.rs @@ -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 diff --git a/src/hyperfine/command.rs b/src/command.rs similarity index 100% rename from src/hyperfine/command.rs rename to src/command.rs diff --git a/src/hyperfine/error.rs b/src/error.rs similarity index 100% rename from src/hyperfine/error.rs rename to src/error.rs diff --git a/src/hyperfine/export/asciidoc.rs b/src/export/asciidoc.rs similarity index 97% rename from src/hyperfine/export/asciidoc.rs rename to src/export/asciidoc.rs index d3c2f73..bec0177 100644 --- a/src/hyperfine/export/asciidoc.rs +++ b/src/export/asciidoc.rs @@ -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; diff --git a/src/hyperfine/export/csv.rs b/src/export/csv.rs similarity index 97% rename from src/hyperfine/export/csv.rs rename to src/export/csv.rs index b48168f..b188487 100644 --- a/src/hyperfine/export/csv.rs +++ b/src/export/csv.rs @@ -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}; diff --git a/src/hyperfine/export/json.rs b/src/export/json.rs similarity index 86% rename from src/hyperfine/export/json.rs rename to src/export/json.rs index 5eb4dad..babef3d 100644 --- a/src/hyperfine/export/json.rs +++ b/src/export/json.rs @@ -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}; diff --git a/src/hyperfine/export/markdown.rs b/src/export/markdown.rs similarity index 97% rename from src/hyperfine/export/markdown.rs rename to src/export/markdown.rs index 0e82d71..4b3652a 100644 --- a/src/hyperfine/export/markdown.rs +++ b/src/export/markdown.rs @@ -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}; diff --git a/src/hyperfine/export/mod.rs b/src/export/mod.rs similarity index 96% rename from src/hyperfine/export/mod.rs rename to src/export/mod.rs index dd19ab4..7fc0e4a 100644 --- a/src/hyperfine/export/mod.rs +++ b/src/export/mod.rs @@ -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)] diff --git a/src/hyperfine/format.rs b/src/format.rs similarity index 97% rename from src/hyperfine/format.rs rename to src/format.rs index cc5f5d5..1e594a0 100644 --- a/src/hyperfine/format.rs +++ b/src/format.rs @@ -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. diff --git a/src/hyperfine/mod.rs b/src/hyperfine/mod.rs deleted file mode 100644 index ac6a9bd..0000000 --- a/src/hyperfine/mod.rs +++ /dev/null @@ -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; diff --git a/src/hyperfine/internal.rs b/src/internal.rs similarity index 98% rename from src/hyperfine/internal.rs rename to src/internal.rs index b3a0303..b2833bf 100644 --- a/src/hyperfine/internal.rs +++ b/src/internal.rs @@ -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; diff --git a/src/main.rs b/src/main.rs index a18189d..0581c08 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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) -> ! { diff --git a/src/hyperfine/options.rs b/src/options.rs similarity index 100% rename from src/hyperfine/options.rs rename to src/options.rs diff --git a/src/hyperfine/outlier_detection.rs b/src/outlier_detection.rs similarity index 100% rename from src/hyperfine/outlier_detection.rs rename to src/outlier_detection.rs diff --git a/src/hyperfine/parameter_range.rs b/src/parameter_range.rs similarity index 98% rename from src/hyperfine/parameter_range.rs rename to src/parameter_range.rs index 2096651..cc972ff 100644 --- a/src/hyperfine/parameter_range.rs +++ b/src/parameter_range.rs @@ -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 diff --git a/src/hyperfine/shell.rs b/src/shell.rs similarity index 98% rename from src/hyperfine/shell.rs rename to src/shell.rs index 6bb3ec0..c47ee59 100644 --- a/src/hyperfine/shell.rs +++ b/src/shell.rs @@ -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)] diff --git a/src/hyperfine/timer/internal.rs b/src/timer/internal.rs similarity index 92% rename from src/hyperfine/timer/internal.rs rename to src/timer/internal.rs index ec3b572..c5a044f 100644 --- a/src/hyperfine/timer/internal.rs +++ b/src/timer/internal.rs @@ -1,4 +1,4 @@ -use crate::hyperfine::units::Second; +use crate::units::Second; #[derive(Debug, Copy, Clone)] pub struct CPUTimes { diff --git a/src/hyperfine/timer/mod.rs b/src/timer/mod.rs similarity index 100% rename from src/hyperfine/timer/mod.rs rename to src/timer/mod.rs diff --git a/src/hyperfine/timer/unix_timer.rs b/src/timer/unix_timer.rs similarity index 96% rename from src/hyperfine/timer/unix_timer.rs rename to src/timer/unix_timer.rs index 74e085d..2450f2f 100644 --- a/src/hyperfine/timer/unix_timer.rs +++ b/src/timer/unix_timer.rs @@ -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; diff --git a/src/hyperfine/timer/wallclocktimer.rs b/src/timer/wallclocktimer.rs similarity index 85% rename from src/hyperfine/timer/wallclocktimer.rs rename to src/timer/wallclocktimer.rs index 9be67f8..8d1a36b 100644 --- a/src/hyperfine/timer/wallclocktimer.rs +++ b/src/timer/wallclocktimer.rs @@ -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, diff --git a/src/hyperfine/timer/windows_timer.rs b/src/timer/windows_timer.rs similarity index 96% rename from src/hyperfine/timer/windows_timer.rs rename to src/timer/windows_timer.rs index 6132855..117cc2c 100644 --- a/src/hyperfine/timer/windows_timer.rs +++ b/src/timer/windows_timer.rs @@ -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; diff --git a/src/hyperfine/types.rs b/src/types.rs similarity index 100% rename from src/hyperfine/types.rs rename to src/types.rs diff --git a/src/hyperfine/units.rs b/src/units.rs similarity index 100% rename from src/hyperfine/units.rs rename to src/units.rs diff --git a/src/hyperfine/warnings.rs b/src/warnings.rs similarity index 91% rename from src/hyperfine/warnings.rs rename to src/warnings.rs index 95a3e16..01b4e73 100644 --- a/src/hyperfine/warnings.rs +++ b/src/warnings.rs @@ -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 {