refactor(irtt-client): move cadence into managed runner

This commit is contained in:
Nils Andreas Svee committed 2026-10-02 00:31:17 +07:00
1 parent f350c82dae
commit f2fce2f330
31 files changed
+716 -4106

No files matched your search

+3 -3
View File
@@ -34,11 +34,11 @@ pub fn sent(seq: u32, sent_at: ClientTimestamp) -> ClientEvent {
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),
timer_error: Duration::from_micros(2),
timer_error: Some(Duration::from_micros(2)),
}
}
@@ -117,7 +117,7 @@ pub fn sent_with_timings(
unreachable!();
};
*send_call = Duration::from_micros(send_call_us);
*timer_error = Duration::from_micros(timer_error_us);
*timer_error = Some(Duration::from_micros(timer_error_us));
event
}
@@ -129,11 +129,11 @@ fn build_event(op: &Op, seq: u32, clock_ms: u64, base: Instant) -> ClientEvent {
Op::Send => ClientEvent::EchoSent {
seq,
remote: ADDR.parse().unwrap(),
scheduled_at: ts_at(base, clock_ms).mono,
scheduled_at: Some(ts_at(base, clock_ms).mono),
sent_at: ts_at(base, clock_ms),
bytes: 32,
send_call: Duration::from_micros(10),
timer_error: Duration::from_micros(2),
timer_error: Some(Duration::from_micros(2)),
},
Op::Reply { raw_ms } => {
let sent_at = ts_at(base, clock_ms.saturating_sub(u64::from(raw_ms)));
+21
View File
@@ -13,6 +13,27 @@ use irtt_stats::{
EventStatsUpdate, IpdvPairUpdate, LateReplyMode, SampleMode, StatsCollector, StatsConfig,
};
#[test]
fn caller_paced_sends_do_not_fabricate_timer_error_samples() {
let mut collector = StatsCollector::new(StatsConfig::finite());
let mut event = sent(0, ts(0));
let ClientEvent::EchoSent {
scheduled_at,
timer_error,
..
} = &mut event
else {
unreachable!()
};
*scheduled_at = None;
*timer_error = None;
collector.process(&event);
let snapshot = collector.snapshot();
assert_eq!(snapshot.packets.packets_sent, 1);
assert_eq!(snapshot.send_call.count, 1);
assert_eq!(snapshot.timer_error.count, 0);
}
#[test]
fn exact_mode_reports_a_timer_error_median() {
let mut collector = StatsCollector::new(StatsConfig::finite());