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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // Causes the smoothed_rtt to be increased to the latest_rtt if the latest_rtt | 32 // Causes the smoothed_rtt to be increased to the latest_rtt if the latest_rtt |
33 // is larger. The mean deviation is increased to the most recent deviation if | 33 // is larger. The mean deviation is increased to the most recent deviation if |
34 // it's larger. | 34 // it's larger. |
35 void ExpireSmoothedMetrics(); | 35 void ExpireSmoothedMetrics(); |
36 | 36 |
37 // Forces RttStats to sample a new recent min rtt within the next | 37 // Forces RttStats to sample a new recent min rtt within the next |
38 // |num_samples| UpdateRtt calls. | 38 // |num_samples| UpdateRtt calls. |
39 void SampleNewRecentMinRtt(uint32 num_samples); | 39 void SampleNewRecentMinRtt(uint32 num_samples); |
40 | 40 |
| 41 // Called when connection migrates and rtt measurement needs to be reset. |
| 42 void OnConnectionMigration() {} |
| 43 |
41 // Returns the EWMA smoothed RTT for the connection. | 44 // Returns the EWMA smoothed RTT for the connection. |
42 // May return Zero if no valid updates have occurred. | 45 // May return Zero if no valid updates have occurred. |
43 QuicTime::Delta smoothed_rtt() const { | 46 QuicTime::Delta smoothed_rtt() const { |
44 return smoothed_rtt_; | 47 return smoothed_rtt_; |
45 } | 48 } |
46 | 49 |
47 int64 initial_rtt_us() const { | 50 int64 initial_rtt_us() const { |
48 return initial_rtt_us_; | 51 return initial_rtt_us_; |
49 } | 52 } |
50 | 53 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 RttSample recent_min_rtt_; // a in the windowed algorithm. | 119 RttSample recent_min_rtt_; // a in the windowed algorithm. |
117 RttSample half_window_rtt_; // b in the sampled algorithm. | 120 RttSample half_window_rtt_; // b in the sampled algorithm. |
118 RttSample quarter_window_rtt_; // c in the sampled algorithm. | 121 RttSample quarter_window_rtt_; // c in the sampled algorithm. |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(RttStats); | 123 DISALLOW_COPY_AND_ASSIGN(RttStats); |
121 }; | 124 }; |
122 | 125 |
123 } // namespace net | 126 } // namespace net |
124 | 127 |
125 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 128 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
OLD | NEW |