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

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

Issue 691483003: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_1028
Patch Set: Compilation error fixes Created 6 years, 1 month 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/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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 max(mean_deviation_, 46 max(mean_deviation_,
47 QuicTime::Delta::FromMicroseconds( 47 QuicTime::Delta::FromMicroseconds(
48 std::abs(smoothed_rtt_.Subtract(latest_rtt_).ToMicroseconds()))); 48 std::abs(smoothed_rtt_.Subtract(latest_rtt_).ToMicroseconds())));
49 smoothed_rtt_ = max(smoothed_rtt_, latest_rtt_); 49 smoothed_rtt_ = max(smoothed_rtt_, latest_rtt_);
50 } 50 }
51 51
52 // Updates the RTT based on a new sample. 52 // Updates the RTT based on a new sample.
53 void RttStats::UpdateRtt(QuicTime::Delta send_delta, 53 void RttStats::UpdateRtt(QuicTime::Delta send_delta,
54 QuicTime::Delta ack_delay, 54 QuicTime::Delta ack_delay,
55 QuicTime now) { 55 QuicTime now) {
56 if (send_delta.IsInfinite() || send_delta.IsZero()) { 56 if (send_delta.IsInfinite() || send_delta <= QuicTime::Delta::Zero()) {
57 DVLOG(1) << "Ignoring measured send_delta, because it's " 57 LOG(WARNING) << "Ignoring measured send_delta, because it's is "
58 << (send_delta.IsZero() ? "Zero" : "Infinite"); 58 << "either infinite, zero, or negative. send_delta = "
59 << send_delta.ToMicroseconds();
59 return; 60 return;
60 } 61 }
61 62
62 // Update min_rtt_ first. min_rtt_ does not use an rtt_sample corrected for 63 // Update min_rtt_ first. min_rtt_ does not use an rtt_sample corrected for
63 // ack_delay but the raw observed send_delta, since poor clock granularity at 64 // ack_delay but the raw observed send_delta, since poor clock granularity at
64 // the client may cause a high ack_delay to result in underestimation of the 65 // the client may cause a high ack_delay to result in underestimation of the
65 // min_rtt_. 66 // min_rtt_.
66 if (min_rtt_.IsZero() || min_rtt_ > send_delta) { 67 if (min_rtt_.IsZero() || min_rtt_ > send_delta) {
67 min_rtt_ = send_delta; 68 min_rtt_ = send_delta;
68 } 69 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 139 }
139 140
140 QuicTime::Delta RttStats::MinRtt() const { 141 QuicTime::Delta RttStats::MinRtt() const {
141 if (!HasUpdates()) { 142 if (!HasUpdates()) {
142 return QuicTime::Delta::FromMicroseconds(initial_rtt_us_); 143 return QuicTime::Delta::FromMicroseconds(initial_rtt_us_);
143 } 144 }
144 return min_rtt_; 145 return min_rtt_;
145 } 146 }
146 147
147 } // namespace net 148 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/prr_sender_test.cc ('k') | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698