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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
14 #include "net/quic/quic_time.h" | 14 #include "net/quic/quic_time.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 namespace test { | 18 namespace test { |
19 class RttStatsPeer; | 19 class RttStatsPeer; |
20 } // namespace test | 20 } // namespace test |
21 | 21 |
22 class NET_EXPORT_PRIVATE RttStats { | 22 class NET_EXPORT_PRIVATE RttStats { |
23 public: | 23 public: |
24 RttStats(); | 24 RttStats(); |
25 | 25 |
26 // Returns true if any RTT measurements have been made. | |
27 bool HasUpdates() const; | |
28 | |
29 // Updates the RTT from an incoming ack which is received |send_delta| after | 26 // 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|. | 27 // the packet is sent and the peer reports the ack being delayed |ack_delay|. |
31 void UpdateRtt(QuicTime::Delta send_delta, | 28 void UpdateRtt(QuicTime::Delta send_delta, |
32 QuicTime::Delta ack_delay, | 29 QuicTime::Delta ack_delay, |
33 QuicTime now); | 30 QuicTime now); |
34 | 31 |
35 // 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 |
36 // 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 |
37 // it's larger. | 34 // it's larger. |
38 void ExpireSmoothedMetrics(); | 35 void ExpireSmoothedMetrics(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 RttSample recent_min_rtt_; // a in the windowed algorithm. | 116 RttSample recent_min_rtt_; // a in the windowed algorithm. |
120 RttSample half_window_rtt_; // b in the sampled algorithm. | 117 RttSample half_window_rtt_; // b in the sampled algorithm. |
121 RttSample quarter_window_rtt_; // c in the sampled algorithm. | 118 RttSample quarter_window_rtt_; // c in the sampled algorithm. |
122 | 119 |
123 DISALLOW_COPY_AND_ASSIGN(RttStats); | 120 DISALLOW_COPY_AND_ASSIGN(RttStats); |
124 }; | 121 }; |
125 | 122 |
126 } // namespace net | 123 } // namespace net |
127 | 124 |
128 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ | 125 #endif // NET_QUIC_CONGESTION_CONTROL_RTT_STATS_H_ |
OLD | NEW |