Changed network data to show decimal point.
This commit is contained in:
parent
467af10c36
commit
076d6a0546
|
@ -287,31 +287,31 @@ pub fn convert_network_data_points(network_data: &[data_collection::network::Net
|
||||||
let rx_display = if let Some(last_num_bytes_entry) = network_data.last() {
|
let rx_display = if let Some(last_num_bytes_entry) = network_data.last() {
|
||||||
let num_bytes = last_num_bytes_entry.rx;
|
let num_bytes = last_num_bytes_entry.rx;
|
||||||
if num_bytes < 1024 {
|
if num_bytes < 1024 {
|
||||||
format!("RX: {:4} B", num_bytes).to_string()
|
format!("RX: {:5.*} B/s", 1, num_bytes as f64).to_string()
|
||||||
} else if num_bytes < (1024 * 1024) {
|
} else if num_bytes < (1024 * 1024) {
|
||||||
format!("RX: {:4}KB", num_bytes / 1024).to_string()
|
format!("RX: {:5.*}KB/s", 1, num_bytes as f64 / 1024.0).to_string()
|
||||||
} else if num_bytes < (1024 * 1024 * 1024) {
|
} else if num_bytes < (1024 * 1024 * 1024) {
|
||||||
format!("RX: {:4}MB", num_bytes / 1024 / 1024).to_string()
|
format!("RX: {:5.*}MB/s", 1, num_bytes as f64 / 1024.0 / 1024.0).to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("RX: {:4}GB", num_bytes / 1024 / 1024 / 1024).to_string()
|
format!("RX: {:5.*}GB/s", 1, num_bytes as f64 / 1024.0 / 1024.0 / 1024.0).to_string()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"0B".to_string()
|
"0.0B/s".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
let tx_display = if let Some(last_num_bytes_entry) = network_data.last() {
|
let tx_display = if let Some(last_num_bytes_entry) = network_data.last() {
|
||||||
let num_bytes = last_num_bytes_entry.tx;
|
let num_bytes = last_num_bytes_entry.tx;
|
||||||
if num_bytes < 1024 {
|
if num_bytes < 1024 {
|
||||||
format!("TX: {:4} B", num_bytes).to_string()
|
format!("TX: {:5.*} B/s", 1, num_bytes as f64).to_string()
|
||||||
} else if num_bytes < (1024 * 1024) {
|
} else if num_bytes < (1024 * 1024) {
|
||||||
format!("TX: {:4}KB", num_bytes / 1024).to_string()
|
format!("TX: {:5.*}KB/s", 1, num_bytes as f64 / 1024.0).to_string()
|
||||||
} else if num_bytes < (1024 * 1024 * 1024) {
|
} else if num_bytes < (1024 * 1024 * 1024) {
|
||||||
format!("TX: {:4}MB", num_bytes / 1024 / 1024).to_string()
|
format!("TX: {:5.*}MB/s", 1, num_bytes as f64 / 1024.0 / 1024.0).to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("TX: {:4}GB", num_bytes / 1024 / 1024 / 1024).to_string()
|
format!("TX: {:5.*}GB/s", 1, num_bytes as f64 / 1024.0 / 1024.0 / 1024.0).to_string()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"0B".to_string()
|
"0B.0/s".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
ConvertedNetworkData {
|
ConvertedNetworkData {
|
||||||
|
|
Loading…
Reference in New Issue