mirror of
https://github.com/ClementTsang/bottom
synced 2025-02-15 12:48:28 +00:00
Fixed network chart to make it a bit more like before my changes
This commit is contained in:
parent
0a13d75415
commit
7bf88dffd1
4 changed files with 22 additions and 48 deletions
|
@ -157,31 +157,33 @@ impl DataCollection {
|
|||
&mut self, harvested_data: &Data, harvested_time: &Instant, new_entry: &mut TimedData,
|
||||
) {
|
||||
// RX
|
||||
let logged_rx_val = if harvested_data.network.rx as f64 > 0.0 {
|
||||
(harvested_data.network.rx as f64).log(2.0)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
let rx_joining_pts = if let Some((time, last_pt)) = self.timed_data_vec.last() {
|
||||
generate_joining_points(
|
||||
&time,
|
||||
last_pt.rx_data.0,
|
||||
&harvested_time,
|
||||
harvested_data.network.rx as f64,
|
||||
)
|
||||
generate_joining_points(&time, last_pt.rx_data.0, &harvested_time, logged_rx_val)
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let rx_pt = (harvested_data.network.rx as f64, rx_joining_pts);
|
||||
let rx_pt = (logged_rx_val, rx_joining_pts);
|
||||
new_entry.rx_data = rx_pt;
|
||||
|
||||
// TX
|
||||
let logged_tx_val = if harvested_data.network.tx as f64 > 0.0 {
|
||||
(harvested_data.network.tx as f64).log(2.0)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
let tx_joining_pts = if let Some((time, last_pt)) = self.timed_data_vec.last() {
|
||||
generate_joining_points(
|
||||
&time,
|
||||
last_pt.tx_data.0,
|
||||
&harvested_time,
|
||||
harvested_data.network.tx as f64,
|
||||
)
|
||||
generate_joining_points(&time, last_pt.tx_data.0, &harvested_time, logged_tx_val)
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let tx_pt = (harvested_data.network.tx as f64, tx_joining_pts);
|
||||
let tx_pt = (logged_tx_val, tx_joining_pts);
|
||||
new_entry.tx_data = tx_pt;
|
||||
|
||||
// In addition copy over latest data for easy reference
|
||||
|
|
|
@ -889,7 +889,7 @@ fn draw_disk_table<B: backend::Backend>(
|
|||
fn draw_search_field<B: backend::Backend>(
|
||||
f: &mut Frame<B>, app_state: &mut app::App, draw_loc: Rect,
|
||||
) {
|
||||
let width = max(0, draw_loc.width as i64 - 20) as u64; // TODO [SEARCH] this is hard-coded... ew
|
||||
let width = max(0, draw_loc.width as i64 - 34) as u64;
|
||||
let query = app_state.get_current_search_query();
|
||||
let shrunk_query = if query.len() < width as usize {
|
||||
query
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub const STALE_MAX_MILLISECONDS: u128 = 60 * 1000; // How long to store data
|
||||
pub const STALE_MAX_MILLISECONDS: u128 = 60 * 1000; // How long to store data.
|
||||
pub const TIME_STARTS_FROM: u64 = 60 * 1000;
|
||||
pub const TICK_RATE_IN_MILLISECONDS: u64 = 200; // How fast the screen refreshes
|
||||
pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS: u128 = 1000;
|
||||
|
|
|
@ -259,44 +259,16 @@ pub fn convert_network_data_points(
|
|||
//Insert joiner points
|
||||
for &(joiner_offset, joiner_val) in &data.rx_data.1 {
|
||||
let offset_time = time_from_start - joiner_offset as f64;
|
||||
rx.push((
|
||||
offset_time,
|
||||
if joiner_val > 0.0 {
|
||||
(joiner_val).log(2.0)
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
));
|
||||
rx.push((offset_time, joiner_val));
|
||||
}
|
||||
|
||||
for &(joiner_offset, joiner_val) in &data.tx_data.1 {
|
||||
let offset_time = time_from_start - joiner_offset as f64;
|
||||
tx.push((
|
||||
offset_time,
|
||||
if joiner_val > 0.0 {
|
||||
(joiner_val).log(2.0)
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
));
|
||||
tx.push((offset_time, joiner_val));
|
||||
}
|
||||
|
||||
rx.push((
|
||||
time_from_start,
|
||||
if data.rx_data.0 > 0.0 {
|
||||
(data.rx_data.0).log(2.0)
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
));
|
||||
tx.push((
|
||||
time_from_start,
|
||||
if data.rx_data.0 > 0.0 {
|
||||
(data.rx_data.0).log(2.0)
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
));
|
||||
rx.push((time_from_start, data.rx_data.0));
|
||||
tx.push((time_from_start, data.rx_data.0));
|
||||
}
|
||||
|
||||
let total_rx_converted_result: (f64, String);
|
||||
|
|
Loading…
Add table
Reference in a new issue