OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A convenience class to store rtt samples and calculate smoothed rtt. | 5 // A convenience class to store rtt samples and calculate smoothed rtt. |
6 | 6 |
7 #ifndef NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 7 #ifndef NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
8 #define NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 8 #define NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Returns true if any RTT measurements have been made. | 26 // Returns true if any RTT measurements have been made. |
27 bool HasUpdates() const; | 27 bool HasUpdates() const; |
28 | 28 |
29 // Updates the RTT from an incoming ack which is received |send_delta| after | 29 // Updates the RTT from an incoming ack which is received |send_delta| after |
30 // the packet is sent and the peer reports the ack being delayed |ack_delay|. | 30 // the packet is sent and the peer reports the ack being delayed |ack_delay|. |
31 void UpdateRtt(QuicTime::Delta send_delta, | 31 void UpdateRtt(QuicTime::Delta send_delta, |
32 QuicTime::Delta ack_delay, | 32 QuicTime::Delta ack_delay, |
33 QuicTime now); | 33 QuicTime now); |
34 | 34 |
35 // Causes the smoothed_rtt to be increased to the latest_rtt and the | 35 // Causes the smoothed_rtt to be increased to the latest_rtt if the latest_rtt |
36 // mean_variance to be increased to the most recent variance. | 36 // is larger. The mean deviation is increased to the most recent deviation if |
| 37 // it's larger. |
37 void ExpireSmoothedMetrics(); | 38 void ExpireSmoothedMetrics(); |
38 | 39 |
39 // Forces RttStats to sample a new recent min rtt within the next | 40 // Forces RttStats to sample a new recent min rtt within the next |
40 // |num_samples| UpdateRtt calls. | 41 // |num_samples| UpdateRtt calls. |
41 void SampleNewRecentMinRtt(uint32 num_samples); | 42 void SampleNewRecentMinRtt(uint32 num_samples); |
42 | 43 |
43 QuicTime::Delta SmoothedRtt() const; | 44 QuicTime::Delta SmoothedRtt() const; |
44 | 45 |
45 int64 initial_rtt_us() const { | 46 int64 initial_rtt_us() const { |
46 return initial_rtt_us_; | 47 return initial_rtt_us_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 RttSample recent_min_rtt_; // a in the windowed algorithm. | 108 RttSample recent_min_rtt_; // a in the windowed algorithm. |
108 RttSample half_window_rtt_; // b in the sampled algorithm. | 109 RttSample half_window_rtt_; // b in the sampled algorithm. |
109 RttSample quarter_window_rtt_; // c in the sampled algorithm. | 110 RttSample quarter_window_rtt_; // c in the sampled algorithm. |
110 | 111 |
111 DISALLOW_COPY_AND_ASSIGN(RttStats); | 112 DISALLOW_COPY_AND_ASSIGN(RttStats); |
112 }; | 113 }; |
113 | 114 |
114 } // namespace net | 115 } // namespace net |
115 | 116 |
116 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 117 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
OLD | NEW |