main.rs
This file
Path
src/main.rs
51 lines · 1.2 KiB · Rust
Last changed by
Move to timer moduleDavid Peterbefore adoption0ffc6d7
History of this fileTake it
1use std::env;23use app::get_cli_arguments;4use benchmark::scheduler::Scheduler;5use command::Commands;6use export::ExportManager;7use options::Options;89use anyhow::Result;10use colored::*;1112pub mod app;13pub mod benchmark;14pub mod command;15pub mod error;16pub mod export;17pub mod options;18pub mod outlier_detection;19pub mod output;20pub mod parameter;21pub mod timer;22pub mod util;2324fn run() -> Result<()> {25 // Enabled ANSI colors on Windows 1026 #[cfg(windows)]27 colored::control::set_virtual_terminal(true).unwrap();2829 let cli_arguments = get_cli_arguments(env::args_os());30 let options = Options::from_cli_arguments(&cli_arguments)?;31 let commands = Commands::from_cli_arguments(&cli_arguments)?;32 let export_manager = ExportManager::from_cli_arguments(&cli_arguments)?;3334 options.validate_against_command_list(&commands)?;3536 let mut scheduler = Scheduler::new(&commands, &options, &export_manager);37 scheduler.run_benchmarks()?;38 scheduler.print_relative_speed_comparison();3940 Ok(())41}4243fn main() {44 match run() {45 Ok(_) => {}46 Err(e) => {47 eprintln!("{} {:#}", "Error:".red(), e);48 std::process::exit(1);49 }50 }51}