改进可用性
This commit is contained in:
parent
fcd049d800
commit
5612e6bf73
22
readme.md
22
readme.md
@ -8,10 +8,20 @@
|
||||
Usage: namerena-rs.exe [OPTIONS] --team <TEAM>
|
||||
|
||||
Options:
|
||||
--start <START> [default: 0]
|
||||
--end <END> [default: 18446744073709551615]
|
||||
-t, --thread-count <THREAD_COUNT> [default: 10]
|
||||
--top <TOP> [default: 750]
|
||||
--team <TEAM>
|
||||
-h, --help Print help
|
||||
--start <START> 开始的 id [default: 0]
|
||||
--end <END> 结束的 id [default: 18446744073709551615]
|
||||
-t, --thread-count <THREAD_COUNT> 线程数 [default: 10]
|
||||
-p, --prop-expected <PROP_EXPECT> 八围预期值 [default: 740]
|
||||
--team <TEAM> 队伍名称
|
||||
--report-interval <REPORT_INTERVAL> 预期状态输出时间间隔 (秒) [default: 10]
|
||||
-h, --help Print help
|
||||
```
|
||||
|
||||
```text
|
||||
2024-03-01T18:05:23.839032Z INFO namerena_rs: | 1|Id: 753431199|595224.82/s 514.274E/d 10.00 ⬆️ 预计:4304342210:30:47|
|
||||
2024-03-01T18:05:23.840289Z INFO namerena_rs: | 2|Id: 753355740|595089.89/s 514.158E/d 10.00 ⬆️ 预计:4305318679:54:45|
|
||||
2024-03-01T18:05:33.662249Z INFO namerena_rs: | 2|Id: 765257520|605880.29/s 523.481E/d 9.82 ⬆️ 预计:4228638984:28:1|
|
||||
2024-03-01T18:05:33.663742Z INFO namerena_rs: | 1|Id: 765335679|605851.08/s 523.455E/d 9.82 ⬆️ 预计:4228841394:50:46|
|
||||
2024-03-01T18:05:43.562524Z INFO namerena_rs: | 1|Id: 777452699|612050.45/s 528.812E/d 9.90 ⬆️ 预计:4186010600:17:22|
|
||||
2024-03-01T18:05:43.570757Z INFO namerena_rs: | 2|Id: 777375120|611481.35/s 528.320E/d 9.91 ⬆️ 预计:4189905799:2:50|
|
||||
```
|
||||
|
23
src/main.rs
23
src/main.rs
@ -6,8 +6,8 @@ use std::{io::Write, path::PathBuf};
|
||||
|
||||
use base16384::Base16384Utf8;
|
||||
use clap::Parser;
|
||||
use tracing::{info, warn};
|
||||
use colored::Colorize;
|
||||
use tracing::{info, warn};
|
||||
|
||||
/// 根据 u64 生成对应的 name
|
||||
/// 转换成 base 16384
|
||||
@ -86,7 +86,7 @@ fn cacl(config: Command, id: u64, outfile: &PathBuf) {
|
||||
if (prop + allow_d as f32) > config.prop_expect as f32 {
|
||||
let name = gen_name(i as u64);
|
||||
let full_name = format!("{}@{}", name, config.team);
|
||||
info!("{:>15}|{}|{}", i, full_name, show_name(&namer));
|
||||
info!("Id:{:>15}|{}|{}", i, full_name, show_name(&namer));
|
||||
// 写入 (写到最后一行)
|
||||
match std::fs::OpenOptions::new()
|
||||
.append(true)
|
||||
@ -104,10 +104,14 @@ fn cacl(config: Command, id: u64, outfile: &PathBuf) {
|
||||
let now = std::time::Instant::now();
|
||||
let d_t: std::time::Duration = now.duration_since(start_time);
|
||||
let new_run_speed = k as f64 / d_t.as_secs_f64();
|
||||
// 预估剩余时间
|
||||
let wait_time = (config.end - i) / config.thread_count as u64 / new_run_speed as u64;
|
||||
let wait_time = chrono::Duration::seconds(wait_time as i64);
|
||||
// 转换成 时:分:秒
|
||||
// 根据实际运行速率来调整 report_interval
|
||||
report_interval = config.report_interval * new_run_speed as u64;
|
||||
info!(
|
||||
"|{:>2}|Id:{:>15}|{:6.2}/s {:>3.3}E/d {:>5.2} {}",
|
||||
"|{:>2}|Id:{:>15}|{:6.2}/s {:>3.3}E/d {:>5.2} {} 预计:{}:{}:{}|",
|
||||
id,
|
||||
i,
|
||||
new_run_speed,
|
||||
@ -122,7 +126,10 @@ fn cacl(config: Command, id: u64, outfile: &PathBuf) {
|
||||
"⬇️".red()
|
||||
} else {
|
||||
"➡️".blue()
|
||||
}
|
||||
},
|
||||
wait_time.num_hours(),
|
||||
wait_time.num_minutes() % 60,
|
||||
wait_time.num_seconds() % 60
|
||||
);
|
||||
run_speed = new_run_speed;
|
||||
start_time = std::time::Instant::now();
|
||||
@ -156,11 +163,11 @@ fn main() {
|
||||
warn!("创建文件失败: {}", e);
|
||||
}
|
||||
|
||||
info!("start: {} end: {}", cli_arg.start, cli_arg.end);
|
||||
info!("thread_count: {}", cli_arg.thread_count);
|
||||
info!("开始: {} 结尾: {}", cli_arg.start, cli_arg.end);
|
||||
info!("线程数: {}", cli_arg.thread_count);
|
||||
info!("八围预期: {}", cli_arg.prop_expect);
|
||||
info!("team: {}", cli_arg.team);
|
||||
info!("output: {:?}", out_path);
|
||||
info!("队伍名: {}", cli_arg.team);
|
||||
info!("输出文件名: {:?}", out_path);
|
||||
|
||||
for i in 0..cli_arg.thread_count {
|
||||
n += 1;
|
||||
|
Loading…
Reference in New Issue
Block a user