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/base/linked_hash_map.h" | 8 #include "net/base/linked_hash_map.h" |
9 #include "net/quic/core/quic_bandwidth.h" | 9 #include "net/quic/core/quic_bandwidth.h" |
10 #include "net/quic/core/quic_packets.h" | 10 #include "net/quic/core/quic_packets.h" |
11 #include "net/quic/core/quic_time.h" | 11 #include "net/quic/core/quic_time.h" |
12 #include "net/quic/platform/api/quic_export.h" | |
Zhongyi Shi
2016/12/08 23:19:31
I actually didn't see this file present in this CL
Ryan Hamilton
2016/12/09 00:40:41
*scratch head* I don't understand how that happene
| |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 namespace test { | 16 namespace test { |
16 class BandwidthSamplerPeer; | 17 class BandwidthSamplerPeer; |
17 } // namespace test | 18 } // namespace test |
18 | 19 |
19 struct NET_EXPORT_PRIVATE BandwidthSample { | 20 struct QUIC_EXPORT_PRIVATE BandwidthSample { |
20 // The bandwidth at that particular sample. Zero if no valid bandwidth sample | 21 // The bandwidth at that particular sample. Zero if no valid bandwidth sample |
21 // is available. | 22 // is available. |
22 QuicBandwidth bandwidth; | 23 QuicBandwidth bandwidth; |
23 | 24 |
24 // The RTT measurement at this particular sample. Zero if no RTT sample is | 25 // The RTT measurement at this particular sample. Zero if no RTT sample is |
25 // available. Does not correct for delayed ack time. | 26 // available. Does not correct for delayed ack time. |
26 QuicTime::Delta rtt; | 27 QuicTime::Delta rtt; |
27 | 28 |
28 // Indicates whether the sample might be artificially low because the sender | 29 // Indicates whether the sample might be artificially low because the sender |
29 // did not have enough data to send in order to saturate the link. | 30 // did not have enough data to send in order to saturate the link. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 // we use to compute the slope is going to be packet 20, a few seconds apart | 109 // we use to compute the slope is going to be packet 20, a few seconds apart |
109 // from the current packet, hence the resulting estimate would be extremely low | 110 // from the current packet, hence the resulting estimate would be extremely low |
110 // and not indicative of anything. Only at packet 41 the S_0/A_0 will become 21, | 111 // and not indicative of anything. Only at packet 41 the S_0/A_0 will become 21, |
111 // meaning that the bandwidth sample would exclude the quiescence. | 112 // meaning that the bandwidth sample would exclude the quiescence. |
112 // | 113 // |
113 // Based on the analysis of that scenario, we implement the following rule: once | 114 // Based on the analysis of that scenario, we implement the following rule: once |
114 // OnAppLimited() is called, all sent packets will produce app-limited samples | 115 // OnAppLimited() is called, all sent packets will produce app-limited samples |
115 // up until an ack for a packet that was sent after OnAppLimited() was called. | 116 // up until an ack for a packet that was sent after OnAppLimited() was called. |
116 // Note that while the scenario above is not the only scenario when the | 117 // Note that while the scenario above is not the only scenario when the |
117 // connection is app-limited, the approach works in other cases too. | 118 // connection is app-limited, the approach works in other cases too. |
118 class NET_EXPORT_PRIVATE BandwidthSampler { | 119 class QUIC_EXPORT_PRIVATE BandwidthSampler { |
119 public: | 120 public: |
120 BandwidthSampler(); | 121 BandwidthSampler(); |
121 ~BandwidthSampler(); | 122 ~BandwidthSampler(); |
122 | 123 |
123 // Inputs the sent packet information into the sampler. Assumes that all | 124 // Inputs the sent packet information into the sampler. Assumes that all |
124 // packets are sent in order. The information about the packet will not be | 125 // packets are sent in order. The information about the packet will not be |
125 // released from the sampler until it the packet is either acknowledged or | 126 // released from the sampler until it the packet is either acknowledged or |
126 // declared lost. | 127 // declared lost. |
127 void OnPacketSent(QuicTime sent_time, | 128 void OnPacketSent(QuicTime sent_time, |
128 QuicPacketNumber packet_number, | 129 QuicPacketNumber packet_number, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 QuicPacketNumber end_of_app_limited_phase_; | 237 QuicPacketNumber end_of_app_limited_phase_; |
237 | 238 |
238 // Record of the connection state at the point where each packet in flight was | 239 // Record of the connection state at the point where each packet in flight was |
239 // sent, indexed by the packet number. | 240 // sent, indexed by the packet number. |
240 ConnectionStateMap connection_state_map_; | 241 ConnectionStateMap connection_state_map_; |
241 }; | 242 }; |
242 | 243 |
243 } // namespace net | 244 } // namespace net |
244 | 245 |
245 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ | 246 #endif // NET_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_ |
OLD | NEW |