Parallel agent work: bandwidth fix, CPU platforms, packaging
All checks were successful
CI / test (push) Successful in 2m8s
All checks were successful
CI / test (push) Successful in 2m8s
5 agents ran in parallel: 1. Fix bandwidth limit (-b): new advance_next_send() prevents drift bursts by resetting when >2x interval behind (bandwidth.rs, client.rs, server.rs) 2. Windows + FreeBSD CPU support (cpu.rs): - Windows: GetSystemTimes via raw FFI - FreeBSD: sysctl kern.cp_time parsing 3. Ubuntu .deb packaging (deploy/deb/): - build-deb.sh: creates .deb from pre-built binary - test-deb.sh: tests in Ubuntu Docker container 4. Fedora/RHEL RPM packaging (deploy/rpm/): - btest-rs.spec: full RPM spec with systemd unit - build-rpm.sh + test-rpm.sh 5. Alpine Linux apk packaging (deploy/alpine/): - APKBUILD with OpenRC init script - test-alpine.sh 58 tests pass, zero warnings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,34 @@ pub fn calc_send_interval(tx_speed_bps: u32, tx_size: u16) -> Option<Duration> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Advance `next_send` by one interval and clamp drift.
|
||||
///
|
||||
/// When the sender falls behind (e.g., the write blocked longer than the
|
||||
/// inter-packet interval), `next_send` accumulates a debt. Once the path
|
||||
/// clears, the loop would fire packets with *no* delay until the debt is
|
||||
/// repaid, producing a burst that overshoots the target rate.
|
||||
///
|
||||
/// This helper resets `next_send` to `now` whenever it has drifted more
|
||||
/// than 2x the interval behind the current wall-clock time, bounding the
|
||||
/// maximum burst to at most one extra interval's worth of packets.
|
||||
pub fn advance_next_send(
|
||||
next_send: &mut std::time::Instant,
|
||||
iv: Duration,
|
||||
now: std::time::Instant,
|
||||
) -> Option<Duration> {
|
||||
*next_send += iv;
|
||||
// If we have fallen more than 2x the interval behind, reset to now
|
||||
// to prevent a compensating burst.
|
||||
if *next_send + iv < now {
|
||||
*next_send = now;
|
||||
}
|
||||
if *next_send > now {
|
||||
Some(*next_send - now)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Format a bandwidth value in human-readable form.
|
||||
pub fn format_bandwidth(bits_per_sec: f64) -> String {
|
||||
if bits_per_sec >= 1_000_000_000.0 {
|
||||
|
||||
Reference in New Issue
Block a user