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

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

Issue 2629723003: Revert of Add quic_logging (Closed)
Patch Set: Created 3 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
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/congestion_control/bbr_sender_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/bbr_sender.h" 5 #include "net/quic/core/congestion_control/bbr_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "net/quic/core/congestion_control/rtt_stats.h" 11 #include "net/quic/core/congestion_control/rtt_stats.h"
12 #include "net/quic/core/quic_flags.h" 12 #include "net/quic/core/quic_flags.h"
13 #include "net/quic/platform/api/quic_bug_tracker.h" 13 #include "net/quic/platform/api/quic_bug_tracker.h"
14 #include "net/quic/platform/api/quic_logging.h"
15 14
16 namespace net { 15 namespace net {
17 16
18 namespace { 17 namespace {
19 // Constants based on TCP defaults. 18 // Constants based on TCP defaults.
20 const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS; 19 const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS;
21 // The minimum CWND to ensure delayed acks don't reduce bandwidth measurements. 20 // The minimum CWND to ensure delayed acks don't reduce bandwidth measurements.
22 // Does not inflate the pacing rate. 21 // Does not inflate the pacing rate.
23 const QuicByteCount kMinimumCongestionWindow = 4 * kMaxSegmentSize; 22 const QuicByteCount kMinimumCongestionWindow = 4 * kMaxSegmentSize;
24 23
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // If none of the RTT samples are valid, return immediately. 295 // If none of the RTT samples are valid, return immediately.
297 if (sample_min_rtt.IsInfinite()) { 296 if (sample_min_rtt.IsInfinite()) {
298 return false; 297 return false;
299 } 298 }
300 299
301 // Do not expire min_rtt if none was ever available. 300 // Do not expire min_rtt if none was ever available.
302 bool min_rtt_expired = 301 bool min_rtt_expired =
303 !min_rtt_.IsZero() && (now > (min_rtt_timestamp_ + kMinRttExpiry)); 302 !min_rtt_.IsZero() && (now > (min_rtt_timestamp_ + kMinRttExpiry));
304 303
305 if (min_rtt_expired || sample_min_rtt < min_rtt_ || min_rtt_.IsZero()) { 304 if (min_rtt_expired || sample_min_rtt < min_rtt_ || min_rtt_.IsZero()) {
306 QUIC_DVLOG(2) << "Min RTT updated, old value: " << min_rtt_ 305 DVLOG(2) << "Min RTT updated, old value: " << min_rtt_
307 << ", new value: " << sample_min_rtt 306 << ", new value: " << sample_min_rtt
308 << ", current time: " << now.ToDebuggingValue(); 307 << ", current time: " << now.ToDebuggingValue();
309 308
310 min_rtt_ = sample_min_rtt; 309 min_rtt_ = sample_min_rtt;
311 min_rtt_timestamp_ = now; 310 min_rtt_timestamp_ = now;
312 } 311 }
313 312
314 return min_rtt_expired; 313 return min_rtt_expired;
315 } 314 }
316 315
317 void BbrSender::UpdateGainCyclePhase(QuicTime now, 316 void BbrSender::UpdateGainCyclePhase(QuicTime now,
318 QuicByteCount prior_in_flight, 317 QuicByteCount prior_in_flight,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 stream << ExportDebugState(); 520 stream << ExportDebugState();
522 return stream.str(); 521 return stream.str();
523 } 522 }
524 523
525 void BbrSender::OnApplicationLimited(QuicByteCount bytes_in_flight) { 524 void BbrSender::OnApplicationLimited(QuicByteCount bytes_in_flight) {
526 if (bytes_in_flight >= GetCongestionWindow()) { 525 if (bytes_in_flight >= GetCongestionWindow()) {
527 return; 526 return;
528 } 527 }
529 528
530 sampler_.OnAppLimited(); 529 sampler_.OnAppLimited();
531 QUIC_DVLOG(2) << "Becoming application limited. Last sent packet: " 530 DVLOG(2) << "Becoming application limited. Last sent packet: "
532 << last_sent_packet_ << ", CWND: " << GetCongestionWindow(); 531 << last_sent_packet_ << ", CWND: " << GetCongestionWindow();
533 } 532 }
534 533
535 BbrSender::DebugState BbrSender::ExportDebugState() const { 534 BbrSender::DebugState BbrSender::ExportDebugState() const {
536 return DebugState(*this); 535 return DebugState(*this);
537 } 536 }
538 537
539 static std::string ModeToString(BbrSender::Mode mode) { 538 static std::string ModeToString(BbrSender::Mode mode) {
540 switch (mode) { 539 switch (mode) {
541 case BbrSender::STARTUP: 540 case BbrSender::STARTUP:
542 return "STARTUP"; 541 return "STARTUP";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() 574 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue()
576 << std::endl; 575 << std::endl;
577 576
578 os << "Last sample is app-limited: " 577 os << "Last sample is app-limited: "
579 << (state.last_sample_is_app_limited ? "yes" : "no"); 578 << (state.last_sample_is_app_limited ? "yes" : "no");
580 579
581 return os; 580 return os;
582 } 581 }
583 582
584 } // namespace net 583 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/congestion_control/bbr_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698