Send the requests to the loader and render them

This commit is contained in:
Olivier 'reivilibre' 2022-01-08 16:41:15 +00:00
parent 9b24993736
commit 9cc141e227
2 changed files with 15 additions and 2 deletions

View File

@ -190,6 +190,7 @@ pub enum MetricsLogReaderMessage {
LoadNewWindow {
new_time_range: RangeInclusive<f64>,
new_wanted_time_points: u32,
requests: Vec<GraphRequest>,
},
}
@ -527,6 +528,7 @@ impl<R: Read + Seek> MetricsLogReaderManager<R> {
new_window.points.push((next_val.0, rate));
last_val = *next_val;
}
new_window.summarise_in_place();
metrics_window.scalars.insert(request, new_window);
}
}
@ -703,6 +705,7 @@ impl<R: Read + Seek> MetricsLogReaderManager<R> {
MetricsLogReaderMessage::LoadNewWindow {
new_time_range,
new_wanted_time_points,
requests,
} => {
debug!(
"Requested new window; time range {:?}, № points {}",
@ -755,7 +758,7 @@ impl<R: Read + Seek> MetricsLogReaderManager<R> {
UnixTimestampMilliseconds(start),
UnixTimestampMilliseconds(end),
new_wanted_time_points,
Default::default(), // TODO
requests,
)?;
debug!("METRIC WINDOW {:#?}", metric_window);

View File

@ -10,7 +10,7 @@ use eframe::epi::{App, Frame, Storage};
use eframe::NativeOptions;
use env_logger::Env;
use log::{debug, info, warn};
use std::collections::{BTreeMap};
use std::collections::BTreeMap;
use std::fs::File;
use std::path::PathBuf;
use std::str::FromStr;
@ -71,6 +71,7 @@ impl App for MetricsGui {
.send(MetricsLogReaderMessage::LoadNewWindow {
new_time_range: f64::NEG_INFINITY..=f64::INFINITY,
new_wanted_time_points: 512,
requests: Vec::with_capacity(0),
})
.unwrap();
}
@ -113,6 +114,15 @@ impl MetricsGui {
} else {
// TODO Build some stuff automatically based on alphabetical ordering
}
self.requester
.tx
.send(MetricsLogReaderMessage::LoadNewWindow {
new_time_range: f64::NEG_INFINITY..=f64::INFINITY,
new_wanted_time_points: 512,
requests: self.graph_requests.clone(),
})
.unwrap();
}
}