Files
hyperfine/src/main.rs
T

46 lines
1.0 KiB
Rust
Raw Normal View History

2018-03-24 18:30:52 -04:00
use std::env;
2018-01-13 16:50:02 +01:00
2021-08-24 21:24:34 +02:00
use app::get_arg_matches;
2022-02-06 20:10:40 +01:00
use benchmark::schedule::run_benchmarks_and_print_comparison;
use command::build_commands;
2022-02-06 18:22:55 +01:00
use export::ExportManager;
2022-02-06 20:10:40 +01:00
use options::Options;
2018-01-14 10:48:47 +01:00
2022-02-06 20:10:40 +01:00
use anyhow::Result;
2022-02-06 19:49:31 +01:00
use colored::*;
pub mod app;
pub mod benchmark;
pub mod command;
pub mod error;
pub mod export;
pub mod options;
pub mod outlier_detection;
pub mod output;
pub mod parameter;
pub mod shell;
pub mod timer;
2022-02-06 20:01:41 +01:00
pub mod util;
2018-01-14 11:41:27 +13:00
2022-02-06 17:44:28 +01:00
fn run() -> Result<()> {
// Enabled ANSI colors on Windows 10
#[cfg(windows)]
colored::control::set_virtual_terminal(true).unwrap();
2018-03-24 18:30:52 -04:00
let matches = get_arg_matches(env::args_os());
2022-02-06 18:20:38 +01:00
let options = Options::from_cli_arguments(&matches)?;
2022-02-06 17:44:28 +01:00
let commands = build_commands(&matches)?;
2022-02-06 18:22:55 +01:00
let export_manager = ExportManager::from_cli_arguments(&matches)?;
2018-03-24 18:30:52 -04:00
2022-02-06 17:44:28 +01:00
run_benchmarks_and_print_comparison(&commands, &options, &export_manager)
}
2018-03-24 18:30:52 -04:00
2022-02-06 17:44:28 +01:00
fn main() {
match run() {
2020-10-16 10:47:26 +02:00
Ok(_) => {}
2022-02-06 17:44:28 +01:00
Err(e) => {
eprintln!("{} {:#}", "Error:".red(), e);
std::process::exit(1);
}
2018-03-24 18:30:52 -04:00
}
}