@@ -795,6 +795,8 @@ impl TestResults for TcpTestResults {
795
795
796
796
fn to_string ( & self , bit : bool , omit_seconds : usize ) -> String {
797
797
let stream_count = self . stream_results . len ( ) ;
798
+ let mut stream_send_durations = vec ! [ 0.0 ; stream_count] ;
799
+ let mut stream_receive_durations = vec ! [ 0.0 ; stream_count] ;
798
800
799
801
let mut duration_send: f64 = 0.0 ;
800
802
let mut bytes_sent: u64 = 0 ;
@@ -803,13 +805,15 @@ impl TestResults for TcpTestResults {
803
805
let mut bytes_received: u64 = 0 ;
804
806
805
807
806
- for stream in self . stream_results . values ( ) {
808
+ for ( stream_idx , stream) in self . stream_results . values ( ) . enumerate ( ) {
807
809
for ( i, sr) in stream. send_results . iter ( ) . enumerate ( ) {
808
810
if i < omit_seconds {
809
811
continue ;
810
812
}
811
813
812
814
duration_send += sr. duration as f64 ;
815
+ stream_send_durations[ stream_idx] += sr. duration as f64 ;
816
+
813
817
bytes_sent += sr. bytes_sent ;
814
818
}
815
819
@@ -819,9 +823,13 @@ impl TestResults for TcpTestResults {
819
823
}
820
824
821
825
duration_receive += rr. duration as f64 ;
826
+ stream_receive_durations[ stream_idx] += rr. duration as f64 ;
827
+
822
828
bytes_received += rr. bytes_received ;
823
829
}
824
830
}
831
+ stream_send_durations. sort_by ( |a, b| a. partial_cmp ( b) . unwrap ( ) ) ;
832
+ stream_receive_durations. sort_by ( |a, b| a. partial_cmp ( b) . unwrap ( ) ) ;
825
833
826
834
let send_duration_divisor;
827
835
if duration_send == 0.0 { //avoid zerodiv, which can happen if all streams fail
@@ -863,11 +871,11 @@ impl TestResults for TcpTestResults {
863
871
TCP receive result over {:.2}s | streams: {}\n \
864
872
stream-average bytes per second: {:.3} | {}\n \
865
873
total bytes: {} | per second: {:.3} | {}",
866
- duration_send , stream_count,
874
+ stream_send_durations [ stream_send_durations . len ( ) - 1 ] , stream_count,
867
875
send_bytes_per_second, send_throughput,
868
876
bytes_sent, send_bytes_per_second * stream_count as f64 , total_send_throughput,
869
877
870
- duration_receive , stream_count,
878
+ stream_receive_durations [ stream_receive_durations . len ( ) - 1 ] , stream_count,
871
879
receive_bytes_per_second, receive_throughput,
872
880
bytes_received, receive_bytes_per_second * stream_count as f64 , total_receive_throughput,
873
881
) ;
@@ -1049,6 +1057,8 @@ impl TestResults for UdpTestResults {
1049
1057
1050
1058
fn to_string ( & self , bit : bool , omit_seconds : usize ) -> String {
1051
1059
let stream_count = self . stream_results . len ( ) ;
1060
+ let mut stream_send_durations = vec ! [ 0.0 ; stream_count] ;
1061
+ let mut stream_receive_durations = vec ! [ 0.0 ; stream_count] ;
1052
1062
1053
1063
let mut duration_send: f64 = 0.0 ;
1054
1064
@@ -1068,13 +1078,14 @@ impl TestResults for UdpTestResults {
1068
1078
let mut jitter_weight: f64 = 0.0 ;
1069
1079
1070
1080
1071
- for stream in self . stream_results . values ( ) {
1081
+ for ( stream_idx , stream) in self . stream_results . values ( ) . enumerate ( ) {
1072
1082
for ( i, sr) in stream. send_results . iter ( ) . enumerate ( ) {
1073
1083
if i < omit_seconds {
1074
1084
continue ;
1075
1085
}
1076
1086
1077
1087
duration_send += sr. duration as f64 ;
1088
+ stream_send_durations[ stream_idx] += sr. duration as f64 ;
1078
1089
1079
1090
bytes_sent += sr. bytes_sent ;
1080
1091
packets_sent += sr. packets_sent ;
@@ -1086,6 +1097,7 @@ impl TestResults for UdpTestResults {
1086
1097
}
1087
1098
1088
1099
duration_receive += rr. duration as f64 ;
1100
+ stream_receive_durations[ stream_idx] += rr. duration as f64 ;
1089
1101
1090
1102
bytes_received += rr. bytes_received ;
1091
1103
packets_received += rr. packets_received ;
@@ -1100,6 +1112,8 @@ impl TestResults for UdpTestResults {
1100
1112
}
1101
1113
}
1102
1114
}
1115
+ stream_send_durations. sort_by ( |a, b| a. partial_cmp ( b) . unwrap ( ) ) ;
1116
+ stream_receive_durations. sort_by ( |a, b| a. partial_cmp ( b) . unwrap ( ) ) ;
1103
1117
1104
1118
let send_duration_divisor;
1105
1119
if duration_send == 0.0 { //avoid zerodiv, which can happen if all streams fail
@@ -1150,12 +1164,12 @@ impl TestResults for UdpTestResults {
1150
1164
stream-average bytes per second: {:.3} | {}\n \
1151
1165
total bytes: {} | per second: {:.3} | {}\n \
1152
1166
packets: {} | lost: {} ({:.1}%) | out-of-order: {} | duplicate: {} | per second: {:.3}",
1153
- duration_send , stream_count,
1167
+ stream_send_durations [ stream_send_durations . len ( ) - 1 ] , stream_count,
1154
1168
send_bytes_per_second, send_throughput,
1155
1169
bytes_sent, send_bytes_per_second * stream_count as f64 , total_send_throughput,
1156
1170
packets_sent, ( packets_sent as f64 / send_duration_divisor) * stream_count as f64 ,
1157
1171
1158
- duration_receive , stream_count,
1172
+ stream_receive_durations [ stream_receive_durations . len ( ) - 1 ] , stream_count,
1159
1173
receive_bytes_per_second, receive_throughput,
1160
1174
bytes_received, receive_bytes_per_second * stream_count as f64 , total_receive_throughput,
1161
1175
packets_received, packets_lost, ( packets_lost as f64 / packets_sent_divisor) * 100.0 , packets_out_of_order, packets_duplicated, ( packets_received as f64 / receive_duration_divisor) * stream_count as f64 ,
0 commit comments