Skip to content

Commit fcb8da9

Browse files
author
Neil Tallim
committed
Very important bugfix: UDP traffic was effectively not being partitioned according to the send-interval target, resulting in all-at-once delivery of data every second.
1 parent 589f291 commit fcb8da9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "rperf"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "validates network throughput capacity and reliability"
55
authors = ["Neil Tallim <neiltallim@3d-p.com>"]
6-
edition = "2018"
6+
edition = "2021"
77
repository = "https://github.com/opensource-3d-p/rperf"
88
license = "GPLv3"
99
keywords = ["network", "performance", "tcp", "udp"]

src/stream/udp.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ pub mod sender {
506506
impl super::TestStream for UdpSender {
507507
fn run_interval(&mut self) -> Option<super::BoxResult<Box<dyn super::IntervalResult + Sync + Send>>> {
508508
let interval_duration = Duration::from_secs_f32(self.send_interval);
509+
let mut interval_iteration = 0;
509510
let bytes_to_send = ((self.test_definition.bandwidth as f32) * super::INTERVAL.as_secs_f32()) as i64;
510511
let mut bytes_to_send_remaining = bytes_to_send;
511512
let bytes_to_send_per_interval_slice = ((bytes_to_send as f32) * self.send_interval) as i64;
@@ -563,10 +564,12 @@ pub mod sender {
563564
sleep(super::INTERVAL - elapsed_time);
564565
}
565566
} else if bytes_to_send_per_interval_slice_remaining <= 0 { // interval subsection exhausted
567+
interval_iteration += 1;
566568
bytes_to_send_per_interval_slice_remaining = bytes_to_send_per_interval_slice;
567569
let elapsed_time = cycle_start.elapsed();
568-
if interval_duration > elapsed_time {
569-
sleep(interval_duration - elapsed_time);
570+
let interval_endtime = interval_iteration * interval_duration;
571+
if interval_endtime > elapsed_time {
572+
sleep(interval_endtime - elapsed_time);
570573
}
571574
}
572575
self.remaining_duration -= packet_start.elapsed().as_secs_f32();

0 commit comments

Comments
 (0)