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

Unified Diff: net/quic/congestion_control/cubic.cc

Issue 182523002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed rch's comments in Patch set 1 of CL 181463007 Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/cubic.h ('k') | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/cubic.cc
diff --git a/net/quic/congestion_control/cubic.cc b/net/quic/congestion_control/cubic.cc
index bb21e3cee448658de7a7c4af0c056e25cabcfd5d..301512c894fb28d0569e11a9736443a669a14b84 100644
--- a/net/quic/congestion_control/cubic.cc
+++ b/net/quic/congestion_control/cubic.cc
@@ -17,6 +17,7 @@ using std::max;
namespace net {
namespace {
+
// Constants based on TCP defaults.
// The following constants are in 2^10 fractions of a second instead of ms to
// allow a 10 shift right to divide.
@@ -46,12 +47,14 @@ const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections *
(1 - kNConnectionBeta) / (1 + kNConnectionBeta);
// TODO(jri): Compute kNConnectionBeta and kNConnectionAlpha from
// number of active streams.
+
} // namespace
-Cubic::Cubic(const QuicClock* clock)
+Cubic::Cubic(const QuicClock* clock, QuicConnectionStats* stats)
: clock_(clock),
epoch_(QuicTime::Zero()),
- last_update_time_(QuicTime::Zero()) {
+ last_update_time_(QuicTime::Zero()),
+ stats_(stats) {
Reset();
}
@@ -67,6 +70,26 @@ void Cubic::Reset() {
last_target_congestion_window_ = 0;
}
+void Cubic::UpdateCongestionControlStats(
+ QuicTcpCongestionWindow new_cubic_mode_cwnd,
+ QuicTcpCongestionWindow new_reno_mode_cwnd) {
+ if (last_congestion_window_ < new_cubic_mode_cwnd) {
+ // Congestion window will increase in cubic mode.
+ stats_->cwnd_increase_cubic_mode += new_cubic_mode_cwnd -
+ last_congestion_window_;
+ if (new_cubic_mode_cwnd <= new_reno_mode_cwnd) {
+ // Congestion window increase in reno mode is higher or equal to cubic
+ // mode's increase.
+ stats_->cwnd_increase_reno_mode += new_reno_mode_cwnd -
+ last_congestion_window_;
+ }
+ } else if (last_congestion_window_ < new_reno_mode_cwnd) {
+ // No cwnd increase in cubic mode, but cwnd will increase in reno mode.
+ stats_->cwnd_increase_reno_mode += new_reno_mode_cwnd -
+ last_congestion_window_;
+ }
+}
+
QuicTcpCongestionWindow Cubic::CongestionWindowAfterPacketLoss(
QuicTcpCongestionWindow current_congestion_window) {
if (current_congestion_window < last_max_congestion_window_) {
@@ -127,9 +150,6 @@ QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck(
QuicTcpCongestionWindow target_congestion_window =
origin_point_congestion_window_ - delta_congestion_window;
- // We have a new cubic congestion window.
- last_target_congestion_window_ = target_congestion_window;
-
DCHECK_LT(0u, estimated_tcp_congestion_window_);
// With dynamic beta/alpha based on number of active streams, it is possible
// for the required_ack_count to become much lower than acked_packets_count_
@@ -145,12 +165,20 @@ QuicTcpCongestionWindow Cubic::CongestionWindowAfterAck(
estimated_tcp_congestion_window_++;
}
+ // Update cubic mode and reno mode stats in QuicConnectionStats.
+ UpdateCongestionControlStats(target_congestion_window,
+ estimated_tcp_congestion_window_);
+
+ // We have a new cubic congestion window.
+ last_target_congestion_window_ = target_congestion_window;
+
// Compute target congestion_window based on cubic target and estimated TCP
// congestion_window, use highest (fastest).
if (target_congestion_window < estimated_tcp_congestion_window_) {
target_congestion_window = estimated_tcp_congestion_window_;
}
- DVLOG(1) << "Target congestion_window:" << target_congestion_window;
+
+ DVLOG(1) << "Target congestion_window: " << target_congestion_window;
return target_congestion_window;
}
« no previous file with comments | « net/quic/congestion_control/cubic.h ('k') | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698