ngtcp2_conn_stat.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * ngtcp2
  3. *
  4. * Copyright (c) 2023 ngtcp2 contributors
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sublicense, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be
  15. * included in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  20. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. */
  25. #ifndef NGTCP2_CONN_STAT_H
  26. #define NGTCP2_CONN_STAT_H
  27. #ifdef HAVE_CONFIG_H
  28. # include <config.h>
  29. #endif /* defined(HAVE_CONFIG_H) */
  30. #include <ngtcp2/ngtcp2.h>
  31. /**
  32. * @struct
  33. *
  34. * :type:`ngtcp2_conn_stat` holds various connection statistics, and
  35. * computed data for recovery and congestion controller.
  36. */
  37. typedef struct ngtcp2_conn_stat {
  38. /**
  39. * :member:`latest_rtt` is the latest RTT sample which is not
  40. * adjusted by acknowledgement delay.
  41. */
  42. ngtcp2_duration latest_rtt;
  43. /**
  44. * :member:`min_rtt` is the minimum RTT seen so far. It is not
  45. * adjusted by acknowledgement delay.
  46. */
  47. ngtcp2_duration min_rtt;
  48. /**
  49. * :member:`smoothed_rtt` is the smoothed RTT.
  50. */
  51. ngtcp2_duration smoothed_rtt;
  52. /**
  53. * :member:`rttvar` is a mean deviation of observed RTT.
  54. */
  55. ngtcp2_duration rttvar;
  56. /**
  57. * :member:`initial_rtt` is the initial RTT which is used when no
  58. * RTT sample is available.
  59. */
  60. ngtcp2_duration initial_rtt;
  61. /**
  62. * :member:`first_rtt_sample_ts` is the timestamp when the first RTT
  63. * sample is obtained.
  64. */
  65. ngtcp2_tstamp first_rtt_sample_ts;
  66. /**
  67. * :member:`pto_count` is the count of successive PTO timer
  68. * expiration.
  69. */
  70. size_t pto_count;
  71. /**
  72. * :member:`loss_detection_timer` is the deadline of the current
  73. * loss detection timer.
  74. */
  75. ngtcp2_tstamp loss_detection_timer;
  76. /**
  77. * :member:`last_tx_pkt_ts` corresponds to
  78. * time_of_last_ack_eliciting_packet in :rfc:`9002`.
  79. */
  80. ngtcp2_tstamp last_tx_pkt_ts[NGTCP2_PKTNS_ID_MAX];
  81. /**
  82. * :member:`loss_time` corresponds to loss_time in :rfc:`9002`.
  83. */
  84. ngtcp2_tstamp loss_time[NGTCP2_PKTNS_ID_MAX];
  85. /**
  86. * :member:`cwnd` is the size of congestion window.
  87. */
  88. uint64_t cwnd;
  89. /**
  90. * :member:`ssthresh` is slow start threshold.
  91. */
  92. uint64_t ssthresh;
  93. /**
  94. * :member:`congestion_recovery_start_ts` is the timestamp when
  95. * congestion recovery started.
  96. */
  97. ngtcp2_tstamp congestion_recovery_start_ts;
  98. /**
  99. * :member:`bytes_in_flight` is the number in bytes of all sent
  100. * packets which have not been acknowledged.
  101. */
  102. uint64_t bytes_in_flight;
  103. /**
  104. * :member:`max_tx_udp_payload_size` is the maximum size of UDP
  105. * datagram payload that this endpoint transmits to the current
  106. * path. It is used by congestion controller to compute congestion
  107. * window.
  108. */
  109. size_t max_tx_udp_payload_size;
  110. /**
  111. * :member:`delivery_rate_sec` is the current sending rate measured
  112. * in byte per second.
  113. */
  114. uint64_t delivery_rate_sec;
  115. /**
  116. * :member:`pacing_interval` is the inverse of pacing rate, which is
  117. * the current packet sending rate computed by a congestion
  118. * controller. 0 if a congestion controller does not set pacing
  119. * interval. Even if this value is set to 0, the library paces
  120. * packets.
  121. */
  122. ngtcp2_duration pacing_interval;
  123. /**
  124. * :member:`send_quantum` is the maximum size of a data aggregate
  125. * scheduled and transmitted together.
  126. */
  127. size_t send_quantum;
  128. } ngtcp2_conn_stat;
  129. #endif /* !defined(NGTCP2_CONN_STAT_H) */