| 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 // Cubic algorithm, helper class to TCP cubic. | 5 // Cubic algorithm, helper class to TCP cubic. |
| 6 // For details see http://netsrv.csc.ncsu.edu/export/cubic_a_new_tcp_2008.pdf. | 6 // For details see http://netsrv.csc.ncsu.edu/export/cubic_a_new_tcp_2008.pdf. |
| 7 | 7 |
| 8 #ifndef NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ | 8 #ifndef NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ |
| 9 #define NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ | 9 #define NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 QuicTcpCongestionWindow current); | 32 QuicTcpCongestionWindow current); |
| 33 | 33 |
| 34 // Compute a new congestion window to use after a received ACK. | 34 // Compute a new congestion window to use after a received ACK. |
| 35 // Returns the new congestion window in packets. The new congestion window | 35 // Returns the new congestion window in packets. The new congestion window |
| 36 // follows a cubic function that depends on the time passed since last | 36 // follows a cubic function that depends on the time passed since last |
| 37 // packet loss. | 37 // packet loss. |
| 38 QuicTcpCongestionWindow CongestionWindowAfterAck( | 38 QuicTcpCongestionWindow CongestionWindowAfterAck( |
| 39 QuicTcpCongestionWindow current, | 39 QuicTcpCongestionWindow current, |
| 40 QuicTime::Delta delay_min); | 40 QuicTime::Delta delay_min); |
| 41 | 41 |
| 42 protected: | |
| 43 // Calculates the cubic root using a table lookup followed by one Newton- | |
| 44 // Raphson iteration. | |
| 45 uint32 CubeRoot(uint64 a); | |
| 46 | |
| 47 private: | 42 private: |
| 48 static const QuicTime::Delta MaxCubicTimeInterval() { | 43 static const QuicTime::Delta MaxCubicTimeInterval() { |
| 49 return QuicTime::Delta::FromMilliseconds(30); | 44 return QuicTime::Delta::FromMilliseconds(30); |
| 50 } | 45 } |
| 51 | 46 |
| 52 const QuicClock* clock_; | 47 const QuicClock* clock_; |
| 53 | 48 |
| 54 // Time when this cycle started, after last loss event. | 49 // Time when this cycle started, after last loss event. |
| 55 QuicTime epoch_; | 50 QuicTime epoch_; |
| 56 | 51 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 // Time to origin point of cubic function in 2^10 fractions of a second. | 72 // Time to origin point of cubic function in 2^10 fractions of a second. |
| 78 uint32 time_to_origin_point_; | 73 uint32 time_to_origin_point_; |
| 79 | 74 |
| 80 // Last congestion window in packets computed by cubic function. | 75 // Last congestion window in packets computed by cubic function. |
| 81 QuicTcpCongestionWindow last_target_congestion_window_; | 76 QuicTcpCongestionWindow last_target_congestion_window_; |
| 82 | 77 |
| 83 DISALLOW_COPY_AND_ASSIGN(Cubic); | 78 DISALLOW_COPY_AND_ASSIGN(Cubic); |
| 84 }; | 79 }; |
| 85 | 80 |
| 86 } // namespace net | 81 } // namespace net |
| 82 |
| 87 #endif // NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ | 83 #endif // NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ |
| OLD | NEW |