mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 13:45:12 +02:00
Fixed network chart to make it a bit more like before my changes
This commit is contained in:
parent
0a13d75415
commit
7bf88dffd1
@ -157,31 +157,33 @@ impl DataCollection {
|
|||||||
&mut self, harvested_data: &Data, harvested_time: &Instant, new_entry: &mut TimedData,
|
&mut self, harvested_data: &Data, harvested_time: &Instant, new_entry: &mut TimedData,
|
||||||
) {
|
) {
|
||||||
// RX
|
// 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() {
|
let rx_joining_pts = if let Some((time, last_pt)) = self.timed_data_vec.last() {
|
||||||
generate_joining_points(
|
generate_joining_points(&time, last_pt.rx_data.0, &harvested_time, logged_rx_val)
|
||||||
&time,
|
|
||||||
last_pt.rx_data.0,
|
|
||||||
&harvested_time,
|
|
||||||
harvested_data.network.rx as f64,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
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;
|
new_entry.rx_data = rx_pt;
|
||||||
|
|
||||||
// TX
|
// 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() {
|
let tx_joining_pts = if let Some((time, last_pt)) = self.timed_data_vec.last() {
|
||||||
generate_joining_points(
|
generate_joining_points(&time, last_pt.tx_data.0, &harvested_time, logged_tx_val)
|
||||||
&time,
|
|
||||||
last_pt.tx_data.0,
|
|
||||||
&harvested_time,
|
|
||||||
harvested_data.network.tx as f64,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
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;
|
new_entry.tx_data = tx_pt;
|
||||||
|
|
||||||
// In addition copy over latest data for easy reference
|
// 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>(
|
fn draw_search_field<B: backend::Backend>(
|
||||||
f: &mut Frame<B>, app_state: &mut app::App, draw_loc: Rect,
|
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 query = app_state.get_current_search_query();
|
||||||
let shrunk_query = if query.len() < width as usize {
|
let shrunk_query = if query.len() < width as usize {
|
||||||
query
|
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 TIME_STARTS_FROM: u64 = 60 * 1000;
|
||||||
pub const TICK_RATE_IN_MILLISECONDS: u64 = 200; // How fast the screen refreshes
|
pub const TICK_RATE_IN_MILLISECONDS: u64 = 200; // How fast the screen refreshes
|
||||||
pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS: u128 = 1000;
|
pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS: u128 = 1000;
|
||||||
|
@ -259,44 +259,16 @@ pub fn convert_network_data_points(
|
|||||||
//Insert joiner points
|
//Insert joiner points
|
||||||
for &(joiner_offset, joiner_val) in &data.rx_data.1 {
|
for &(joiner_offset, joiner_val) in &data.rx_data.1 {
|
||||||
let offset_time = time_from_start - joiner_offset as f64;
|
let offset_time = time_from_start - joiner_offset as f64;
|
||||||
rx.push((
|
rx.push((offset_time, joiner_val));
|
||||||
offset_time,
|
|
||||||
if joiner_val > 0.0 {
|
|
||||||
(joiner_val).log(2.0)
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for &(joiner_offset, joiner_val) in &data.tx_data.1 {
|
for &(joiner_offset, joiner_val) in &data.tx_data.1 {
|
||||||
let offset_time = time_from_start - joiner_offset as f64;
|
let offset_time = time_from_start - joiner_offset as f64;
|
||||||
tx.push((
|
tx.push((offset_time, joiner_val));
|
||||||
offset_time,
|
|
||||||
if joiner_val > 0.0 {
|
|
||||||
(joiner_val).log(2.0)
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rx.push((
|
rx.push((time_from_start, data.rx_data.0));
|
||||||
time_from_start,
|
tx.push((time_from_start, data.rx_data.0));
|
||||||
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
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let total_rx_converted_result: (f64, String);
|
let total_rx_converted_result: (f64, String);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user