refactor(irtt-client): move cadence into managed runner
This commit is contained in:
31 files changed
+716
-4106
No files matched your search
@@ -100,12 +100,14 @@ impl CoreStats {
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_sent(&mut self, bytes: usize, send_call_ns: i128, timer_error_ns: i128) {
|
||||
fn apply_sent(&mut self, bytes: usize, send_call_ns: i128, timer_error_ns: Option<i128>) {
|
||||
self.events.sent_events += 1;
|
||||
self.packets.packets_sent += 1;
|
||||
self.packets.bytes_sent = self.packets.bytes_sent.saturating_add(bytes as u64);
|
||||
self.send_call.push_ns(send_call_ns);
|
||||
self.timer_error.push_ns(timer_error_ns);
|
||||
if let Some(error) = timer_error_ns {
|
||||
self.timer_error.push_ns(error);
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_unique_reply(&mut self, is_late: bool, sample: ReplySample) -> EventStatsUpdate {
|
||||
|
||||
@@ -89,11 +89,11 @@ impl StatsConfig {
|
||||
/// # ClientEvent::EchoSent {
|
||||
/// # seq,
|
||||
/// # remote: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 2112),
|
||||
/// # scheduled_at: sent_at.mono,
|
||||
/// # scheduled_at: Some(sent_at.mono),
|
||||
/// # sent_at,
|
||||
/// # bytes: 64,
|
||||
/// # send_call: Duration::from_micros(send_call_us),
|
||||
/// # timer_error: Duration::from_micros(2),
|
||||
/// # timer_error: Some(Duration::from_micros(2)),
|
||||
/// # }
|
||||
/// # }
|
||||
/// #
|
||||
@@ -142,11 +142,11 @@ impl StatsConfig {
|
||||
/// # ClientEvent::EchoSent {
|
||||
/// # seq,
|
||||
/// # remote: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 2112),
|
||||
/// # scheduled_at: sent_at.mono,
|
||||
/// # scheduled_at: Some(sent_at.mono),
|
||||
/// # sent_at,
|
||||
/// # bytes: 64,
|
||||
/// # send_call: Duration::from_micros(send_call_us),
|
||||
/// # timer_error: Duration::from_micros(2),
|
||||
/// # timer_error: Some(Duration::from_micros(2)),
|
||||
/// # }
|
||||
/// # }
|
||||
/// #
|
||||
@@ -418,11 +418,11 @@ impl StatsCollector {
|
||||
/// # ClientEvent::EchoSent {
|
||||
/// # seq,
|
||||
/// # remote: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 2112),
|
||||
/// # scheduled_at: sent_at.mono,
|
||||
/// # scheduled_at: Some(sent_at.mono),
|
||||
/// # sent_at,
|
||||
/// # bytes: 64,
|
||||
/// # send_call: Duration::from_micros(send_call_us),
|
||||
/// # timer_error: Duration::from_micros(2),
|
||||
/// # timer_error: Some(Duration::from_micros(2)),
|
||||
/// # }
|
||||
/// # }
|
||||
/// #
|
||||
@@ -475,11 +475,11 @@ impl StatsCollector {
|
||||
/// # ClientEvent::EchoSent {
|
||||
/// # seq,
|
||||
/// # remote: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 2112),
|
||||
/// # scheduled_at: sent_at.mono,
|
||||
/// # scheduled_at: Some(sent_at.mono),
|
||||
/// # sent_at,
|
||||
/// # bytes: 64,
|
||||
/// # send_call: Duration::from_micros(send_call_us),
|
||||
/// # timer_error: Duration::from_micros(2),
|
||||
/// # timer_error: Some(Duration::from_micros(2)),
|
||||
/// # }
|
||||
/// # }
|
||||
/// #
|
||||
|
||||
@@ -13,7 +13,7 @@ pub(crate) enum StatsEvent {
|
||||
at: Instant,
|
||||
bytes: usize,
|
||||
send_call_ns: i128,
|
||||
timer_error_ns: i128,
|
||||
timer_error_ns: Option<i128>,
|
||||
},
|
||||
UniqueReply {
|
||||
at: Instant,
|
||||
@@ -48,7 +48,7 @@ pub(crate) fn normalize_event(event: &ClientEvent) -> Option<StatsEvent> {
|
||||
at: sent_at.mono,
|
||||
bytes: *bytes,
|
||||
send_call_ns: duration_ns_i128(*send_call),
|
||||
timer_error_ns: duration_ns_i128(*timer_error),
|
||||
timer_error_ns: timer_error.map(duration_ns_i128),
|
||||
}),
|
||||
ClientEvent::EchoReply {
|
||||
seq,
|
||||
|
||||
@@ -146,11 +146,11 @@ mod tests {
|
||||
ClientEvent::EchoSent {
|
||||
seq,
|
||||
remote: "127.0.0.1:2112".parse().unwrap(),
|
||||
scheduled_at: sent_at.mono,
|
||||
scheduled_at: Some(sent_at.mono),
|
||||
sent_at,
|
||||
bytes: 32,
|
||||
send_call: Duration::from_micros(10 + u64::from(seq)),
|
||||
timer_error: Duration::from_micros(2 + u64::from(seq)),
|
||||
timer_error: Some(Duration::from_micros(2 + u64::from(seq))),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user