main.rs
This file
Path
src/main.rs
61 lines · 1.4 KiB · Rust
Last changed by
SortOrder fieldDavid Peterbefore adoption038f369
History of this fileTake it
1#![cfg_attr(2 all(windows, feature = "windows_process_extensions_main_thread_handle"),3 feature(windows_process_extensions_main_thread_handle)4)]56use std::env;78use benchmark::scheduler::Scheduler;9use cli::get_cli_arguments;10use command::Commands;11use export::ExportManager;12use options::Options;1314use anyhow::Result;15use colored::*;1617pub mod benchmark;18pub mod cli;19pub mod command;20pub mod error;21pub mod export;22pub mod options;23pub mod outlier_detection;24pub mod output;25pub mod parameter;26pub mod timer;27pub mod util;2829fn run() -> Result<()> {30 // Enabled ANSI colors on Windows 1031 #[cfg(windows)]32 colored::control::set_virtual_terminal(true).unwrap();3334 let cli_arguments = get_cli_arguments(env::args_os());35 let mut options = Options::from_cli_arguments(&cli_arguments)?;36 let commands = Commands::from_cli_arguments(&cli_arguments)?;37 let export_manager = ExportManager::from_cli_arguments(38 &cli_arguments,39 options.time_unit,40 options.sort_order_exports,41 )?;4243 options.validate_against_command_list(&commands)?;4445 let mut scheduler = Scheduler::new(&commands, &options, &export_manager);46 scheduler.run_benchmarks()?;47 scheduler.print_relative_speed_comparison();48 scheduler.final_export()?;4950 Ok(())51}5253fn main() {54 match run() {55 Ok(_) => {}56 Err(e) => {57 eprintln!("{} {:#}", "Error:".red(), e);58 std::process::exit(1);59 }60 }61}