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