parent
fb8939eefc
commit
8683c68e59
@ -187,7 +187,7 @@ impl ClientStatsManager {
|
|||||||
let mut total_process_timing = ProcessTiming::new();
|
let mut total_process_timing = ProcessTiming::new();
|
||||||
total_process_timing.exec_speed = execs_per_sec_pretty;
|
total_process_timing.exec_speed = execs_per_sec_pretty;
|
||||||
total_process_timing.total_execs = total_execs;
|
total_process_timing.total_execs = total_execs;
|
||||||
if self.client_stats().len() > 1 {
|
if !self.client_stats().is_empty() {
|
||||||
let mut new_path_time = Duration::default();
|
let mut new_path_time = Duration::default();
|
||||||
let mut new_objectives_time = Duration::default();
|
let mut new_objectives_time = Duration::default();
|
||||||
for (_, stat) in self
|
for (_, stat) in self
|
||||||
@ -199,10 +199,10 @@ impl ClientStatsManager {
|
|||||||
new_objectives_time = stat.last_objective_time().max(new_objectives_time);
|
new_objectives_time = stat.last_objective_time().max(new_objectives_time);
|
||||||
}
|
}
|
||||||
if new_path_time > self.start_time() {
|
if new_path_time > self.start_time() {
|
||||||
total_process_timing.last_new_entry = new_path_time - self.start_time();
|
total_process_timing.last_new_entry = current_time() - new_path_time;
|
||||||
}
|
}
|
||||||
if new_objectives_time > self.start_time() {
|
if new_objectives_time > self.start_time() {
|
||||||
total_process_timing.last_saved_solution = new_objectives_time - self.start_time();
|
total_process_timing.last_saved_solution = current_time() - new_objectives_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
total_process_timing
|
total_process_timing
|
||||||
|
@ -329,13 +329,13 @@ impl ClientStats {
|
|||||||
pub fn process_timing(&mut self) -> ProcessTiming {
|
pub fn process_timing(&mut self) -> ProcessTiming {
|
||||||
let client_start_time = self.start_time();
|
let client_start_time = self.start_time();
|
||||||
let last_new_entry = if self.last_corpus_time() > self.start_time() {
|
let last_new_entry = if self.last_corpus_time() > self.start_time() {
|
||||||
self.last_corpus_time() - self.start_time()
|
current_time() - self.last_corpus_time()
|
||||||
} else {
|
} else {
|
||||||
Duration::default()
|
Duration::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let last_saved_solution = if self.last_objective_time() > self.start_time() {
|
let last_saved_solution = if self.last_objective_time() > self.start_time() {
|
||||||
self.last_objective_time() - self.start_time()
|
current_time() - self.last_objective_time()
|
||||||
} else {
|
} else {
|
||||||
Duration::default()
|
Duration::default()
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ pub struct TuiUi {
|
|||||||
version: String,
|
version: String,
|
||||||
enhanced_graphics: bool,
|
enhanced_graphics: bool,
|
||||||
show_logs: bool,
|
show_logs: bool,
|
||||||
clients_idx: usize,
|
client_idx: usize,
|
||||||
clients: usize,
|
clients: usize,
|
||||||
charts_tab_idx: usize,
|
charts_tab_idx: usize,
|
||||||
graph_data: Vec<(f64, f64)>,
|
graph_data: Vec<(f64, f64)>,
|
||||||
@ -48,7 +48,7 @@ impl TuiUi {
|
|||||||
version,
|
version,
|
||||||
enhanced_graphics,
|
enhanced_graphics,
|
||||||
show_logs: true,
|
show_logs: true,
|
||||||
clients_idx: 1,
|
client_idx: 0,
|
||||||
..TuiUi::default()
|
..TuiUi::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,29 +67,15 @@ impl TuiUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//pub fn on_up(&mut self) {}
|
|
||||||
|
|
||||||
//pub fn on_down(&mut self) {}
|
|
||||||
|
|
||||||
pub fn on_right(&mut self) {
|
pub fn on_right(&mut self) {
|
||||||
if self.clients != 0 {
|
if self.clients > 0 && self.client_idx < self.clients - 1 {
|
||||||
// clients_idx never 0
|
self.client_idx += 1;
|
||||||
if self.clients - 1 != 0 {
|
|
||||||
// except for when it is ;)
|
|
||||||
self.clients_idx = 1 + self.clients_idx % (self.clients - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_left(&mut self) {
|
pub fn on_left(&mut self) {
|
||||||
if self.clients != 0 {
|
if self.client_idx > 0 {
|
||||||
// clients_idx never 0
|
self.client_idx -= 1;
|
||||||
if self.clients_idx == 1 {
|
|
||||||
self.clients_idx = self.clients - 1;
|
|
||||||
} else if self.clients - 1 != 0 {
|
|
||||||
// don't wanna be dividing by 0
|
|
||||||
self.clients_idx = 1 + (self.clients_idx - 2) % (self.clients - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +234,7 @@ impl TuiUi {
|
|||||||
fn draw_client_ui(&mut self, f: &mut Frame, app: &Arc<RwLock<TuiContext>>, area: Rect) {
|
fn draw_client_ui(&mut self, f: &mut Frame, app: &Arc<RwLock<TuiContext>>, area: Rect) {
|
||||||
let client_block = Block::default()
|
let client_block = Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
format!("client #{} (l/r arrows to switch)", self.clients_idx),
|
format!("client #{} (←/→ arrows to switch)", self.client_idx),
|
||||||
Style::default()
|
Style::default()
|
||||||
.fg(Color::LightCyan)
|
.fg(Color::LightCyan)
|
||||||
.add_modifier(Modifier::BOLD),
|
.add_modifier(Modifier::BOLD),
|
||||||
@ -431,16 +417,16 @@ impl TuiUi {
|
|||||||
let empty_geometry: ItemGeometry = ItemGeometry::new();
|
let empty_geometry: ItemGeometry = ItemGeometry::new();
|
||||||
let item_geometry: &ItemGeometry = if is_overall {
|
let item_geometry: &ItemGeometry = if is_overall {
|
||||||
&tui_context.total_item_geometry
|
&tui_context.total_item_geometry
|
||||||
} else if self.clients < 2 {
|
} else if self.clients == 0 {
|
||||||
&empty_geometry
|
&empty_geometry
|
||||||
} else {
|
} else {
|
||||||
let clients = &tui_context.clients;
|
let clients = &tui_context.clients;
|
||||||
let client = clients.get(&self.clients_idx);
|
let client = clients.get(&self.client_idx);
|
||||||
let client = client.as_ref();
|
let client = client.as_ref();
|
||||||
if let Some(client) = client {
|
if let Some(client) = client {
|
||||||
&client.item_geometry
|
&client.item_geometry
|
||||||
} else {
|
} else {
|
||||||
log::warn!("Client {} was `None`. Race condition?", &self.clients_idx);
|
log::warn!("Client {} was `None`. Race condition?", &self.client_idx);
|
||||||
&empty_geometry
|
&empty_geometry
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -508,11 +494,11 @@ impl TuiUi {
|
|||||||
let empty_timing: ProcessTiming = ProcessTiming::new();
|
let empty_timing: ProcessTiming = ProcessTiming::new();
|
||||||
let tup: (Duration, &ProcessTiming) = if is_overall {
|
let tup: (Duration, &ProcessTiming) = if is_overall {
|
||||||
(tui_context.start_time, &tui_context.total_process_timing)
|
(tui_context.start_time, &tui_context.total_process_timing)
|
||||||
} else if self.clients < 2 {
|
} else if self.clients == 0 {
|
||||||
(current_time(), &empty_timing)
|
(current_time(), &empty_timing)
|
||||||
} else {
|
} else {
|
||||||
let clients = &tui_context.clients;
|
let clients = &tui_context.clients;
|
||||||
let client = clients.get(&self.clients_idx);
|
let client = clients.get(&self.client_idx);
|
||||||
let client = client.as_ref();
|
let client = client.as_ref();
|
||||||
if let Some(client) = client {
|
if let Some(client) = client {
|
||||||
(
|
(
|
||||||
@ -520,29 +506,29 @@ impl TuiUi {
|
|||||||
&client.process_timing,
|
&client.process_timing,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
log::warn!("Client {} was `None`. Race condition?", &self.clients_idx);
|
log::warn!("Client {} was `None`. Race condition?", &self.client_idx);
|
||||||
(current_time(), &empty_timing)
|
(current_time(), &empty_timing)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let items = vec![
|
let items = vec![
|
||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("run time")),
|
Cell::from(Span::raw("global run time")),
|
||||||
Cell::from(Span::raw(format_duration_hms(&(current_time() - tup.0)))),
|
Cell::from(Span::raw(format_duration_hms(&(current_time() - tup.0)))),
|
||||||
]),
|
]),
|
||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("exec speed")),
|
Cell::from(Span::raw("global exec speed")),
|
||||||
Cell::from(Span::raw(&tup.1.exec_speed)),
|
Cell::from(Span::raw(&tup.1.exec_speed)),
|
||||||
]),
|
]),
|
||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("total execs")),
|
Cell::from(Span::raw("global total execs")),
|
||||||
Cell::from(Span::raw(format_big_number(tup.1.total_execs))),
|
Cell::from(Span::raw(format_big_number(tup.1.total_execs))),
|
||||||
]),
|
]),
|
||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("last new entry")),
|
Cell::from(Span::raw("global last new entry")),
|
||||||
Cell::from(Span::raw(format_duration_hms(&(tup.1.last_new_entry)))),
|
Cell::from(Span::raw(format_duration_hms(&(tup.1.last_new_entry)))),
|
||||||
]),
|
]),
|
||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("last solution")),
|
Cell::from(Span::raw("global last solution")),
|
||||||
Cell::from(Span::raw(format_duration_hms(&(tup.1.last_saved_solution)))),
|
Cell::from(Span::raw(format_duration_hms(&(tup.1.last_saved_solution)))),
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
@ -642,7 +628,7 @@ impl TuiUi {
|
|||||||
Cell::from(Span::raw(format!(
|
Cell::from(Span::raw(format!(
|
||||||
"{}",
|
"{}",
|
||||||
app.clients
|
app.clients
|
||||||
.get(&self.clients_idx)
|
.get(&self.client_idx)
|
||||||
.map_or(0, |x| x.cycles_done)
|
.map_or(0, |x| x.cycles_done)
|
||||||
))),
|
))),
|
||||||
]),
|
]),
|
||||||
@ -651,7 +637,7 @@ impl TuiUi {
|
|||||||
Cell::from(Span::raw(format!(
|
Cell::from(Span::raw(format!(
|
||||||
"{}",
|
"{}",
|
||||||
app.clients
|
app.clients
|
||||||
.get(&self.clients_idx)
|
.get(&self.client_idx)
|
||||||
.map_or(0, |x| x.objectives)
|
.map_or(0, |x| x.objectives)
|
||||||
))),
|
))),
|
||||||
]),
|
]),
|
||||||
@ -686,14 +672,14 @@ impl TuiUi {
|
|||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("corpus count")),
|
Cell::from(Span::raw("corpus count")),
|
||||||
Cell::from(Span::raw(format_big_number(
|
Cell::from(Span::raw(format_big_number(
|
||||||
app.clients.get(&self.clients_idx).map_or(0, |x| x.corpus),
|
app.clients.get(&self.client_idx).map_or(0, |x| x.corpus),
|
||||||
))),
|
))),
|
||||||
]),
|
]),
|
||||||
Row::new(vec![
|
Row::new(vec![
|
||||||
Cell::from(Span::raw("total execs")),
|
Cell::from(Span::raw("total execs")),
|
||||||
Cell::from(Span::raw(format_big_number(
|
Cell::from(Span::raw(format_big_number(
|
||||||
app.clients
|
app.clients
|
||||||
.get(&self.clients_idx)
|
.get(&self.client_idx)
|
||||||
.map_or(0, |x| x.executions),
|
.map_or(0, |x| x.executions),
|
||||||
))),
|
))),
|
||||||
]),
|
]),
|
||||||
@ -701,7 +687,7 @@ impl TuiUi {
|
|||||||
Cell::from(Span::raw("map density")),
|
Cell::from(Span::raw("map density")),
|
||||||
Cell::from(Span::raw(
|
Cell::from(Span::raw(
|
||||||
app.clients
|
app.clients
|
||||||
.get(&self.clients_idx)
|
.get(&self.client_idx)
|
||||||
.map_or("0%".to_string(), |x| x.map_density.to_string()),
|
.map_or("0%".to_string(), |x| x.map_density.to_string()),
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@ -734,7 +720,7 @@ impl TuiUi {
|
|||||||
let mut items = vec![];
|
let mut items = vec![];
|
||||||
{
|
{
|
||||||
let ctx = app.read().unwrap();
|
let ctx = app.read().unwrap();
|
||||||
if let Some(client) = ctx.introspection.get(&self.clients_idx) {
|
if let Some(client) = ctx.introspection.get(&self.client_idx) {
|
||||||
items.push(Row::new(vec![
|
items.push(Row::new(vec![
|
||||||
Cell::from(Span::raw("scheduler")),
|
Cell::from(Span::raw("scheduler")),
|
||||||
Cell::from(Span::raw(format!("{:.2}%", client.scheduler * 100.0))),
|
Cell::from(Span::raw(format!("{:.2}%", client.scheduler * 100.0))),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user