| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_bytes.h" | 5 #include "net/quic/core/congestion_control/cubic_bytes.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } else { | 110 } else { |
| 111 last_max_congestion_window_ = current_congestion_window; | 111 last_max_congestion_window_ = current_congestion_window; |
| 112 } | 112 } |
| 113 epoch_ = QuicTime::Zero(); // Reset time. | 113 epoch_ = QuicTime::Zero(); // Reset time. |
| 114 return static_cast<int>(current_congestion_window * Beta()); | 114 return static_cast<int>(current_congestion_window * Beta()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 QuicByteCount CubicBytes::CongestionWindowAfterAck( | 117 QuicByteCount CubicBytes::CongestionWindowAfterAck( |
| 118 QuicByteCount acked_bytes, | 118 QuicByteCount acked_bytes, |
| 119 QuicByteCount current_congestion_window, | 119 QuicByteCount current_congestion_window, |
| 120 QuicTime::Delta delay_min) { | 120 QuicTime::Delta delay_min, |
| 121 QuicTime event_time) { |
| 121 acked_bytes_count_ += acked_bytes; | 122 acked_bytes_count_ += acked_bytes; |
| 122 QuicTime current_time = clock_->ApproximateNow(); | 123 QuicTime current_time = FLAGS_quic_use_event_time |
| 124 ? event_time |
| 125 : clock_->ApproximateNow(); |
| 123 | 126 |
| 124 // Cubic is "independent" of RTT, the update is limited by the time elapsed. | 127 // Cubic is "independent" of RTT, the update is limited by the time elapsed. |
| 125 if (last_congestion_window_ == current_congestion_window && | 128 if (last_congestion_window_ == current_congestion_window && |
| 126 (current_time - last_update_time_ <= MaxCubicTimeInterval())) { | 129 (current_time - last_update_time_ <= MaxCubicTimeInterval())) { |
| 127 return std::max(last_target_congestion_window_, | 130 return std::max(last_target_congestion_window_, |
| 128 estimated_tcp_congestion_window_); | 131 estimated_tcp_congestion_window_); |
| 129 } | 132 } |
| 130 last_congestion_window_ = current_congestion_window; | 133 last_congestion_window_ = current_congestion_window; |
| 131 last_update_time_ = current_time; | 134 last_update_time_ = current_time; |
| 132 | 135 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // congestion_window, use highest (fastest). | 205 // congestion_window, use highest (fastest). |
| 203 if (target_congestion_window < estimated_tcp_congestion_window_) { | 206 if (target_congestion_window < estimated_tcp_congestion_window_) { |
| 204 target_congestion_window = estimated_tcp_congestion_window_; | 207 target_congestion_window = estimated_tcp_congestion_window_; |
| 205 } | 208 } |
| 206 | 209 |
| 207 DVLOG(1) << "Final target congestion_window: " << target_congestion_window; | 210 DVLOG(1) << "Final target congestion_window: " << target_congestion_window; |
| 208 return target_congestion_window; | 211 return target_congestion_window; |
| 209 } | 212 } |
| 210 | 213 |
| 211 } // namespace net | 214 } // namespace net |
| OLD | NEW |