#![feature(portable_simd)] #![feature(slice_swap_unchecked)] mod cacluate; mod evaluate; mod generate; mod name; use std::path::PathBuf; use clap::Parser; use tracing::{info, warn}; use crate::cacluate::CacluateConfig; #[allow(non_upper_case_globals)] const allow_d: u32 = 10; #[derive(Parser, Debug, Clone)] pub struct Command { /// 开始的 id #[arg(long, default_value_t = 0)] pub start: u64, /// 结束的 id #[arg(long, default_value_t = u64::MAX)] pub end: u64, /// 线程数 #[arg(long, short = 't', default_value_t = 10)] pub thread_count: u32, /// 八围预期值 #[arg(long = "prop-expected", short = 'p', default_value_t = 740)] pub prop_expect: u32, /// 队伍名称 #[arg(long)] pub team: String, /// 预期状态输出时间间隔 (秒) #[arg(long, short = 'r', default_value_t = 10)] pub report_interval: u64, } impl Command { pub fn as_cacl_config(&self) -> CacluateConfig { CacluateConfig { start: self.start, end: self.end, thread_count: self.thread_count, prop_expect: self.prop_expect, prop_allow: allow_d, team: self.team.clone(), report_interval: self.report_interval, } } } fn main() { tracing_subscriber::fmt::init(); let mut cli_arg = Command::parse(); // 将数据量处理成可被 thread_count 整除 let left = cli_arg.start % cli_arg.thread_count as u64; cli_arg.end = cli_arg.end.wrapping_add(left); let mut n = 0; let mut threads = Vec::with_capacity(cli_arg.thread_count as usize); let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S").to_string(); // namerena--