Flow 1.0.1
Flow project: Full implementation reference.
info.cpp
Go to the documentation of this file.
1/* Flow
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
21#include <boost/array.hpp>
22
23namespace flow::net_flow
24{
25
26// Peer_socket_receive_stats implementations.
27
29 m_init_time(Fine_clock::now()),
30 m_total_data_size(0),
31 m_total_data_count(0),
32 m_good_data_size(0),
33 m_good_data_count(0),
34 m_good_data_accepted_size(0),
35 m_good_data_accepted_count(0),
36 m_good_data_delivered_size(0),
37 m_good_data_delivered_count(0),
38 m_good_data_first_qd_size(0),
39 m_good_data_first_qd_count(0),
40 m_good_data_dropped_buf_overflow_size(0),
41 m_good_data_dropped_buf_overflow_count(0),
42 m_good_data_dropped_reassembly_q_overflow_size(0),
43 m_good_data_dropped_reassembly_q_overflow_count(0),
44 m_error_data_size(0),
45 m_error_data_count(0),
46 m_late_or_dupe_data_size(0),
47 m_late_or_dupe_data_count(0),
48 m_presumed_dropped_data_size(0),
49 m_total_to_send_acks_data_size(0),
50 m_total_to_send_acks_count(0),
51 m_good_to_send_acks_data_size(0),
52 m_good_to_send_acks_count(0),
53 m_late_or_dupe_to_send_acks_data_size(0),
54 m_late_or_dupe_to_send_acks_count(0),
55 m_current_pending_acks_count(0),
56 m_delayed_acks_count(0),
57 m_sent_individual_acks_count(0),
58 m_sent_low_lvl_acks_count(0),
59 m_rcv_wnd_recovery_count(0),
60 m_rcv_wnd_recovery_success_count(0),
61 m_rcv_wnd_recovery_timeout_count(0),
62 m_sent_low_lvl_rcv_wnd_only_acks_count(0),
63 m_max_buf_data_size(0)
64{
65 // Nothing.
66}
67
68void Peer_socket_receive_stats::output(std::ostream* os) const
69{
70 using boost::chrono::duration;
71 using boost::chrono::duration_cast;
72 using boost::chrono::seconds;
73 using Float_seconds = duration<double, seconds::period>;
74
75 // Use a floating point representation for socket lifetime so that it can be printed in floating-point seconds.
76 const Float_seconds lifetime = duration_cast<Float_seconds>(Fine_clock::now() - m_init_time);
77
78 /* Compute the drop rate based on the # of bytes in unreceived packets that had been unreceived
79 * for so long we consider them to be forever gone; this is divided by that plus the # of data
80 * bytes that were received normally. The latter does include any data we dropped due to
81 * insufficient buffer space, as we're trying to measure the network drop rate which is, loosely,
82 * a function of the network and the congestion control algorithm's behavior
83 * on the sender side. */
84 const double den = double(m_presumed_dropped_data_size + m_good_data_size);
85 const double drop_pct
86 = (den == double(0))
87 ? 0
88 : (double(m_presumed_dropped_data_size) * double(100) / den);
89
90 *os
91 << "[rcv] format of sizes: [bytes|packets]\n"
92 "[rcv] socket_lifetime [" << lifetime << "]\n"
93 "[rcv] lifetime_goodput_delivered ["
94 << util::to_mbit_per_sec<Float_seconds>(double(m_good_data_delivered_size) / lifetime.count()) << " Mbit/s]\n"
95 "[rcv] total_data [" << m_total_data_size << '|' << m_total_data_count << "]\n"
96
97 "[rcv] good [" << m_good_data_size << '|' << m_good_data_count << "]\n"
98
99 "[rcv] accepted [" << m_good_data_accepted_size << '|' << m_good_data_accepted_count << "]\n"
100
101 "[rcv] delivered [" << m_good_data_delivered_size << '|' << m_good_data_delivered_count << "]\n"
102
103 "[rcv] immediately [" << (m_good_data_delivered_size - m_good_data_first_qd_size)
105 "first_queued [" << m_good_data_first_qd_size << '|' << m_good_data_first_qd_count << "]\n"
106
109
110
111 "[rcv] dropped_buf_overflow [" << m_good_data_dropped_buf_overflow_size
113
114 "[rcv] dropped_reassembly_q_overflow [" << m_good_data_dropped_reassembly_q_overflow_size
116
117 "[rcv] late_or_dupe [" << m_late_or_dupe_data_size << '|' << m_late_or_dupe_data_count << "]\n"
118
119 "[rcv] error [" << m_error_data_size << '|' << m_error_data_count << "]\n"
120
121 "[rcv] presumed_dropped [" << m_presumed_dropped_data_size << " bytes]\n"
122
123 "[rcv] observed_net_drop_rate = presumed_dropped / (presumed_dropped + good) = [" << drop_pct << "%]\n"
124
125 "[rcv] total_to_send_acks_data [" << m_total_to_send_acks_data_size
126 << '|' << m_total_to_send_acks_count << "]\n"
127
128 "[rcv] good [" << m_good_to_send_acks_data_size
129 << '|' << m_good_to_send_acks_count << "]\n"
130
131 "[rcv] late_or_dupe [" << m_late_or_dupe_to_send_acks_data_size
132 << '|' << m_late_or_dupe_to_send_acks_count << "]\n"
133
134 "[rcv] delayed_acks [" << m_delayed_acks_count << " individual acknowledgments]\n"
135
136 "[rcv] current_pending_acks [" << m_current_pending_acks_count << " individual acknowledgments]\n"
137
138 "[rcv] sent_individual_acks [" << m_sent_individual_acks_count << " individual acknowledgments]\n"
139
140 "[rcv] sent_low_lvl_acks [" << m_sent_low_lvl_acks_count << " packets]\n"
141
142 "[rcv] rcv_wnd_update_only_acks [" << m_sent_low_lvl_rcv_wnd_only_acks_count << " packets]\n"
143
144 "[rcv] rcv_wnd_recovery_events [" << m_rcv_wnd_recovery_count << "]\n"
145
146 "[rcv] successful [" << m_rcv_wnd_recovery_success_count << "] "
147 "timed_out [" << m_rcv_wnd_recovery_timeout_count << "] "
148 "in_progress ["
150
151 "[rcv] max_buf_data_size [" << m_max_buf_data_size << " bytes]\n"
152 << "[rcv] low_lvl_packets (AFTER simulation): ";
153
155} // Peer_socket_receive_stats::output()
156
157std::ostream& operator<<(std::ostream& os, const Peer_socket_receive_stats& stats)
158{
159 stats.output(&os);
160 return os;
161}
162
163// Peer_socket_send_stats implementations.
164
166 m_init_time(Fine_clock::now()),
167 m_sent_data_size(0),
168 m_sent_data_count(0),
169 m_sent_rexmitted_data_size(0),
170 m_sent_rexmitted_data_count(0),
171 m_received_low_lvl_ack_count(0),
172 m_received_low_lvl_rcv_wnd_only_ack_count(0),
173 m_received_ack_count(0),
174 m_rcv_wnd_exhausted(false),
175 m_remote_rcv_wnd_exhaustion_events(0),
176 m_remote_rcv_wnd_recovery_events(0),
177 m_good_ack_data_size(0),
178 m_good_ack_count(0),
179 m_late_or_dupe_ack_count(0),
180 m_error_acks_data_count(0),
181 m_dropped_data_size(0),
182 m_dropped_data_count(0),
183 m_loss_events(0),
184 m_idle_timeouts(0),
185 m_drop_timeouts(0),
186 m_max_buf_data_size(0)
187{
188 // Nothing.
189}
190
191void Peer_socket_send_stats::output(std::ostream* os) const
192{
193 using boost::chrono::duration;
194 using boost::chrono::duration_cast;
195 using boost::chrono::seconds;
196 using std::map;
197 using std::type_index;
198
199 using Float_seconds = duration<double, seconds::period>;
200
201 // Use a floating point representation for socket lifetime so that it can be printed in floating-point seconds.
202 const Float_seconds lifetime = duration_cast<Float_seconds>(Fine_clock::now() - m_init_time);
203
204 /* Compute the loss rate based based on Dropped vs. Acknowledged bytes. In-flight bytes are
205 * considered as having unknown status for now and are not included. If a Dropped packet is later
206 * acknowledged, it has still already been Dropped, so it will still be only counted as Dropped.
207 * However there is a separate statistic for such late acknowledgments. */
208 double den = double(m_dropped_data_size + m_good_ack_data_size);
209 const double drop_pct
210 = (den == double(0))
211 ? 0
212 : (double(m_dropped_data_size) * double(100) / den);
213 // Compute % of retransmitted vs. all sent DATA packets.
214 den = double(m_sent_data_size);
215 const double rexmit_pct
216 = (den == double(0))
217 ? 0
218 : (double(m_sent_rexmitted_data_size) * double(100) / den);
219
220 *os
221 << "[snd] format of sizes: [bytes|packets]\n"
222
223 "[snd] socket_lifetime [" << lifetime << "]\n"
224
225 "[snd] lifetime_data_sent "
226 "[" << util::to_mbit_per_sec<Float_seconds>(double(m_sent_data_size) / lifetime.count()) << " Mbit/s]\n"
227
228 "[snd] sent_data [" << m_sent_data_size << '|' << m_sent_data_count << "]\n"
229
230 "[snd] acked [" << m_good_ack_data_size << '|' << m_good_ack_count << "] "
231 "dropped [" << m_dropped_data_size << '|' << m_dropped_data_count << "]\n"
232
233 "[snd] observed_net_drop_rate = dropped / (acked + dropped) = [" << drop_pct << "%]\n"
234
237
238 "[snd] original [" << (m_sent_data_size - m_sent_rexmitted_data_size)
240 "rexmitted [" << m_sent_rexmitted_data_size << '|' << m_sent_rexmitted_data_count << "]\n"
241
242 "[snd] rexmit_rate = rexmitted / sent = [" << rexmit_pct << "%]\n"
243
244 "[snd] received_low_lvl_acks [" << m_received_low_lvl_ack_count << " packets]\n"
245
246 "[snd] rcv_wnd_update_only_acks [" << m_received_low_lvl_rcv_wnd_only_ack_count << " packets]\n"
247
248 "[snd] received_acks [" << m_received_ack_count << " individual acknowledgments]\n"
249
250 "[snd] good [" << m_good_ack_count << " individual acknowledgments]\n"
251
252 "[snd] late_or_dupe [" << m_late_or_dupe_ack_count << " individual acknowledgments]\n"
253
254 "[snd] error [" << m_error_acks_data_count << " individual acknowledgments]\n"
255
256 "[snd] loss_events [" << m_loss_events << "]\n"
257
258 "[snd] drop_timeouts [" << m_drop_timeouts << "]\n"
259
260 "[snd] idle_timeouts [" << m_idle_timeouts << "]\n"
261
262 "[snd] remote_rcv_wnd_exhaustion_events [" << m_remote_rcv_wnd_exhaustion_events << "]\n"
263
264 "[snd] recovered [" << m_remote_rcv_wnd_recovery_events << "]\n"
265
266 "[snd] max_buf_data_size [" << m_max_buf_data_size << " bytes]\n"
267 "[snd] low_lvl_packet_send_requested ";
268
270 static_cast<const map<type_index, uint64_t>*>(0));
271
272 *os
273 << "]\n" <<
274 "[snd] send_called ";
275
278
279 *os
280 << "\n" <<
281 "[snd] send_completed ";
282
285}
286
287std::ostream& operator<<(std::ostream& os, const Peer_socket_send_stats& stats)
288{
289 stats.output(&os);
290 return os;
291}
292
293// Peer_socket_info implementations.
294
296 m_low_lvl_max_buf_size(0),
297 m_is_active_connect(false),
298 m_rcv_buf_size(0),
299 m_rcv_wnd(0),
300 m_rcv_wnd_last_advertised(0),
301 m_rcv_reassembly_q_data_size(0),
302 m_rcv_packets_with_gaps(0),
303 m_rcv_syn_rcvd_data_cumulative_size(0),
304 m_rcv_syn_rcvd_data_q_size(0),
305 m_snd_buf_size(0),
306 m_snd_rcv_wnd(0),
307 m_snd_cong_ctl_wnd_bytes(0),
308 m_snd_cong_ctl_wnd_count_approx(0),
309 m_snd_cong_ctl_in_flight_bytes(0),
310 m_snd_cong_ctl_in_flight_count(0),
311 m_snd_smoothed_round_trip_time(0),
312 m_snd_round_trip_time_variance(0),
313 m_snd_drop_timeout(0),
314 m_snd_pacing_packet_q_size(0),
315 m_snd_pacing_slice_period(0),
316 m_snd_pacing_bytes_allowed_this_slice(0),
317 m_snd_est_bandwidth_mbit_per_sec(0)
318{
319 // Nothing.
320}
321
322void Peer_socket_info::output(std::ostream* os) const
323{
324 using boost::chrono::milliseconds;
325 using boost::chrono::round;
326
330
331 *os
332 <<
333 "--- Basic socket state ---\n"
334 "Internal state: [" << m_int_state_str << "].\n"
335 "Client or server: [" << (m_is_active_connect ? "client" : "server") << "].\n"
336 // Also visible below in the options but show it separately for convenience.
337 "Reliability mode: [" << (m_sock_opts.m_st_rexmit_on ? "reliable/rexmit on" : "unreliable/rexmit off") << "].\n"
338 "--- Buffers/queues/lists ----\n"
339 "Receive window (free space): [" << m_rcv_wnd << "]\n"
340 " = limit\n"
341 " - Receive buffer size: [" << m_rcv_buf_size << "]\n"
342 " - reassembly queue total data size: [" << m_rcv_reassembly_q_data_size << "] (0 if rexmit off)\n"
343 " " << (m_sock_opts.m_st_rexmit_on ? "Reassembly queue" : "Dupe check list") <<
344 " length: [" << m_rcv_packets_with_gaps << "].\n"
345 " Last advertised: [" << m_rcv_wnd_last_advertised << "].\n";
346
347 // This condition is hard to notice otherwise but can explain hard-to-debug refusal to send any data.
348 if ((m_rcv_wnd == 0) || (m_rcv_wnd_last_advertised == 0))
349 {
350 *os << " ^-- CAUTION! No space in [advertised] Receive buffer + reassembly queue! "
351 "Peer may think they cannot send to us!\n";
352 }
353
354 *os
355 <<
356 "DATA packets in SYN_RCVD queue: "
358 "Send buffer size: [" << m_snd_buf_size << "].\n"
359 "--- Peer's buffers ---\n"
360 "Receive window (free Receive buffer + reassembly queue space): [" << m_snd_rcv_wnd << "].\n";
361
362 // This condition is hard to notice otherwise but can explain otherwise hard-to-debug refusal to send any data.
363 if (m_snd_rcv_wnd == 0)
364 {
365 *os << "^-- CAUTION! No space in peer Receive buffer + reassembly queue! "
366 "Is that true, or did we never receive an update from peer?\n";
367 }
368
369 *os
370 <<
371 "--- Traffic stats (outgoing) ---\n" << m_snd << "\n"
372 "--- Traffic stats (incoming) ---\n" << m_rcv << "\n"
373
374 "--- Congestion control status ---\n"
375 "Window: "
377 "In-flight: "
379
380 // Truncate results to millisecond representation for readability.
381 "--- RTT/DTO data ---\n"
382 "Smoothed RTT: [" << round<milliseconds>(srtt) << " = " << srtt << "].\n"
383 "RTT variance: [" << round<milliseconds>(rtt_var) << " = " << rtt_var << "].\n"
384 "Drop Timeout: [" << round<milliseconds>(dto) << " = " << dto << "].\n"
385
386 "--- Send pacing status ---\n"
387 "Queue size: [" << m_snd_pacing_packet_q_size << "].\n"
388 "Current time "
389 "slice [epoch+" << round<milliseconds>(m_snd_pacing_slice_start.time_since_epoch()) << " "
390 "over " << round<milliseconds>(m_snd_pacing_slice_period) << "]; "
391 "currently in slice? = "
393 Fine_clock::now(),
395 "Bytes still allowed in slice: [" << m_snd_pacing_bytes_allowed_this_slice << "].\n"
396
397 "--- Send bandwidth data ---\n"
398 "Estimated outgoing available bandwidth for socket: "
399 "[" << m_snd_est_bandwidth_mbit_per_sec << " Mbit/s].\n"
400
401 "--- Config ---\n" << m_sock_opts << m_node_opts <<
402
403 "--- Other info ---\n"
404 "OS-reported UDP receive buffer size: " << m_low_lvl_max_buf_size << '.';
405}
406
407template<typename Key, typename Value>
409 const std::map<Key, Value>& count_by_type,
410 const std::map<Key, Value>* size_by_type) // Static.
411{
412 // Output two maps with the same key set (but 2nd map may not exist, if null).
413 *os << '[';
414
415 size_t idx = 0;
416 for (const auto& type_id_and_count : count_by_type)
417 {
418 // Common key; value from first map.
419 const Key& type_id = type_id_and_count.first;
420 const Value& value = type_id_and_count.second;
421
422 output_pkt_count_key(os, type_id);
423 *os << ":";
424
425 if (size_by_type)
426 {
427 *os << '[';
428
429 // Value from second map. Type can be a simple scalar or something more complex, so use this function.
430 output_pkt_count_value(os, size_by_type->find(type_id)->second);
431 *os << "b|";
432 }
433
434 // Value from first map. Similar to above.
435 output_pkt_count_value(os, value);
436
437 if (size_by_type)
438 {
439 *os << ']';
440 }
441
442 if (idx != count_by_type.size() - 1)
443 {
444 *os << ' ';
445 }
446 ++idx;
447 }
448
449 *os << ']';
450}
451
452void Peer_socket_info::output_pkt_count_value(std::ostream* os, uint64_t value) // Static.
453{
454 *os << value;
455}
456
458 const boost::array<uint64_t, 2>& value_by_delay_type) // Static.
459{
460 const auto& value_no_delay = value_by_delay_type[0];
461 const auto& value_paced = value_by_delay_type[1];
462 const char* const NO_DELAY = "NO_DELAY";
463 const char* const PACED = "PACED";
464
465 if ((value_no_delay == 0) && (value_paced == 0))
466 {
467 *os << '0';
468 }
469 else if (value_no_delay == 0)
470 {
471 *os << '[' << PACED << ':' << value_paced << ']';
472 }
473 else if (value_paced == 0)
474 {
475 *os << '[' << NO_DELAY << ':' << value_no_delay << ']';
476 }
477 else
478 {
479 *os << '[' << NO_DELAY << ':' << value_no_delay << ' ' << PACED << ':' << value_paced << ']';
480 }
481}
482
484 const std::map<Xfer_op_result, uint64_t>& value_by_op_result) // Static.
485{
486 // This value is itself a map, so use recursion, in a manner of speaking.
487 output_map_of_pkt_counts<Xfer_op_result, uint64_t>(os, value_by_op_result, 0);
488}
489
490void Peer_socket_info::output_pkt_count_key(std::ostream* os, const std::type_index& type_id) // Static.
491{
492 *os << Low_lvl_packet::type_id_to_str(type_id);
493}
494
495void Peer_socket_info::output_pkt_count_key(std::ostream* os, Xfer_op_result op_result) // Static.
496{
497 const auto result_to_str = [&]() -> const char*
498 {
499 switch (op_result)
500 {
501 case Xfer_op_result::S_FULLY_XFERRED: return "FULLY_XFERRED";
502 case Xfer_op_result::S_PARTIALLY_XFERRED: return "PARTIALLY_XFERRED";
503 case Xfer_op_result::S_ERROR: return "ERROR";
504 }
505 assert(false && "Should be unreachable; compiler should warn if incomplete switch.");
506 return nullptr;
507 };
508
509 *os << result_to_str();
510}
511
512// Free function implementations.
513
514std::ostream& operator<<(std::ostream& os, const Peer_socket_info& stats)
515{
516 stats.output(&os);
517 return os;
518}
519
520} // namespace flow::net_flow
A data store that keeps stats about the outgoing direction of a Peer_socket connection to another Flo...
Definition: info.hpp:286
uint64_t m_sent_rexmitted_data_count
Of m_sent_data_count, the data that were retransmitted (as opposed to original) data.
Definition: info.hpp:323
Fine_time_pt m_init_time
The time this object was created; should be about equal to when the socket was created.
Definition: info.hpp:313
uint64_t m_remote_rcv_wnd_recovery_events
Number of times m_rcv_wnd_exhausted changed from true (not counting it being initially set to false).
Definition: info.hpp:344
uint64_t m_sent_rexmitted_data_size
Of m_sent_data_size, the data that were retransmitted (as opposed to original) data.
Definition: info.hpp:321
Peer_socket_send_stats()
Constructs object by initializing stats to their initial values.
Definition: info.cpp:165
uint64_t m_received_ack_count
Individual acknowledgments inside low-level ACK packets that have been received (not necessarily all ...
Definition: info.hpp:335
size_t m_max_buf_data_size
Maximum number of bytes in the Send buffer so far.
Definition: info.hpp:397
uint64_t m_late_or_dupe_ack_count
Of m_received_ack_count, those packets that had either already been convered from In-flight to Acknow...
Definition: info.hpp:361
uint64_t m_drop_timeouts
Number of times Drop Timer has fired so far.
Definition: info.hpp:394
std::map< std::type_index, boost::array< uint64_t, 2 > > m_low_lvl_packet_xfer_called_size_by_type
Total size in serialized form of low-level packets that were given to OS in a send call,...
Definition: info.hpp:409
uint64_t m_idle_timeouts
Number of idle timeouts (in the send direction) so far that have been detected and indicated to conge...
Definition: info.hpp:391
uint64_t m_loss_events
Number of loss events so far (not counting Drop Timeouts) that have been reported to congestion contr...
Definition: info.hpp:385
uint64_t m_sent_data_size
Total bytes sent in DATA packets.
Definition: info.hpp:316
uint64_t m_sent_data_count
Number of packets sent in DATA packets.
Definition: info.hpp:318
std::map< std::type_index, std::map< Xfer_op_result, uint64_t > > m_low_lvl_packet_xfer_completed_count_by_type_and_result
Of m_low_lvl_packet_xfer_called_count_by_type, the data for which the send completion handler execute...
Definition: info.hpp:428
uint64_t m_good_ack_count
Of m_received_ack_count, those packets that were properly acknowledged and converted from In-flight t...
Definition: info.hpp:355
void output(std::ostream *os) const
Outputs the current stats, across multiple lines but not ending with a newline, into the given output...
Definition: info.cpp:191
uint64_t m_dropped_data_size
Total bytes in sent DATA packets that are considered permanently dropped (i.e., whose status has chan...
Definition: info.hpp:373
uint64_t m_error_acks_data_count
Of m_received_ack_count, those acknowledgments that contained some error about the sequence numbers s...
Definition: info.hpp:367
std::map< std::type_index, uint64_t > m_low_lvl_packet_xfer_requested_count_by_type
Total count of low-level packets that were given to the sending module to be sent,...
Definition: info.hpp:403
uint64_t m_dropped_data_count
Number of sent DATA packets that are considered permanently dropped (i.e., whose status has changed f...
Definition: info.hpp:378
uint64_t m_received_low_lvl_rcv_wnd_only_ack_count
Of m_received_low_lvl_ack_count, the packets that contained no individual acknowledgments but sent on...
Definition: info.hpp:332
uint64_t m_good_ack_data_size
Of the individual acknowledgments covered by m_received_ack_count, the total bytes in the DATA packet...
Definition: info.hpp:350
uint64_t m_received_low_lvl_ack_count
Number of low-level ACK packets received.
Definition: info.hpp:326
std::map< std::type_index, boost::array< uint64_t, 2 > > m_low_lvl_packet_xfer_called_count_by_type
Count of low-level packets that were given to OS in a send call, from this socket,...
Definition: info.hpp:415
std::map< std::type_index, std::map< Xfer_op_result, uint64_t > > m_low_lvl_packet_xfer_completed_size_by_type_and_result
Of m_low_lvl_packet_xfer_called_size_by_type, the data for which the send completion handler executed...
Definition: info.hpp:421
uint64_t m_remote_rcv_wnd_exhaustion_events
Number of times m_rcv_wnd_exhausted changed from false.
Definition: info.hpp:341
Flow module containing the API and implementation of the Flow network protocol, a TCP-inspired stream...
Definition: node.cpp:25
Xfer_op_result
Result of a send or receive operation, used at least in stat reporting.
@ S_FULLY_XFERRED
Bytes transferred equals bytes expected.
@ S_PARTIALLY_XFERRED
Bytes transferred less than bytes expected.
@ S_ERROR
Error occurred – probably no bytes transferred.
std::ostream & operator<<(std::ostream &os, const Congestion_control_selector::Strategy_choice &strategy_choice)
Serializes a Peer_socket_options::Congestion_control_strategy_choice enum to a standard ostream – the...
Definition: cong_ctl.cpp:146
bool in_closed_range(T const &min_val, T const &val, T const &max_val)
Returns true if and only if the given value is within the given range, inclusive.
Definition: util.hpp:246
boost::chrono::high_resolution_clock Fine_clock
Clock used for delicate time measurements, such that the now() method gets the current time relative ...
Definition: common.hpp:404
static const std::string & type_id_to_str(const std::type_index &type_id)
Returns a brief (a few characters) string description of the given packet type given as type_index(ty...
A data store that keeps stats about the a Peer_socket connection.
Definition: info.hpp:456
Peer_socket_send_stats m_snd
Stats for outgoing direction of traffic. As opposed to the other m_snd_* members, this typically accu...
Definition: info.hpp:511
Node_options m_node_opts
Per-node options currently set on the socket's Node.
Definition: info.hpp:651
size_t m_low_lvl_max_buf_size
The UDP receive buffer maximum size, as reported by an appropriate call to the appropriate getsockopt...
Definition: info.hpp:526
static void output_map_of_pkt_counts(std::ostream *os, const std::map< Key, Value > &count_by_type, const std::map< Key, Value > *size_by_type)
Helper for various output() methods that outputs a one-line representation of a sorted map,...
Definition: info.cpp:408
size_t m_rcv_buf_size
The number of bytes in the internal Receive buffer.
Definition: info.hpp:549
size_t m_rcv_wnd_last_advertised
The last rcv_wnd (receive window) size sent to sender (not necessarily received; packets can be lost)...
Definition: info.hpp:555
Peer_socket_info()
Constructs object by initializing stats to their initial values.
Definition: info.cpp:295
Fine_duration m_snd_pacing_slice_period
In pacing, the duration of the current pacing time slice.
Definition: info.hpp:629
size_t m_rcv_reassembly_q_data_size
If rexmit_on is false then 0; otherwise the total DATA payload in the reassembly queue of the socket.
Definition: info.hpp:558
size_t m_snd_pacing_bytes_allowed_this_slice
This many bytes worth of DATA packets may still be sent, at this time, within the time slice defined ...
Definition: info.hpp:635
Peer_socket_options m_sock_opts
Per-socket options currently set on the socket.
Definition: info.hpp:644
size_t m_snd_buf_size
The number of bytes in the internal Send buffer.
Definition: info.hpp:590
size_t m_rcv_syn_rcvd_data_cumulative_size
Total size of DATA payload queued while waiting for SYN_ACK_ACK in SYN_RCVD state.
Definition: info.hpp:573
size_t m_rcv_syn_rcvd_data_q_size
Number of DATA packets queued while waiting for SYN_ACK_ACK in SYN_RCVD state.
Definition: info.hpp:576
std::string m_int_state_str
The internal state of the socket, rendered into string (e.g., "SYN_RECEIVED" or "ESTABLISHED").
Definition: info.hpp:533
Fine_time_pt m_snd_pacing_slice_start
In pacing, the time point marking the beginning of the current pacing time slice.
Definition: info.hpp:626
size_t m_snd_cong_ctl_in_flight_count
In congestion control, the current sent data packets that have been neither acknowledged nor consider...
Definition: info.hpp:611
size_t m_snd_cong_ctl_in_flight_bytes
In congestion control, the current sent data bytes that have been neither acknowledged nor considered...
Definition: info.hpp:608
double m_snd_est_bandwidth_mbit_per_sec
Estimate of the currently available (to this connection) outgoing bandwidth, in megabits per second.
Definition: info.hpp:641
size_t m_rcv_wnd
Receive window size = max Receive buffer space minus space taken. Infinity if flow control disabled.
Definition: info.hpp:552
size_t m_rcv_packets_with_gaps
Number of DATA packets tracked in structure tracking all valid received packets such at least one pac...
Definition: info.hpp:570
size_t m_snd_cong_ctl_wnd_bytes
In congestion control, the current congestion window (number of outgoing data bytes allowed In-flight...
Definition: info.hpp:599
Fine_duration m_snd_smoothed_round_trip_time
Estimated current round trip time of packets, computed as a smooth value over the past individual RTT...
Definition: info.hpp:614
size_t m_snd_cong_ctl_wnd_count_approx
In congestion control, the approximate equivalent of m_snd_cong_ctl_in_flight_bytes as a full packet ...
Definition: info.hpp:602
size_t m_snd_rcv_wnd
The receive window (rcv_wnd a/k/a free Receive buffer space) value of the peer socket on the other si...
Definition: info.hpp:596
static void output_pkt_count_value(std::ostream *os, uint64_t value)
Helper for output_map_of_pkt_counts() that outputs a count or size.
Definition: info.cpp:452
bool m_is_active_connect
true if this is the "client" socket (connect()ed); false otherwise (accept()ed).
Definition: info.hpp:536
size_t m_snd_pacing_packet_q_size
In pacing, number of packets currently queued to be sent out by the pacing module.
Definition: info.hpp:623
static void output_pkt_count_key(std::ostream *os, const std::type_index &type_id)
Helper for output_map_of_pkt_counts() that outputs a raw packet type ID index, namely type_index(type...
Definition: info.cpp:490
void output(std::ostream *os) const
Outputs the current stats, across multiple lines but not ending with a newline, into the given output...
Definition: info.cpp:322
Fine_duration m_snd_round_trip_time_variance
RTTVAR used for m_snd_smoothed_round_trip_time calculation; it is the current RTT variance.
Definition: info.hpp:617
flow::Fine_duration Fine_duration
Short-hand for a fine boost.chrono time duration type.
Definition: info.hpp:460
Peer_socket_receive_stats m_rcv
Stats for incoming direction of traffic. As opposed to the other m_rcv_* members, this typically accu...
Definition: info.hpp:508
Fine_duration m_snd_drop_timeout
Drop Timeout: how long a given packet must remain unacknowledged to be considered dropped due to Drop...
Definition: info.hpp:620
bool m_st_rexmit_on
Whether to enable reliability via retransmission.
Definition: options.hpp:214
A data store that keeps stats about the incoming direction of a Peer_socket connection to another Flo...
Definition: info.hpp:54
uint64_t m_good_data_delivered_size
Of m_good_data_accepted_size, the data that were delivered into Receive buffer (either immediately up...
Definition: info.hpp:102
uint64_t m_rcv_wnd_recovery_success_count
Of m_rcv_wnd_recovery_count, the number of times the recovery was successful: i.e....
Definition: info.hpp:243
uint64_t m_total_data_size
Bytes in DATA packets received on socket.
Definition: info.hpp:78
void output(std::ostream *os) const
Outputs the current stats, across multiple lines but not ending with a newline, into the given output...
Definition: info.cpp:68
uint64_t m_good_to_send_acks_data_size
Of m_total_to_send_acks_data_size, the data that also satisfy the criteria in m_good_data_delivered_s...
Definition: info.hpp:186
uint64_t m_good_data_accepted_size
Of m_good_data_size, the data that were not dropped (so either delivered into Receive buffer or queue...
Definition: info.hpp:91
uint64_t m_late_or_dupe_data_size
Of m_total_data_size, the data that had either already been received before or (more likely) had been...
Definition: info.hpp:156
uint64_t m_rcv_wnd_recovery_timeout_count
Of m_rcv_wnd_recovery_count, the number of times the recovery failed: i.e., resulted in a certain len...
Definition: info.hpp:251
uint64_t m_delayed_acks_count
The total number of individual packet acknowledgments whose sending was delayed (via delayed ACK mech...
Definition: info.hpp:215
uint64_t m_good_to_send_acks_count
Of m_total_to_send_acks_count, the data that also satisfy the criteria in m_good_data_delivered_count...
Definition: info.hpp:191
uint64_t m_total_to_send_acks_count
Number of DATA packets acknowledged thus far or that have been received and are pending to be acknowl...
Definition: info.hpp:179
uint64_t m_total_to_send_acks_data_size
Bytes in received DATA packets acknowledged thus far or that have been received and are pending to be...
Definition: info.hpp:174
uint64_t m_good_data_size
Of m_total_data_size, the data that were new and acceptable into Receive buffer assuming there was sp...
Definition: info.hpp:83
uint64_t m_late_or_dupe_data_count
Of m_total_data_count, the data that had either already been received before or (more likely) had bee...
Definition: info.hpp:161
uint64_t m_sent_individual_acks_count
Number of DATA packets such that for a given packet an individual acknowledgment has been packaged in...
Definition: info.hpp:221
size_t m_max_buf_data_size
Maximum number of bytes in the Receive buffer so far.
Definition: info.hpp:260
uint64_t m_sent_low_lvl_acks_count
Number of low-level ACK packets that have been sent or will be sent as soon as possible.
Definition: info.hpp:224
uint64_t m_good_data_delivered_count
Of m_good_data_accepted_count, the data that were delivered into Receive buffer (either immediately u...
Definition: info.hpp:107
std::map< std::type_index, uint64_t > m_low_lvl_packet_count_by_type
Count of low-level packets received targeted at this socket, split up by packet type similarly to m_l...
Definition: info.hpp:273
uint64_t m_late_or_dupe_to_send_acks_data_size
Of m_total_to_send_acks_data_size, the data that also satisfy the criteria in m_late_or_dupe_data_siz...
Definition: info.hpp:198
uint64_t m_total_data_count
Number of DATA packets received on socket.
Definition: info.hpp:80
uint64_t m_good_data_count
Of m_total_data_count, the data that were new and acceptable into Receive buffer assuming there was s...
Definition: info.hpp:85
size_t m_current_pending_acks_count
Of m_total_to_send_acks_count, the packets that have not yet been sent to the sender (pending acknowl...
Definition: info.hpp:209
uint64_t m_sent_low_lvl_rcv_wnd_only_acks_count
Of m_sent_low_lvl_acks_count, the packets that contained no individual acknowledgments but are to be ...
Definition: info.hpp:257
uint64_t m_good_data_first_qd_size
Of m_good_data_accepted_size, the data that were, upon receipt, queued for reassembly (not immediatel...
Definition: info.hpp:113
uint64_t m_error_data_size
Of m_total_data_size, the data that contained some error about the sequence numbers so that they were...
Definition: info.hpp:145
uint64_t m_good_data_dropped_buf_overflow_size
Of m_good_data_size, the data that were dropped due to insufficient Receive buffer space.
Definition: info.hpp:124
Peer_socket_receive_stats()
Constructs object by initializing stats to their initial values.
Definition: info.cpp:28
uint64_t m_presumed_dropped_data_size
Total number of bytes in hypothetical data packets that have been considered Dropped due to the numbe...
Definition: info.hpp:168
uint64_t m_late_or_dupe_to_send_acks_count
Of m_total_to_send_acks_count, the data that also satisfy the criteria in m_late_or_dupe_data_count.
Definition: info.hpp:203
Fine_time_pt m_init_time
The time this object (or source object from assignment) was made; should be about equal to when socke...
Definition: info.hpp:75
uint64_t m_good_data_accepted_count
Of m_good_data_count, the data that were not dropped (so either delivered into Receive buffer or queu...
Definition: info.hpp:96
uint64_t m_good_data_dropped_reassembly_q_overflow_size
Of m_good_data_size, the data that were dropped due to insufficient Receive reassembly queue space (o...
Definition: info.hpp:134
uint64_t m_error_data_count
Of m_total_data_count, the data that contained some error about the sequence numbers so that they wer...
Definition: info.hpp:150
uint64_t m_rcv_wnd_recovery_count
Number of times we detected (heuristically but fairly reliably) that the following event occurred: ou...
Definition: info.hpp:237
uint64_t m_good_data_dropped_reassembly_q_overflow_count
Of m_good_data_count, the data that were dropped due to insufficient Receive reassembly queue space (...
Definition: info.hpp:139
uint64_t m_good_data_first_qd_count
Of m_good_data_accepted_count, the data that were, upon receipt, queued for reassembly (not immediate...
Definition: info.hpp:118
uint64_t m_good_data_dropped_buf_overflow_count
Of m_good_data_count, the data that were dropped due to insufficient Receive buffer space.
Definition: info.hpp:128
std::map< std::type_index, uint64_t > m_low_lvl_packet_size_by_type
Total size in serialized form of low-level packets received targeted at this socket,...
Definition: info.hpp:267