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

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

Issue 125403006: Various QUIC cleanups to sync with internal code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 6 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/hybrid_slow_start.h" 5 #include "net/quic/congestion_control/hybrid_slow_start.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 using std::max;
10 using std::min;
11
9 namespace net { 12 namespace net {
10 13
11 // Note(pwestin): the magic clamping numbers come from the original code in 14 // Note(pwestin): the magic clamping numbers come from the original code in
12 // tcp_cubic.c. 15 // tcp_cubic.c.
13 // Number of delay samples for detecting the increase of delay. 16 // Number of delay samples for detecting the increase of delay.
14 const int kHybridStartMinSamples = 8; 17 const int kHybridStartMinSamples = 8;
15 const int kHybridStartDelayFactorExp = 4; // 2^4 = 16 18 const int kHybridStartDelayFactorExp = 4; // 2^4 = 16
16 const int kHybridStartDelayMinThresholdUs = 2000; 19 const int kHybridStartDelayMinThresholdUs = 2000;
17 const int kHybridStartDelayMaxThresholdUs = 16000; 20 const int kHybridStartDelayMaxThresholdUs = 16000;
18 21
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 sample_count_++; 82 sample_count_++;
80 if (sample_count_ <= kHybridStartMinSamples) { 83 if (sample_count_ <= kHybridStartMinSamples) {
81 if (current_rtt_.IsZero() || current_rtt_ > rtt) { 84 if (current_rtt_.IsZero() || current_rtt_ > rtt) {
82 current_rtt_ = rtt; 85 current_rtt_ = rtt;
83 } 86 }
84 } 87 }
85 // We only need to check this once. 88 // We only need to check this once.
86 if (sample_count_ == kHybridStartMinSamples) { 89 if (sample_count_ == kHybridStartMinSamples) {
87 int accepted_variance_us = delay_min.ToMicroseconds() >> 90 int accepted_variance_us = delay_min.ToMicroseconds() >>
88 kHybridStartDelayFactorExp; 91 kHybridStartDelayFactorExp;
89 accepted_variance_us = std::min(accepted_variance_us, 92 accepted_variance_us = min(accepted_variance_us,
90 kHybridStartDelayMaxThresholdUs); 93 kHybridStartDelayMaxThresholdUs);
91 QuicTime::Delta accepted_variance = QuicTime::Delta::FromMicroseconds( 94 QuicTime::Delta accepted_variance = QuicTime::Delta::FromMicroseconds(
92 std::max(accepted_variance_us, kHybridStartDelayMinThresholdUs)); 95 max(accepted_variance_us, kHybridStartDelayMinThresholdUs));
93 96
94 if (current_rtt_ > delay_min.Add(accepted_variance)) { 97 if (current_rtt_ > delay_min.Add(accepted_variance)) {
95 found_delay_ = true; 98 found_delay_ = true;
96 } 99 }
97 } 100 }
98 } 101 }
99 102
100 bool HybridSlowStart::Exit() { 103 bool HybridSlowStart::Exit() {
101 // If either one of the two conditions are met we exit from slow start 104 // If either one of the two conditions are met we exit from slow start
102 // immediately. 105 // immediately.
103 if (found_ack_train_ || found_delay_) { 106 if (found_ack_train_ || found_delay_) {
104 return true; 107 return true;
105 } 108 }
106 return false; 109 return false;
107 } 110 }
108 111
109 } // namespace net 112 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/fix_rate_sender.cc ('k') | net/quic/congestion_control/inter_arrival_bitrate_ramp_up.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698