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/congestion_control/cubic.h" | 5 #include "net/quic/congestion_control/cubic.h" |
6 | 6 |
| 7 #include <stdint.h> |
7 #include <algorithm> | 8 #include <algorithm> |
8 #include <cmath> | 9 #include <cmath> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "net/quic/quic_flags.h" | 13 #include "net/quic/quic_flags.h" |
13 #include "net/quic/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
14 #include "net/quic/quic_time.h" | 15 #include "net/quic/quic_time.h" |
15 | 16 |
16 using std::max; | 17 using std::max; |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Constants based on TCP defaults. | 23 // Constants based on TCP defaults. |
23 // The following constants are in 2^10 fractions of a second instead of ms to | 24 // The following constants are in 2^10 fractions of a second instead of ms to |
24 // allow a 10 shift right to divide. | 25 // allow a 10 shift right to divide. |
25 const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3) | 26 const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3) |
26 // where 0.100 is 100 ms which is the scaling | 27 // where 0.100 is 100 ms which is the scaling |
27 // round trip time. | 28 // round trip time. |
28 const int kCubeCongestionWindowScale = 410; | 29 const int kCubeCongestionWindowScale = 410; |
29 const uint64 kCubeFactor = (GG_UINT64_C(1) << kCubeScale) / | 30 const uint64 kCubeFactor = (UINT64_C(1) << kCubeScale) / |
30 kCubeCongestionWindowScale; | 31 kCubeCongestionWindowScale; |
31 | 32 |
32 const uint32 kDefaultNumConnections = 2; | 33 const uint32 kDefaultNumConnections = 2; |
33 const float kBeta = 0.7f; // Default Cubic backoff factor. | 34 const float kBeta = 0.7f; // Default Cubic backoff factor. |
34 // Additional backoff factor when loss occurs in the concave part of the Cubic | 35 // Additional backoff factor when loss occurs in the concave part of the Cubic |
35 // curve. This additional backoff factor is expected to give up bandwidth to | 36 // curve. This additional backoff factor is expected to give up bandwidth to |
36 // new concurrent flows and speed up convergence. | 37 // new concurrent flows and speed up convergence. |
37 const float kBetaLastMax = 0.85f; | 38 const float kBetaLastMax = 0.85f; |
38 | 39 |
39 } // namespace | 40 } // namespace |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // congestion_window, use highest (fastest). | 161 // congestion_window, use highest (fastest). |
161 if (target_congestion_window < estimated_tcp_congestion_window_) { | 162 if (target_congestion_window < estimated_tcp_congestion_window_) { |
162 target_congestion_window = estimated_tcp_congestion_window_; | 163 target_congestion_window = estimated_tcp_congestion_window_; |
163 } | 164 } |
164 | 165 |
165 DVLOG(1) << "Target congestion_window: " << target_congestion_window; | 166 DVLOG(1) << "Target congestion_window: " << target_congestion_window; |
166 return target_congestion_window; | 167 return target_congestion_window; |
167 } | 168 } |
168 | 169 |
169 } // namespace net | 170 } // namespace net |
OLD | NEW |