| OLD | NEW |
| 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/core/congestion_control/cubic.h" | 5 #include "net/quic/core/congestion_control/cubic.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 static_cast<int>(kBetaLastMax * current_congestion_window); | 99 static_cast<int>(kBetaLastMax * current_congestion_window); |
| 100 } else { | 100 } else { |
| 101 last_max_congestion_window_ = current_congestion_window; | 101 last_max_congestion_window_ = current_congestion_window; |
| 102 } | 102 } |
| 103 epoch_ = QuicTime::Zero(); // Reset time. | 103 epoch_ = QuicTime::Zero(); // Reset time. |
| 104 return static_cast<int>(current_congestion_window * Beta()); | 104 return static_cast<int>(current_congestion_window * Beta()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 QuicPacketCount Cubic::CongestionWindowAfterAck( | 107 QuicPacketCount Cubic::CongestionWindowAfterAck( |
| 108 QuicPacketCount current_congestion_window, | 108 QuicPacketCount current_congestion_window, |
| 109 QuicTime::Delta delay_min) { | 109 QuicTime::Delta delay_min, |
| 110 QuicTime event_time) { |
| 110 acked_packets_count_ += 1; // Packets acked. | 111 acked_packets_count_ += 1; // Packets acked. |
| 111 epoch_packets_count_ += 1; | 112 epoch_packets_count_ += 1; |
| 112 QuicTime current_time = clock_->ApproximateNow(); | 113 QuicTime current_time = FLAGS_quic_use_event_time |
| 114 ? event_time |
| 115 : clock_->ApproximateNow(); |
| 113 | 116 |
| 114 // Cubic is "independent" of RTT, the update is limited by the time elapsed. | 117 // Cubic is "independent" of RTT, the update is limited by the time elapsed. |
| 115 if (last_congestion_window_ == current_congestion_window && | 118 if (last_congestion_window_ == current_congestion_window && |
| 116 (current_time - last_update_time_ <= MaxCubicTimeInterval())) { | 119 (current_time - last_update_time_ <= MaxCubicTimeInterval())) { |
| 117 return std::max(last_target_congestion_window_, | 120 return std::max(last_target_congestion_window_, |
| 118 estimated_tcp_congestion_window_); | 121 estimated_tcp_congestion_window_); |
| 119 } | 122 } |
| 120 last_congestion_window_ = current_congestion_window; | 123 last_congestion_window_ = current_congestion_window; |
| 121 last_update_time_ = current_time; | 124 last_update_time_ = current_time; |
| 122 | 125 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // congestion_window, use highest (fastest). | 197 // congestion_window, use highest (fastest). |
| 195 if (target_congestion_window < estimated_tcp_congestion_window_) { | 198 if (target_congestion_window < estimated_tcp_congestion_window_) { |
| 196 target_congestion_window = estimated_tcp_congestion_window_; | 199 target_congestion_window = estimated_tcp_congestion_window_; |
| 197 } | 200 } |
| 198 | 201 |
| 199 DVLOG(1) << "Final target congestion_window: " << target_congestion_window; | 202 DVLOG(1) << "Final target congestion_window: " << target_congestion_window; |
| 200 return target_congestion_window; | 203 return target_congestion_window; |
| 201 } | 204 } |
| 202 | 205 |
| 203 } // namespace net | 206 } // namespace net |
| OLD | NEW |