OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ | 5 #ifndef NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ |
6 #define NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ | 6 #define NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ |
7 | 7 |
| 8 #include "net/quic/core/packet_number_indexed_queue.h" |
8 #include "net/quic/core/quic_bandwidth.h" | 9 #include "net/quic/core/quic_bandwidth.h" |
9 #include "net/quic/core/quic_packets.h" | 10 #include "net/quic/core/quic_packets.h" |
10 #include "net/quic/core/quic_time.h" | 11 #include "net/quic/core/quic_time.h" |
11 #include "net/quic/platform/api/quic_containers.h" | 12 #include "net/quic/platform/api/quic_containers.h" |
12 #include "net/quic/platform/api/quic_export.h" | 13 #include "net/quic/platform/api/quic_export.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 namespace test { | 17 namespace test { |
17 class BandwidthSamplerPeer; | 18 class BandwidthSamplerPeer; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 : sent_time(sent_time), | 200 : sent_time(sent_time), |
200 size(size), | 201 size(size), |
201 total_bytes_sent(sampler.total_bytes_sent_), | 202 total_bytes_sent(sampler.total_bytes_sent_), |
202 total_bytes_sent_at_last_acked_packet( | 203 total_bytes_sent_at_last_acked_packet( |
203 sampler.total_bytes_sent_at_last_acked_packet_), | 204 sampler.total_bytes_sent_at_last_acked_packet_), |
204 last_acked_packet_sent_time(sampler.last_acked_packet_sent_time_), | 205 last_acked_packet_sent_time(sampler.last_acked_packet_sent_time_), |
205 last_acked_packet_ack_time(sampler.last_acked_packet_ack_time_), | 206 last_acked_packet_ack_time(sampler.last_acked_packet_ack_time_), |
206 total_bytes_acked_at_the_last_acked_packet( | 207 total_bytes_acked_at_the_last_acked_packet( |
207 sampler.total_bytes_acked_), | 208 sampler.total_bytes_acked_), |
208 is_app_limited(sampler.is_app_limited_) {} | 209 is_app_limited(sampler.is_app_limited_) {} |
| 210 |
| 211 // Default constructor. Required to put this structure into |
| 212 // PacketNumberIndexedQueue. |
| 213 ConnectionStateOnSentPacket() |
| 214 : sent_time(QuicTime::Zero()), |
| 215 last_acked_packet_sent_time(QuicTime::Zero()), |
| 216 last_acked_packet_ack_time(QuicTime::Zero()) {} |
209 }; | 217 }; |
210 | 218 |
211 typedef QuicLinkedHashMap<QuicPacketNumber, ConnectionStateOnSentPacket> | 219 typedef QuicLinkedHashMap<QuicPacketNumber, ConnectionStateOnSentPacket> |
212 ConnectionStateMap; | 220 ConnectionStateMap; |
213 | 221 |
214 // The total number of congestion controlled bytes sent during the connection. | 222 // The total number of congestion controlled bytes sent during the connection. |
215 QuicByteCount total_bytes_sent_; | 223 QuicByteCount total_bytes_sent_; |
216 | 224 |
217 // The total number of congestion controlled bytes which were acknowledged. | 225 // The total number of congestion controlled bytes which were acknowledged. |
218 QuicByteCount total_bytes_acked_; | 226 QuicByteCount total_bytes_acked_; |
(...skipping 16 matching lines...) Expand all Loading... |
235 // phase. | 243 // phase. |
236 bool is_app_limited_; | 244 bool is_app_limited_; |
237 | 245 |
238 // The packet that will be acknowledged after this one will cause the sampler | 246 // The packet that will be acknowledged after this one will cause the sampler |
239 // to exit the app-limited phase. | 247 // to exit the app-limited phase. |
240 QuicPacketNumber end_of_app_limited_phase_; | 248 QuicPacketNumber end_of_app_limited_phase_; |
241 | 249 |
242 // Record of the connection state at the point where each packet in flight was | 250 // Record of the connection state at the point where each packet in flight was |
243 // sent, indexed by the packet number. | 251 // sent, indexed by the packet number. |
244 ConnectionStateMap connection_state_map_; | 252 ConnectionStateMap connection_state_map_; |
| 253 PacketNumberIndexedQueue<ConnectionStateOnSentPacket> |
| 254 connection_state_map_new_; |
| 255 const bool use_new_connection_state_map_; |
| 256 |
| 257 // Handles the actual bandwidth calculations, whereas the outer method handles |
| 258 // retrieving and removing |sent_packet|. |
| 259 BandwidthSample OnPacketAcknowledgedInner( |
| 260 QuicTime ack_time, |
| 261 QuicPacketNumber packet_number, |
| 262 const ConnectionStateOnSentPacket& sent_packet); |
245 }; | 263 }; |
246 | 264 |
247 } // namespace net | 265 } // namespace net |
248 | 266 |
249 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ | 267 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ |
OLD | NEW |