mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
udp: avoid Ordering::SeqCst for atomic operations
This commit is contained in:
parent
2c336793b1
commit
a1243c59d6
3 changed files with 15 additions and 13 deletions
|
|
@ -9,16 +9,16 @@ pub fn gather_and_print_statistics(state: &State, config: &Config) {
|
|||
let requests_received: f64 = state
|
||||
.statistics
|
||||
.requests_received
|
||||
.fetch_and(0, Ordering::SeqCst) as f64;
|
||||
.fetch_and(0, Ordering::AcqRel) as f64;
|
||||
let responses_sent: f64 = state
|
||||
.statistics
|
||||
.responses_sent
|
||||
.fetch_and(0, Ordering::SeqCst) as f64;
|
||||
.fetch_and(0, Ordering::AcqRel) as f64;
|
||||
let bytes_received: f64 = state
|
||||
.statistics
|
||||
.bytes_received
|
||||
.fetch_and(0, Ordering::SeqCst) as f64;
|
||||
let bytes_sent: f64 = state.statistics.bytes_sent.fetch_and(0, Ordering::SeqCst) as f64;
|
||||
.fetch_and(0, Ordering::AcqRel) as f64;
|
||||
let bytes_sent: f64 = state.statistics.bytes_sent.fetch_and(0, Ordering::AcqRel) as f64;
|
||||
|
||||
let requests_per_second = requests_received / interval as f64;
|
||||
let responses_per_second: f64 = responses_sent / interval as f64;
|
||||
|
|
@ -58,5 +58,5 @@ pub fn gather_and_print_statistics(state: &State, config: &Config) {
|
|||
}
|
||||
|
||||
fn sum_atomic_usizes(values: &[AtomicUsize]) -> usize {
|
||||
values.iter().map(|n| n.load(Ordering::SeqCst)).sum()
|
||||
values.iter().map(|n| n.load(Ordering::Acquire)).sum()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue