Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: net/quic/congestion_control/cubic.h

Issue 182523002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed rch's comments in Patch set 1 of CL 181463007 Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/net.gyp ('k') | net/quic/congestion_control/cubic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/quic/quic_clock.h" 13 #include "net/quic/quic_clock.h"
14 #include "net/quic/quic_connection_stats.h"
14 #include "net/quic/quic_time.h" 15 #include "net/quic/quic_time.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 // TCP congestion window in QUIC is in packets, not bytes. 19 // TCP congestion window in QUIC is in packets, not bytes.
19 typedef uint32 QuicTcpCongestionWindow; 20 typedef uint32 QuicTcpCongestionWindow;
20 21
21 class NET_EXPORT_PRIVATE Cubic { 22 class NET_EXPORT_PRIVATE Cubic {
22 public: 23 public:
23 explicit Cubic(const QuicClock* clock); 24 Cubic(const QuicClock* clock, QuicConnectionStats* stats);
24 25
25 // Call after a timeout to reset the cubic state. 26 // Call after a timeout to reset the cubic state.
26 void Reset(); 27 void Reset();
27 28
28 // Compute a new congestion window to use after a loss event. 29 // Compute a new congestion window to use after a loss event.
29 // Returns the new congestion window in packets. The new congestion window is 30 // Returns the new congestion window in packets. The new congestion window is
30 // a multiplicative decrease of our current window. 31 // a multiplicative decrease of our current window.
31 QuicTcpCongestionWindow CongestionWindowAfterPacketLoss( 32 QuicTcpCongestionWindow CongestionWindowAfterPacketLoss(
32 QuicTcpCongestionWindow current); 33 QuicTcpCongestionWindow current);
33 34
34 // Compute a new congestion window to use after a received ACK. 35 // Compute a new congestion window to use after a received ACK.
35 // Returns the new congestion window in packets. The new congestion window 36 // Returns the new congestion window in packets. The new congestion window
36 // follows a cubic function that depends on the time passed since last 37 // follows a cubic function that depends on the time passed since last
37 // packet loss. 38 // packet loss.
38 QuicTcpCongestionWindow CongestionWindowAfterAck( 39 QuicTcpCongestionWindow CongestionWindowAfterAck(
39 QuicTcpCongestionWindow current, 40 QuicTcpCongestionWindow current,
40 QuicTime::Delta delay_min); 41 QuicTime::Delta delay_min);
41 42
42 private: 43 private:
43 static const QuicTime::Delta MaxCubicTimeInterval() { 44 static const QuicTime::Delta MaxCubicTimeInterval() {
44 return QuicTime::Delta::FromMilliseconds(30); 45 return QuicTime::Delta::FromMilliseconds(30);
45 } 46 }
46 47
48 // Update congestion control variables in QuicConnectionStats.
49 void UpdateCongestionControlStats(QuicTcpCongestionWindow new_cubic_mode_cwnd,
50 QuicTcpCongestionWindow new_reno_mode_cwnd);
47 const QuicClock* clock_; 51 const QuicClock* clock_;
48 52
49 // Time when this cycle started, after last loss event. 53 // Time when this cycle started, after last loss event.
50 QuicTime epoch_; 54 QuicTime epoch_;
51 55
52 // Time when we updated last_congestion_window. 56 // Time when we updated last_congestion_window.
53 QuicTime last_update_time_; 57 QuicTime last_update_time_;
54 58
55 // Last congestion window (in packets) used. 59 // Last congestion window (in packets) used.
56 QuicTcpCongestionWindow last_congestion_window_; 60 QuicTcpCongestionWindow last_congestion_window_;
(...skipping 11 matching lines...) Expand all
68 72
69 // Origin point of cubic function. 73 // Origin point of cubic function.
70 QuicTcpCongestionWindow origin_point_congestion_window_; 74 QuicTcpCongestionWindow origin_point_congestion_window_;
71 75
72 // Time to origin point of cubic function in 2^10 fractions of a second. 76 // Time to origin point of cubic function in 2^10 fractions of a second.
73 uint32 time_to_origin_point_; 77 uint32 time_to_origin_point_;
74 78
75 // Last congestion window in packets computed by cubic function. 79 // Last congestion window in packets computed by cubic function.
76 QuicTcpCongestionWindow last_target_congestion_window_; 80 QuicTcpCongestionWindow last_target_congestion_window_;
77 81
82 // QuicConnectionStats includes congestion control related stats.
83 QuicConnectionStats* stats_;
84
78 DISALLOW_COPY_AND_ASSIGN(Cubic); 85 DISALLOW_COPY_AND_ASSIGN(Cubic);
79 }; 86 };
80 87
81 } // namespace net 88 } // namespace net
82 89
83 #endif // NET_QUIC_CONGESTION_CONTROL_CUBIC_H_ 90 #endif // NET_QUIC_CONGESTION_CONTROL_CUBIC_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/quic/congestion_control/cubic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698