dm secu
This commit is contained in:
parent
b4499d3702
commit
1a832d30b9
1 changed files with 5 additions and 4 deletions
|
@ -40,6 +40,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
total_ipv4 += 1;
|
||||
}
|
||||
}
|
||||
|
||||
println!("Count: {total: >20}");
|
||||
println!("Count IPv4: {total_ipv4: >20}");
|
||||
let non_ipv4 = total - total_ipv4;
|
||||
|
@ -49,7 +50,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
let last_timestamp = last_timestamp.map(tv_to_sec).unwrap_or_default();
|
||||
println!("Last timestamp: {last_timestamp: >20.2}");
|
||||
let avg_packet = (last_timestamp - first_timestamp) / total as f64;
|
||||
println!("Avg packet rate: {avg_packet: >20.2}");
|
||||
println!("Avg packet rate: {avg_packet: >20.4}");
|
||||
println!("Errors: {errs: >20}");
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ enum Cmd {
|
|||
}
|
||||
|
||||
fn tv_to_sec(tv: libc::timeval) -> f64 {
|
||||
let usec_per_sec = 1_000_000;
|
||||
let usecs = tv.tv_usec + (tv.tv_sec * usec_per_sec);
|
||||
usecs as f64 / usec_per_sec as f64
|
||||
let usec_per_sec = 1_000_000.;
|
||||
let usecs = tv.tv_usec as f64 + (tv.tv_sec as f64 * usec_per_sec);
|
||||
usecs / usec_per_sec
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue