This commit is contained in:
shenjack 2024-06-24 01:29:38 +08:00
parent 69c84f5e30
commit e68781e80e
Signed by: shenjack
GPG Key ID: 7B1134A979775551
3 changed files with 7 additions and 15 deletions

View File

@ -4,12 +4,7 @@ use crate::{
Command, Command,
}; };
use std::{ use std::{io::Write, ops::Range, path::PathBuf};
io::Write,
ops::Range,
path::PathBuf,
time::{Duration, Instant},
};
use base16384::Base16384Utf8; use base16384::Base16384Utf8;
use colored::Colorize; use colored::Colorize;
@ -29,10 +24,6 @@ pub fn gen_name(id: u64) -> String {
} }
pub struct CacluateConfig { pub struct CacluateConfig {
/// 开始
pub start: u64,
/// 结束
pub end: u64,
/// 线程 id /// 线程 id
pub thread_id: u32, pub thread_id: u32,
/// 线程数 /// 线程数
@ -312,8 +303,8 @@ pub fn cacl(
let predict_time = status.predict_time(top); let predict_time = status.predict_time(top);
// 输出状态 // 输出状态
info!( info!(
// thread_id, top, 当前线程速度, 当前batch用时, emoji, 全局速度, 全局E/d 速度, 算到几个, 预计时间 // thread_id, top, 当前线程速度, 当前batch用时, emoji, 全局速度, 全局E/d 速度, 算到几个, 进度, 预计时间
"|{:>2}|Id:{:>15}|{:6.2}/s {:>5.2}|{:6.2}/s {:>3.3}E/d {}|{:<3}|预计:{}:{}:{}|", "|{:>2}|Id:{:>15}|{:6.2}/s {:>5.2}|{:6.2}/s {:>3.3}E/d {}|{:<3}|{:3.2}% 预计:{}:{}:{}|",
config.thread_id, config.thread_id,
top, top,
new_run_speed, new_run_speed,
@ -329,6 +320,7 @@ pub fn cacl(
status.count_speed(), status.count_speed(),
status.count_speed() as f64 / 86400.0, status.count_speed() as f64 / 86400.0,
get_count, get_count,
(top - status.start) as f64 / (status.end - status.start) as f64 * 100.0,
predict_time.num_hours(), predict_time.num_hours(),
predict_time.num_minutes() % 60, predict_time.num_minutes() % 60,
predict_time.num_seconds() % 60 predict_time.num_seconds() % 60
@ -336,7 +328,8 @@ pub fn cacl(
run_speed = new_run_speed; run_speed = new_run_speed;
// 然后是调度相关 // 然后是调度相关
status.update_running(config.thread_id, false); status.update_running(config.thread_id, false);
// 直接下一次循环 // 请求一个新的 work
let _ = work_sender.send((config.thread_id, if run_speed == 0.0 { 0 } else { run_speed as u32 }));
} }
} }

View File

@ -4,6 +4,7 @@ pub mod xuping;
use crate::name::Namer; use crate::name::Namer;
/// 评价器 /// 评价器
#[allow(unused)]
pub trait NamerEvaluater { pub trait NamerEvaluater {
const NAME: &'static str; const NAME: &'static str;
const VERSION: &'static str; const VERSION: &'static str;

View File

@ -47,8 +47,6 @@ pub struct Command {
impl Command { impl Command {
pub fn as_cacl_config(&self, path: &PathBuf) -> CacluateConfig { pub fn as_cacl_config(&self, path: &PathBuf) -> CacluateConfig {
CacluateConfig { CacluateConfig {
start: self.start,
end: self.end,
thread_id: 0, thread_id: 0,
thread_count: self.thread_count, thread_count: self.thread_count,
prop_expect: self.prop_expect, prop_expect: self.prop_expect,