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

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

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/pacing_sender.h" 5 #include "net/quic/core/congestion_control/pacing_sender.h"
6 6
7 #include "net/quic/platform/api/quic_logging.h"
8
7 namespace net { 9 namespace net {
8 namespace { 10 namespace {
9 11
10 // The estimated system alarm granularity. 12 // The estimated system alarm granularity.
11 static const QuicTime::Delta kAlarmGranularity = 13 static const QuicTime::Delta kAlarmGranularity =
12 QuicTime::Delta::FromMilliseconds(1); 14 QuicTime::Delta::FromMilliseconds(1);
13 15
14 // Configured maximum size of the burst coming out of quiescence. The burst 16 // Configured maximum size of the burst coming out of quiescence. The burst
15 // is never larger than the current CWND in packets. 17 // is never larger than the current CWND in packets.
16 static const uint32_t kInitialUnpacedBurst = 10; 18 static const uint32_t kInitialUnpacedBurst = 10;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 121 }
120 122
121 if (!time_until_send.IsZero()) { 123 if (!time_until_send.IsZero()) {
122 DCHECK(time_until_send.IsInfinite()); 124 DCHECK(time_until_send.IsInfinite());
123 // The underlying sender prevents sending. 125 // The underlying sender prevents sending.
124 return time_until_send; 126 return time_until_send;
125 } 127 }
126 128
127 // If the next send time is within the alarm granularity, send immediately. 129 // If the next send time is within the alarm granularity, send immediately.
128 if (ideal_next_packet_send_time_ > now + kAlarmGranularity) { 130 if (ideal_next_packet_send_time_ > now + kAlarmGranularity) {
129 DVLOG(1) << "Delaying packet: " 131 QUIC_DVLOG(1) << "Delaying packet: "
130 << (ideal_next_packet_send_time_ - now).ToMicroseconds(); 132 << (ideal_next_packet_send_time_ - now).ToMicroseconds();
131 was_last_send_delayed_ = true; 133 was_last_send_delayed_ = true;
132 return ideal_next_packet_send_time_ - now; 134 return ideal_next_packet_send_time_ - now;
133 } 135 }
134 136
135 DVLOG(1) << "Sending packet now"; 137 QUIC_DVLOG(1) << "Sending packet now";
136 return QuicTime::Delta::Zero(); 138 return QuicTime::Delta::Zero();
137 } 139 }
138 140
139 QuicBandwidth PacingSender::PacingRate(QuicByteCount bytes_in_flight) const { 141 QuicBandwidth PacingSender::PacingRate(QuicByteCount bytes_in_flight) const {
140 DCHECK(sender_ != nullptr); 142 DCHECK(sender_ != nullptr);
141 if (!max_pacing_rate_.IsZero()) { 143 if (!max_pacing_rate_.IsZero()) {
142 return QuicBandwidth::FromBitsPerSecond( 144 return QuicBandwidth::FromBitsPerSecond(
143 std::min(max_pacing_rate_.ToBitsPerSecond(), 145 std::min(max_pacing_rate_.ToBitsPerSecond(),
144 sender_->PacingRate(bytes_in_flight).ToBitsPerSecond())); 146 sender_->PacingRate(bytes_in_flight).ToBitsPerSecond()));
145 } 147 }
146 return sender_->PacingRate(bytes_in_flight); 148 return sender_->PacingRate(bytes_in_flight);
147 } 149 }
148 150
149 } // namespace net 151 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/hybrid_slow_start_test.cc ('k') | net/quic/core/congestion_control/pacing_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698