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

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

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Exclude certain files from jumbo because of a Windows problem Created 3 years, 3 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
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/core/congestion_control/rtt_stats.h" 5 #include "net/quic/core/congestion_control/rtt_stats.h"
6 6
7 #include <cstdlib> // std::abs 7 #include <cstdlib> // std::abs
8 8
9 #include "net/quic/platform/api/quic_logging.h" 9 #include "net/quic/platform/api/quic_logging.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 namespace { 13 namespace {
14 14
15 // Default initial rtt used before any samples are received. 15 // Default initial rtt used before any samples are received.
16 const int kInitialRttMs = 100; 16 const int kInitialRttMs = 100;
17 const float kAlpha = 0.125f; 17 const float kAlpha = 0.125f;
18 const float kOneMinusAlpha = (1 - kAlpha); 18 const float kOneMinusAlpha = (1 - kAlpha);
19 const float kBeta = 0.25f; 19 const float kBeta2 = 0.25f;
20 const float kOneMinusBeta = (1 - kBeta); 20 const float kOneMinusBeta = (1 - kBeta2);
21 21
22 } // namespace 22 } // namespace
23 23
24 RttStats::RttStats() 24 RttStats::RttStats()
25 : latest_rtt_(QuicTime::Delta::Zero()), 25 : latest_rtt_(QuicTime::Delta::Zero()),
26 min_rtt_(QuicTime::Delta::Zero()), 26 min_rtt_(QuicTime::Delta::Zero()),
27 smoothed_rtt_(QuicTime::Delta::Zero()), 27 smoothed_rtt_(QuicTime::Delta::Zero()),
28 previous_srtt_(QuicTime::Delta::Zero()), 28 previous_srtt_(QuicTime::Delta::Zero()),
29 mean_deviation_(QuicTime::Delta::Zero()), 29 mean_deviation_(QuicTime::Delta::Zero()),
30 initial_rtt_us_(kInitialRttMs * kNumMicrosPerMilli) {} 30 initial_rtt_us_(kInitialRttMs * kNumMicrosPerMilli) {}
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 latest_rtt_ = rtt_sample; 68 latest_rtt_ = rtt_sample;
69 // First time call. 69 // First time call.
70 if (smoothed_rtt_.IsZero()) { 70 if (smoothed_rtt_.IsZero()) {
71 smoothed_rtt_ = rtt_sample; 71 smoothed_rtt_ = rtt_sample;
72 mean_deviation_ = 72 mean_deviation_ =
73 QuicTime::Delta::FromMicroseconds(rtt_sample.ToMicroseconds() / 2); 73 QuicTime::Delta::FromMicroseconds(rtt_sample.ToMicroseconds() / 2);
74 } else { 74 } else {
75 mean_deviation_ = QuicTime::Delta::FromMicroseconds(static_cast<int64_t>( 75 mean_deviation_ = QuicTime::Delta::FromMicroseconds(static_cast<int64_t>(
76 kOneMinusBeta * mean_deviation_.ToMicroseconds() + 76 kOneMinusBeta * mean_deviation_.ToMicroseconds() +
77 kBeta * std::abs((smoothed_rtt_ - rtt_sample).ToMicroseconds()))); 77 kBeta2 * std::abs((smoothed_rtt_ - rtt_sample).ToMicroseconds())));
78 smoothed_rtt_ = kOneMinusAlpha * smoothed_rtt_ + kAlpha * rtt_sample; 78 smoothed_rtt_ = kOneMinusAlpha * smoothed_rtt_ + kAlpha * rtt_sample;
79 QUIC_DVLOG(1) << " smoothed_rtt(us):" << smoothed_rtt_.ToMicroseconds() 79 QUIC_DVLOG(1) << " smoothed_rtt(us):" << smoothed_rtt_.ToMicroseconds()
80 << " mean_deviation(us):" << mean_deviation_.ToMicroseconds(); 80 << " mean_deviation(us):" << mean_deviation_.ToMicroseconds();
81 } 81 }
82 } 82 }
83 83
84 void RttStats::OnConnectionMigration() { 84 void RttStats::OnConnectionMigration() {
85 latest_rtt_ = QuicTime::Delta::Zero(); 85 latest_rtt_ = QuicTime::Delta::Zero();
86 min_rtt_ = QuicTime::Delta::Zero(); 86 min_rtt_ = QuicTime::Delta::Zero();
87 smoothed_rtt_ = QuicTime::Delta::Zero(); 87 smoothed_rtt_ = QuicTime::Delta::Zero();
88 mean_deviation_ = QuicTime::Delta::Zero(); 88 mean_deviation_ = QuicTime::Delta::Zero();
89 initial_rtt_us_ = kInitialRttMs * kNumMicrosPerMilli; 89 initial_rtt_us_ = kInitialRttMs * kNumMicrosPerMilli;
90 } 90 }
91 91
92 } // namespace net 92 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/prr_sender.cc ('k') | net/quic/core/crypto/aead_base_encrypter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698