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

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

Issue 198303004: Adds a varz variable to track the fraction of times we end up in cubic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/congestion_control/cubic_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cubic.h" 5 #include "net/quic/congestion_control/cubic.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 acked_packets_count_ = 0; 66 acked_packets_count_ = 0;
67 estimated_tcp_congestion_window_ = 0; 67 estimated_tcp_congestion_window_ = 0;
68 origin_point_congestion_window_ = 0; 68 origin_point_congestion_window_ = 0;
69 time_to_origin_point_ = 0; 69 time_to_origin_point_ = 0;
70 last_target_congestion_window_ = 0; 70 last_target_congestion_window_ = 0;
71 } 71 }
72 72
73 void Cubic::UpdateCongestionControlStats( 73 void Cubic::UpdateCongestionControlStats(
74 QuicTcpCongestionWindow new_cubic_mode_cwnd, 74 QuicTcpCongestionWindow new_cubic_mode_cwnd,
75 QuicTcpCongestionWindow new_reno_mode_cwnd) { 75 QuicTcpCongestionWindow new_reno_mode_cwnd) {
76 if (last_congestion_window_ < new_cubic_mode_cwnd) { 76
77 // Congestion window will increase in cubic mode. 77 QuicTcpCongestionWindow highest_new_cwnd = std::max(new_cubic_mode_cwnd,
78 stats_->cwnd_increase_cubic_mode += new_cubic_mode_cwnd - 78 new_reno_mode_cwnd);
79 last_congestion_window_; 79 if (last_congestion_window_ < highest_new_cwnd) {
80 if (new_cubic_mode_cwnd <= new_reno_mode_cwnd) { 80 // cwnd will increase to highest_new_cwnd.
81 // Congestion window increase in reno mode is higher or equal to cubic 81 stats_->cwnd_increase_congestion_avoidance +=
82 // mode's increase. 82 highest_new_cwnd - last_congestion_window_;
83 stats_->cwnd_increase_reno_mode += new_reno_mode_cwnd - 83 if (new_cubic_mode_cwnd > new_reno_mode_cwnd) {
84 last_congestion_window_; 84 // This cwnd increase is due to cubic mode.
85 stats_->cwnd_increase_cubic_mode +=
86 new_cubic_mode_cwnd - last_congestion_window_;
85 } 87 }
86 } else if (last_congestion_window_ < new_reno_mode_cwnd) {
87 // No cwnd increase in cubic mode, but cwnd will increase in reno mode.
88 stats_->cwnd_increase_reno_mode += new_reno_mode_cwnd -
89 last_congestion_window_;
90 } 88 }
91 } 89 }
92 90
93 QuicTcpCongestionWindow Cubic::CongestionWindowAfterPacketLoss( 91 QuicTcpCongestionWindow Cubic::CongestionWindowAfterPacketLoss(
94 QuicTcpCongestionWindow current_congestion_window) { 92 QuicTcpCongestionWindow current_congestion_window) {
95 if (current_congestion_window < last_max_congestion_window_) { 93 if (current_congestion_window < last_max_congestion_window_) {
96 // We never reached the old max, so assume we are competing with another 94 // We never reached the old max, so assume we are competing with another
97 // flow. Use our extra back off factor to allow the other flow to go up. 95 // flow. Use our extra back off factor to allow the other flow to go up.
98 last_max_congestion_window_ = 96 last_max_congestion_window_ =
99 static_cast<int>(kBetaLastMax * current_congestion_window); 97 static_cast<int>(kBetaLastMax * current_congestion_window);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // congestion_window, use highest (fastest). 174 // congestion_window, use highest (fastest).
177 if (target_congestion_window < estimated_tcp_congestion_window_) { 175 if (target_congestion_window < estimated_tcp_congestion_window_) {
178 target_congestion_window = estimated_tcp_congestion_window_; 176 target_congestion_window = estimated_tcp_congestion_window_;
179 } 177 }
180 178
181 DVLOG(1) << "Target congestion_window: " << target_congestion_window; 179 DVLOG(1) << "Target congestion_window: " << target_congestion_window;
182 return target_congestion_window; 180 return target_congestion_window;
183 } 181 }
184 182
185 } // namespace net 183 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698