Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: net/quic/congestion_control/rtt_stats.cc

Issue 331573002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compiler error - use push_back to initialize vectors Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 namespace net { 7 namespace net {
8 8
9 namespace { 9 namespace {
10 10
11 // Default initial rtt used before any samples are received. 11 // Default initial rtt used before any samples are received.
12 const int kInitialRttMs = 100; 12 const int kInitialRttMs = 100;
13 const float kAlpha = 0.125f; 13 const float kAlpha = 0.125f;
14 const float kOneMinusAlpha = (1 - kAlpha); 14 const float kOneMinusAlpha = (1 - kAlpha);
15 const float kBeta = 0.25f; 15 const float kBeta = 0.25f;
16 const float kOneMinusBeta = (1 - kBeta); 16 const float kOneMinusBeta = (1 - kBeta);
17 const float kHalfWindow = 0.5f; 17 const float kHalfWindow = 0.5f;
18 const float kQuarterWindow = 0.25f; 18 const float kQuarterWindow = 0.25f;
19 19
20 } // namespace 20 } // namespace
21 21
22 RttStats::RttStats() 22 RttStats::RttStats()
23 : latest_rtt_(QuicTime::Delta::Zero()), 23 : latest_rtt_(QuicTime::Delta::Zero()),
24 min_rtt_(QuicTime::Delta::Zero()), 24 min_rtt_(QuicTime::Delta::Zero()),
25 smoothed_rtt_(QuicTime::Delta::Zero()), 25 smoothed_rtt_(QuicTime::Delta::Zero()),
26 mean_deviation_(QuicTime::Delta::Zero()), 26 mean_deviation_(QuicTime::Delta::Zero()),
27 initial_rtt_us_(kInitialRttMs * base::Time::kMicrosecondsPerMillisecond), 27 initial_rtt_us_(kInitialRttMs * base::Time::kMicrosecondsPerMillisecond),
28 num_min_rtt_samples_remaining_(0), 28 num_min_rtt_samples_remaining_(0),
29 recent_min_rtt_window_(QuicTime::Delta::Zero()) { } 29 recent_min_rtt_window_(QuicTime::Delta::Infinite()) {}
30 30
31 bool RttStats::HasUpdates() const { 31 bool RttStats::HasUpdates() const {
32 return !smoothed_rtt_.IsZero(); 32 return !smoothed_rtt_.IsZero();
33 } 33 }
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
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 QuicTime::Delta RttStats::SmoothedRtt() const { 122 QuicTime::Delta RttStats::SmoothedRtt() const {
123 if (!HasUpdates()) { 123 if (!HasUpdates()) {
124 return QuicTime::Delta::FromMicroseconds(initial_rtt_us_); 124 return QuicTime::Delta::FromMicroseconds(initial_rtt_us_);
125 } 125 }
126 return smoothed_rtt_; 126 return smoothed_rtt_;
127 } 127 }
128 128
129 } // namespace net 129 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698