Skip to content

Commit 2373aac

Browse files
committed
Added loss percentage to UDP results; "streams" now more consistent in textual representation of results
1 parent 8e4d17b commit 2373aac

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rperf"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "validates network throughput capacity and reliability"
55
authors = ["Neil Tallim <neiltallim@3d-p.com>"]
66
edition = "2018"

src/protocol/results.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,10 @@ impl TestResults for TcpTestResults {
846846
};
847847

848848
let mut output = format!("==========\n\
849-
TCP send result over {:.2}s | {} streams\n\
849+
TCP send result over {:.2}s | streams: {}\n\
850850
bytes: {} | per second: {:.3} | {}\n\
851851
==========\n\
852-
TCP receive result over {:.2}s | {} streams\n\
852+
TCP receive result over {:.2}s | streams: {}\n\
853853
bytes: {} | per second: {:.3} | {}",
854854
duration_send, self.stream_results.len(),
855855
bytes_sent, send_bytes_per_second, send_throughput,
@@ -1109,21 +1109,22 @@ impl TestResults for UdpTestResults {
11091109
false => format!("megabytes/second: {:.3}", receive_bytes_per_second / 1_000_000.00),
11101110
};
11111111

1112+
let packets_lost = packets_sent - packets_received;
11121113
let mut output = format!("==========\n\
1113-
UDP send result over {:.2}s | {} streams\n\
1114+
UDP send result over {:.2}s | streams: {}\n\
11141115
bytes: {} | per second: {:.3} | {}\n\
11151116
packets: {} per second: {:.3}\n\
11161117
==========\n\
1117-
UDP receive result over {:.2}s | {} streams\n\
1118+
UDP receive result over {:.2}s | streams: {}\n\
11181119
bytes: {} | per second: {:.3} | {}\n\
1119-
packets: {} | lost: {} | out-of-order: {} | duplicate: {} | per second: {:.3}",
1120+
packets: {} | lost: {} ({:.1}%) | out-of-order: {} | duplicate: {} | per second: {:.3}",
11201121
duration_send, self.stream_results.len(),
11211122
bytes_sent, send_bytes_per_second, send_throughput,
11221123
packets_sent, packets_sent as f64 / send_duration_divisor,
11231124

11241125
duration_receive, self.stream_results.len(),
11251126
bytes_received, receive_bytes_per_second, receive_throughput,
1126-
packets_received, packets_sent - packets_received, packets_out_of_order, packets_duplicated, packets_received as f64 / receive_duration_divisor,
1127+
packets_received, packets_lost, (packets_lost as f64 / packets_sent as f64) * 100.0, packets_out_of_order, packets_duplicated, packets_received as f64 / receive_duration_divisor,
11271128
);
11281129
if jitter_calculated {
11291130
output.push_str(&format!("\njitter: {:.6}s over {} consecutive packets", jitter_weight / (unbroken_sequence_count as f64), unbroken_sequence_count));

0 commit comments

Comments
 (0)