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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 QuicTime::Delta smoothed_rtt() const { | 46 QuicTime::Delta smoothed_rtt() const { |
47 return smoothed_rtt_; | 47 return smoothed_rtt_; |
48 } | 48 } |
49 | 49 |
50 int64 initial_rtt_us() const { | 50 int64 initial_rtt_us() const { |
51 return initial_rtt_us_; | 51 return initial_rtt_us_; |
52 } | 52 } |
53 | 53 |
54 // Sets an initial RTT to be used for SmoothedRtt before any RTT updates. | 54 // Sets an initial RTT to be used for SmoothedRtt before any RTT updates. |
55 void set_initial_rtt_us(int64 initial_rtt_us) { | 55 void set_initial_rtt_us(int64 initial_rtt_us) { |
| 56 if (initial_rtt_us <= 0) { |
| 57 LOG(DFATAL) << "Attempt to set initial rtt to <= 0."; |
| 58 return; |
| 59 } |
56 initial_rtt_us_ = initial_rtt_us; | 60 initial_rtt_us_ = initial_rtt_us; |
57 } | 61 } |
58 | 62 |
59 // The most recent rtt measurement. | 63 // The most recent rtt measurement. |
60 // May return Zero if no valid updates have occurred. | 64 // May return Zero if no valid updates have occurred. |
61 QuicTime::Delta latest_rtt() const { | 65 QuicTime::Delta latest_rtt() const { |
62 return latest_rtt_; | 66 return latest_rtt_; |
63 } | 67 } |
64 | 68 |
65 // Returns the min_rtt for the entire connection. | 69 // Returns the min_rtt for the entire connection. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 RttSample recent_min_rtt_; // a in the windowed algorithm. | 119 RttSample recent_min_rtt_; // a in the windowed algorithm. |
116 RttSample half_window_rtt_; // b in the sampled algorithm. | 120 RttSample half_window_rtt_; // b in the sampled algorithm. |
117 RttSample quarter_window_rtt_; // c in the sampled algorithm. | 121 RttSample quarter_window_rtt_; // c in the sampled algorithm. |
118 | 122 |
119 DISALLOW_COPY_AND_ASSIGN(RttStats); | 123 DISALLOW_COPY_AND_ASSIGN(RttStats); |
120 }; | 124 }; |
121 | 125 |
122 } // namespace net | 126 } // namespace net |
123 | 127 |
124 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 128 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
OLD | NEW |