clippy!
This commit is contained in:
parent
56101df85e
commit
8fa0089596
@ -7,7 +7,7 @@ use std::{io::Write, path::PathBuf};
|
|||||||
|
|
||||||
use base16384::Base16384Utf8;
|
use base16384::Base16384Utf8;
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
/// 根据 u64 生成对应的 name
|
/// 根据 u64 生成对应的 name
|
||||||
/// 转换成 base 16384
|
/// 转换成 base 16384
|
||||||
@ -58,7 +58,7 @@ pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) {
|
|||||||
let team_namer = TeamNamer::new(&config.team).unwrap();
|
let team_namer = TeamNamer::new(&config.team).unwrap();
|
||||||
|
|
||||||
for i in (config.start + id..config.end).step_by(config.thread_count as usize) {
|
for i in (config.start + id..config.end).step_by(config.thread_count as usize) {
|
||||||
let name = gen_name(i as u64);
|
let name = gen_name(i);
|
||||||
let mut namer = Namer::new_from_team_namer_unchecked(&team_namer, name.as_str());
|
let mut namer = Namer::new_from_team_namer_unchecked(&team_namer, name.as_str());
|
||||||
let prop = namer.get_property();
|
let prop = namer.get_property();
|
||||||
|
|
||||||
|
@ -1,23 +1,18 @@
|
|||||||
mod eval;
|
mod eval;
|
||||||
mod model13;
|
mod model13;
|
||||||
|
#[allow(clippy::excessive_precision)]
|
||||||
mod model20;
|
mod model20;
|
||||||
|
|
||||||
use crate::evaluate::NamerEvaluater;
|
use crate::evaluate::NamerEvaluater;
|
||||||
use crate::name::Namer;
|
use crate::name::Namer;
|
||||||
|
|
||||||
pub struct XuPing1_3_1 {
|
pub struct XuPing1_3_1;
|
||||||
pub limit: f64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl XuPing1_3_1 {
|
|
||||||
pub fn new(limit: f64) -> Self { Self { limit } }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NamerEvaluater for XuPing1_3_1 {
|
impl NamerEvaluater for XuPing1_3_1 {
|
||||||
const NAME: &'static str = "虚评";
|
const NAME: &'static str = "虚评";
|
||||||
const VERSION: &'static str = "1.3.1";
|
const VERSION: &'static str = "1.3.1";
|
||||||
fn evaluate(name: &Namer) -> f64 { eval::predict_13(name) }
|
fn evaluate(name: &Namer) -> f64 { eval::predict_13(name) }
|
||||||
fn check(&self, name: &Namer) -> bool { eval::predict_13(name) > self.limit }
|
fn check(&self, name: &Namer) -> bool { eval::predict_13(name) > 0.0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct XuPing2_0_1015;
|
pub struct XuPing2_0_1015;
|
||||||
|
@ -5,8 +5,6 @@ use std::simd::f64x64;
|
|||||||
#[cfg(feature = "simd")]
|
#[cfg(feature = "simd")]
|
||||||
use std::simd::num::SimdFloat;
|
use std::simd::num::SimdFloat;
|
||||||
|
|
||||||
use tracing::{debug, info};
|
|
||||||
|
|
||||||
use crate::evaluate::xuping::{model13 as xuping13, model20 as xuping20};
|
use crate::evaluate::xuping::{model13 as xuping13, model20 as xuping20};
|
||||||
use crate::name::Namer;
|
use crate::name::Namer;
|
||||||
|
|
||||||
@ -281,12 +279,6 @@ mod test {
|
|||||||
assert_eq!(predict_13(&namer), 5799.586821819176);
|
assert_eq!(predict_13(&namer), 5799.586821819176);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn xp_20(name: &str) -> f64 {
|
|
||||||
let mut namer = Namer::new(&name.to_string()).unwrap();
|
|
||||||
namer.update_skill();
|
|
||||||
predict_20(&namer)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn xuping_20_1015_test() {
|
fn xuping_20_1015_test() {
|
||||||
// let mut namer = Namer::new(&"pi31uXx?shadow@魔".to_string()).unwrap();
|
// let mut namer = Namer::new(&"pi31uXx?shadow@魔".to_string()).unwrap();
|
||||||
@ -295,7 +287,6 @@ mod test {
|
|||||||
namer.update_skill();
|
namer.update_skill();
|
||||||
|
|
||||||
println!("{:?}", namer.get_info());
|
println!("{:?}", namer.get_info());
|
||||||
// println!("{:?}", xp_20("一一七啺埀㴁@shenjack"));
|
|
||||||
assert_eq!(predict_20(&namer), 3603.4389333619297);
|
assert_eq!(predict_20(&namer), 3603.4389333619297);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ impl Command {
|
|||||||
team: self.team.clone(),
|
team: self.team.clone(),
|
||||||
report_interval: self.report_interval,
|
report_interval: self.report_interval,
|
||||||
core_affinity: if self.bench {
|
core_affinity: if self.bench {
|
||||||
Some(0001 << self.bench_core)
|
Some(1 << self.bench_core)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
@ -75,7 +75,7 @@ pub fn set_thread2core(core: usize) {
|
|||||||
x => info!("设置线程亲和性成功 {}", x),
|
x => info!("设置线程亲和性成功 {}", x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(linux)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
warn!("Linux 下不支持设置线程亲和性 (未实现) {}", core)
|
warn!("Linux 下不支持设置线程亲和性 (未实现) {}", core)
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ pub fn set_process_cores(cores: usize) {
|
|||||||
x => info!("设置进程亲和性成功 {}", x),
|
x => info!("设置进程亲和性成功 {}", x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(linux)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
warn!("Linux 下不支持设置进程亲和性 (未实现) {}", cores)
|
warn!("Linux 下不支持设置进程亲和性 (未实现) {}", cores)
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ fn main() {
|
|||||||
let out_path = PathBuf::from(format!("./namerena/{}", output_filename));
|
let out_path = PathBuf::from(format!("./namerena/{}", output_filename));
|
||||||
info!("输出文件: {:?}", out_path);
|
info!("输出文件: {:?}", out_path);
|
||||||
// 先创建文件夹
|
// 先创建文件夹
|
||||||
if let Err(e) = std::fs::create_dir_all(&out_path.parent().unwrap()) {
|
if let Err(e) = std::fs::create_dir_all(out_path.parent().unwrap()) {
|
||||||
warn!("创建文件夹失败: {}", e);
|
warn!("创建文件夹失败: {}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ fn main() {
|
|||||||
if cli_arg.bench {
|
if cli_arg.bench {
|
||||||
info!("开始 benchmark");
|
info!("开始 benchmark");
|
||||||
let mut config = cli_arg.as_cacl_config();
|
let mut config = cli_arg.as_cacl_config();
|
||||||
config.core_affinity = Some(0001 << cli_arg.bench_core);
|
config.core_affinity = Some(1 << cli_arg.bench_core);
|
||||||
set_process_cores(cli_arg.bench_core);
|
set_process_cores(cli_arg.bench_core);
|
||||||
cacluate::cacl(config, 1, &out_path);
|
cacluate::cacl(config, 1, &out_path);
|
||||||
} else {
|
} else {
|
||||||
@ -139,8 +139,8 @@ fn main() {
|
|||||||
n += 1;
|
n += 1;
|
||||||
let mut config = cli_arg.as_cacl_config();
|
let mut config = cli_arg.as_cacl_config();
|
||||||
// 核心亲和性: n, n+1
|
// 核心亲和性: n, n+1
|
||||||
config.core_affinity = Some((0001 << i) + (0001 << (i + 1)));
|
config.core_affinity = Some((1 << i) + (1 << (i + 1)));
|
||||||
cores |= (0001 << i) + (0001 << (i + 1));
|
cores |= (1 << i) + (1 << (i + 1));
|
||||||
let out_path = out_path.clone();
|
let out_path = out_path.clone();
|
||||||
let thread_name = format!("thread_{}", n);
|
let thread_name = format!("thread_{}", n);
|
||||||
threads.push(std::thread::spawn(move || {
|
threads.push(std::thread::spawn(move || {
|
||||||
|
Loading…
Reference in New Issue
Block a user