mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-11-29 15:03:55 +03:00
Flat directory/module structure
This commit is contained in:
parent
d31936ec28
commit
30c381fe2a
2
build.rs
2
build.rs
@ -2,7 +2,7 @@ use std::fs;
|
|||||||
|
|
||||||
use clap::Shell;
|
use clap::Shell;
|
||||||
|
|
||||||
include!("src/hyperfine/app.rs");
|
include!("src/app.rs");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let min_version = "1.39";
|
let min_version = "1.39";
|
||||||
|
@ -5,17 +5,17 @@ use std::process::{ExitStatus, Stdio};
|
|||||||
use colored::*;
|
use colored::*;
|
||||||
use statistical::{mean, median, standard_deviation};
|
use statistical::{mean, median, standard_deviation};
|
||||||
|
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::command::Command;
|
use crate::command::Command;
|
||||||
use crate::hyperfine::format::{format_duration, format_duration_unit};
|
use crate::format::{format_duration, format_duration_unit};
|
||||||
use crate::hyperfine::internal::{get_progress_bar, max, min, MIN_EXECUTION_TIME};
|
use crate::internal::{get_progress_bar, max, min, MIN_EXECUTION_TIME};
|
||||||
use crate::hyperfine::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
|
use crate::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
|
||||||
use crate::hyperfine::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
|
use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
|
||||||
use crate::hyperfine::shell::execute_and_time;
|
use crate::shell::execute_and_time;
|
||||||
use crate::hyperfine::timer::wallclocktimer::WallClockTimer;
|
use crate::timer::wallclocktimer::WallClockTimer;
|
||||||
use crate::hyperfine::timer::{TimerStart, TimerStop};
|
use crate::timer::{TimerStart, TimerStop};
|
||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
use crate::hyperfine::warnings::Warnings;
|
use crate::warnings::Warnings;
|
||||||
|
|
||||||
/// Results from timing a single shell command
|
/// Results from timing a single shell command
|
||||||
#[derive(Debug, Default, Copy, Clone)]
|
#[derive(Debug, Default, Copy, Clone)]
|
@ -1,7 +1,7 @@
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
|
|
||||||
/// Set of values that will be exported.
|
/// Set of values that will be exported.
|
||||||
// NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the
|
// NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the
|
@ -1,8 +1,8 @@
|
|||||||
use super::Exporter;
|
use super::Exporter;
|
||||||
|
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::format::format_duration_value;
|
use crate::format::format_duration_value;
|
||||||
use crate::hyperfine::units::Unit;
|
use crate::units::Unit;
|
||||||
|
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
use super::Exporter;
|
use super::Exporter;
|
||||||
|
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::units::Unit;
|
use crate::units::Unit;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
@ -1,6 +1,6 @@
|
|||||||
use super::Exporter;
|
use super::Exporter;
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::units::Unit;
|
use crate::units::Unit;
|
||||||
|
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
use super::Exporter;
|
use super::Exporter;
|
||||||
|
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::format::format_duration_value;
|
use crate::format::format_duration_value;
|
||||||
use crate::hyperfine::internal::{compute_relative_speed, BenchmarkResultWithRelativeSpeed};
|
use crate::internal::{compute_relative_speed, BenchmarkResultWithRelativeSpeed};
|
||||||
use crate::hyperfine::units::Unit;
|
use crate::units::Unit;
|
||||||
|
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
||||||
|
|
@ -11,8 +11,8 @@ use self::markdown::MarkdownExporter;
|
|||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::io::{Result, Write};
|
use std::io::{Result, Write};
|
||||||
|
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::units::Unit;
|
use crate::units::Unit;
|
||||||
|
|
||||||
/// The desired form of exporter to use for a given file.
|
/// The desired form of exporter to use for a given file.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
@ -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
|
/// 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.
|
/// `Some(target_unit)`. If `unit` is `None`, it will be determined automatically.
|
@ -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;
|
|
@ -1,9 +1,9 @@
|
|||||||
use colored::*;
|
use colored::*;
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
|
|
||||||
use crate::hyperfine::benchmark_result::BenchmarkResult;
|
use crate::benchmark_result::BenchmarkResult;
|
||||||
use crate::hyperfine::options::OutputStyleOption;
|
use crate::options::OutputStyleOption;
|
||||||
use crate::hyperfine::units::{Scalar, Second};
|
use crate::units::{Scalar, Second};
|
||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::iter::Iterator;
|
use std::iter::Iterator;
|
37
src/main.rs
37
src/main.rs
@ -7,18 +7,33 @@ use atty::Stream;
|
|||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use colored::*;
|
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 app::get_arg_matches;
|
||||||
use crate::hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
|
use benchmark::{mean_shell_spawning_time, run_benchmark};
|
||||||
use crate::hyperfine::command::Command;
|
use command::Command;
|
||||||
use crate::hyperfine::error::OptionsError;
|
use error::OptionsError;
|
||||||
use crate::hyperfine::export::{ExportManager, ExportType};
|
use export::{ExportManager, ExportType};
|
||||||
use crate::hyperfine::internal::{tokenize, write_benchmark_comparison};
|
use internal::{tokenize, write_benchmark_comparison};
|
||||||
use crate::hyperfine::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
|
use options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
|
||||||
use crate::hyperfine::parameter_range::get_parameterized_commands;
|
use parameter_range::get_parameterized_commands;
|
||||||
use crate::hyperfine::types::ParameterValue;
|
use types::ParameterValue;
|
||||||
use crate::hyperfine::units::Unit;
|
use units::Unit;
|
||||||
|
|
||||||
/// Print error message to stderr and terminate
|
/// Print error message to stderr and terminate
|
||||||
pub fn error(message: &str) -> ! {
|
pub fn error(message: &str) -> ! {
|
||||||
|
@ -5,9 +5,9 @@ use std::str::FromStr;
|
|||||||
use clap::Values;
|
use clap::Values;
|
||||||
use rust_decimal::Decimal;
|
use rust_decimal::Decimal;
|
||||||
|
|
||||||
use crate::hyperfine::command::Command;
|
use crate::command::Command;
|
||||||
use crate::hyperfine::error::ParameterScanError;
|
use crate::error::ParameterScanError;
|
||||||
use crate::hyperfine::types::{NumericType, ParameterValue};
|
use crate::types::{NumericType, ParameterValue};
|
||||||
|
|
||||||
trait Numeric:
|
trait Numeric:
|
||||||
Add<Output = Self>
|
Add<Output = Self>
|
@ -1,7 +1,7 @@
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::process::{Command, ExitStatus, Stdio};
|
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
|
/// Used to indicate the result of running a command
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
@ -1,4 +1,4 @@
|
|||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct CPUTimes {
|
pub struct CPUTimes {
|
@ -1,8 +1,8 @@
|
|||||||
#![cfg(not(windows))]
|
#![cfg(not(windows))]
|
||||||
|
|
||||||
use super::internal::{CPUInterval, CPUTimes};
|
use super::internal::{CPUInterval, CPUTimes};
|
||||||
use crate::hyperfine::timer::{TimerStart, TimerStop};
|
use crate::timer::{TimerStart, TimerStop};
|
||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::process::Child;
|
use std::process::Child;
|
@ -1,8 +1,8 @@
|
|||||||
use std::process::Child;
|
use std::process::Child;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use crate::hyperfine::timer::{TimerStart, TimerStop};
|
use crate::timer::{TimerStart, TimerStop};
|
||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
|
|
||||||
pub struct WallClockTimer {
|
pub struct WallClockTimer {
|
||||||
start: Instant,
|
start: Instant,
|
@ -1,8 +1,8 @@
|
|||||||
#![cfg(windows)]
|
#![cfg(windows)]
|
||||||
|
|
||||||
use super::internal::CPUTimes;
|
use super::internal::CPUTimes;
|
||||||
use crate::hyperfine::timer::{TimerStart, TimerStop};
|
use crate::timer::{TimerStart, TimerStop};
|
||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
|
|
||||||
use winapi::um::processthreadsapi::GetProcessTimes;
|
use winapi::um::processthreadsapi::GetProcessTimes;
|
||||||
use winapi::um::winnt::HANDLE;
|
use winapi::um::winnt::HANDLE;
|
@ -1,8 +1,8 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use crate::hyperfine::format::format_duration;
|
use crate::format::format_duration;
|
||||||
use crate::hyperfine::internal::MIN_EXECUTION_TIME;
|
use crate::internal::MIN_EXECUTION_TIME;
|
||||||
use crate::hyperfine::units::Second;
|
use crate::units::Second;
|
||||||
|
|
||||||
/// A list of all possible warnings
|
/// A list of all possible warnings
|
||||||
pub enum Warnings {
|
pub enum Warnings {
|
Loading…
Reference in New Issue
Block a user