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 #include "net/quic/congestion_control/rtt_stats.h" | 5 #include "net/quic/congestion_control/rtt_stats.h" |
6 | 6 |
7 #include <complex> // std::abs | 7 #include <complex> // std::abs |
8 | 8 |
9 using std::max; | 9 using std::max; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 const float kHalfWindow = 0.5f; | 21 const float kHalfWindow = 0.5f; |
22 const float kQuarterWindow = 0.25f; | 22 const float kQuarterWindow = 0.25f; |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 RttStats::RttStats() | 26 RttStats::RttStats() |
27 : latest_rtt_(QuicTime::Delta::Zero()), | 27 : latest_rtt_(QuicTime::Delta::Zero()), |
28 min_rtt_(QuicTime::Delta::Zero()), | 28 min_rtt_(QuicTime::Delta::Zero()), |
29 smoothed_rtt_(QuicTime::Delta::Zero()), | 29 smoothed_rtt_(QuicTime::Delta::Zero()), |
30 mean_deviation_(QuicTime::Delta::Zero()), | 30 mean_deviation_(QuicTime::Delta::Zero()), |
31 initial_rtt_us_(kInitialRttMs * base::Time::kMicrosecondsPerMillisecond), | 31 initial_rtt_us_(kInitialRttMs * kNumMicrosPerMilli), |
32 num_min_rtt_samples_remaining_(0), | 32 num_min_rtt_samples_remaining_(0), |
33 recent_min_rtt_window_(QuicTime::Delta::Infinite()) {} | 33 recent_min_rtt_window_(QuicTime::Delta::Infinite()) {} |
34 | 34 |
35 void RttStats::SampleNewRecentMinRtt(uint32 num_samples) { | 35 void RttStats::SampleNewRecentMinRtt(uint32 num_samples) { |
36 num_min_rtt_samples_remaining_ = num_samples; | 36 num_min_rtt_samples_remaining_ = num_samples; |
37 new_min_rtt_ = RttSample(); | 37 new_min_rtt_ = RttSample(); |
38 } | 38 } |
39 | 39 |
40 void RttStats::ExpireSmoothedMetrics() { | 40 void RttStats::ExpireSmoothedMetrics() { |
41 mean_deviation_ = | 41 mean_deviation_ = |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 now.Subtract(recent_min_rtt_window_.Multiply(kHalfWindow))) { | 121 now.Subtract(recent_min_rtt_window_.Multiply(kHalfWindow))) { |
122 half_window_rtt_ = quarter_window_rtt_; | 122 half_window_rtt_ = quarter_window_rtt_; |
123 quarter_window_rtt_ = RttSample(rtt_sample, now); | 123 quarter_window_rtt_ = RttSample(rtt_sample, now); |
124 } else if (quarter_window_rtt_.time < | 124 } else if (quarter_window_rtt_.time < |
125 now.Subtract(recent_min_rtt_window_.Multiply(kQuarterWindow))) { | 125 now.Subtract(recent_min_rtt_window_.Multiply(kQuarterWindow))) { |
126 quarter_window_rtt_ = RttSample(rtt_sample, now); | 126 quarter_window_rtt_ = RttSample(rtt_sample, now); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 } // namespace net | 130 } // namespace net |
OLD | NEW |