changed net value calculation
This commit is contained in:
@@ -375,17 +375,14 @@ impl MetricsCollector {
|
|||||||
self.network_state.last_update = Instant::now();
|
self.network_state.last_update = Instant::now();
|
||||||
|
|
||||||
// Calculate the difference since the last call
|
// Calculate the difference since the last call
|
||||||
let net_in = if self.network_state.prev_rx > 0 && current_rx >= self.network_state.prev_rx {
|
let net_in = if current_rx >= self.network_state.prev_rx {
|
||||||
((current_rx - self.network_state.prev_rx) as f64 * 8.0) / elapsed_secs
|
((current_rx - self.network_state.prev_rx) as f64 * 8.0) / elapsed_secs
|
||||||
// bits per second
|
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
let net_out = if self.network_state.prev_tx > 0 && current_tx >= self.network_state.prev_tx
|
let net_out = if current_tx >= self.network_state.prev_tx {
|
||||||
{
|
|
||||||
((current_tx - self.network_state.prev_tx) as f64 * 8.0) / elapsed_secs
|
((current_tx - self.network_state.prev_tx) as f64 * 8.0) / elapsed_secs
|
||||||
// bits per second
|
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user