| 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 |
| 36 // mean_variance to be increased to the most recent variance. |
| 37 void ExpireSmoothedMetrics(); |
| 38 |
| 35 // Forces RttStats to sample a new recent min rtt within the next | 39 // Forces RttStats to sample a new recent min rtt within the next |
| 36 // |num_samples| UpdateRtt calls. | 40 // |num_samples| UpdateRtt calls. |
| 37 void SampleNewRecentMinRtt(uint32 num_samples); | 41 void SampleNewRecentMinRtt(uint32 num_samples); |
| 38 | 42 |
| 39 QuicTime::Delta SmoothedRtt() const; | 43 QuicTime::Delta SmoothedRtt() const; |
| 40 | 44 |
| 41 int64 initial_rtt_us() const { | 45 int64 initial_rtt_us() const { |
| 42 return initial_rtt_us_; | 46 return initial_rtt_us_; |
| 43 } | 47 } |
| 44 | 48 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 RttSample recent_min_rtt_; // a in the windowed algorithm. | 107 RttSample recent_min_rtt_; // a in the windowed algorithm. |
| 104 RttSample half_window_rtt_; // b in the sampled algorithm. | 108 RttSample half_window_rtt_; // b in the sampled algorithm. |
| 105 RttSample quarter_window_rtt_; // c in the sampled algorithm. | 109 RttSample quarter_window_rtt_; // c in the sampled algorithm. |
| 106 | 110 |
| 107 DISALLOW_COPY_AND_ASSIGN(RttStats); | 111 DISALLOW_COPY_AND_ASSIGN(RttStats); |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 } // namespace net | 114 } // namespace net |
| 111 | 115 |
| 112 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 116 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
| OLD | NEW |