aquatic_udp: stop counting readable events for statistics

It is not very informative and might be expensive
This commit is contained in:
Joakim Frostegård 2021-10-18 11:15:59 +02:00
parent 90d60108c1
commit 9aa783fbb1
3 changed files with 2 additions and 18 deletions

View file

@ -174,7 +174,6 @@ impl TorrentMaps {
pub struct Statistics {
pub requests_received: AtomicUsize,
pub responses_sent: AtomicUsize,
pub readable_events: AtomicUsize,
pub bytes_received: AtomicUsize,
pub bytes_sent: AtomicUsize,
}

View file

@ -93,11 +93,6 @@ pub fn run_socket_worker(
&request_sender,
&mut local_responses,
);
state
.statistics
.readable_events
.fetch_add(1, Ordering::SeqCst);
}
}

View file

@ -41,19 +41,9 @@ pub fn gather_and_print_statistics(state: &State, config: &Config) {
let bytes_received_per_second: f64 = bytes_received / interval as f64;
let bytes_sent_per_second: f64 = bytes_sent / interval as f64;
let readable_events: f64 = state
.statistics
.readable_events
.fetch_and(0, Ordering::SeqCst) as f64;
let requests_per_readable_event = if readable_events == 0.0 {
0.0
} else {
requests_received / readable_events
};
println!(
"stats: {:.2} requests/second, {:.2} responses/second, {:.2} requests/readable event",
requests_per_second, responses_per_second, requests_per_readable_event
"stats: {:.2} requests/second, {:.2} responses/second",
requests_per_second, responses_per_second
);
println!(