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

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

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 4 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
« no previous file with comments | « net/quic/chromium/quic_stream_factory_test.cc ('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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Cubic algorithm, helper class to TCP cubic.
6 // For details see http://netsrv.csc.ncsu.edu/export/cubic_a_new_tcp_2008.pdf.
7
8 #ifndef NET_QUIC_CONGESTION_CONTROL_CUBIC_H_
9 #define NET_QUIC_CONGESTION_CONTROL_CUBIC_H_
10
11 #include <stdint.h>
12
13 #include "base/macros.h"
14 #include "net/base/net_export.h"
15 #include "net/quic/quic_bandwidth.h"
16 #include "net/quic/quic_clock.h"
17 #include "net/quic/quic_connection_stats.h"
18 #include "net/quic/quic_time.h"
19
20 namespace net {
21
22 class NET_EXPORT_PRIVATE Cubic {
23 public:
24 explicit Cubic(const QuicClock* clock);
25
26 void SetNumConnections(int num_connections);
27
28 // Call after a timeout to reset the cubic state.
29 void Reset();
30
31 // Compute a new congestion window to use after a loss event.
32 // Returns the new congestion window in packets. The new congestion window is
33 // a multiplicative decrease of our current window.
34 QuicPacketCount CongestionWindowAfterPacketLoss(QuicPacketCount current);
35
36 // Compute a new congestion window to use after a received ACK.
37 // Returns the new congestion window in packets. The new congestion window
38 // follows a cubic function that depends on the time passed since last
39 // packet loss.
40 QuicPacketCount CongestionWindowAfterAck(QuicPacketCount current,
41 QuicTime::Delta delay_min);
42
43 // Call on ack arrival when sender is unable to use the available congestion
44 // window. Resets Cubic state during quiescence.
45 void OnApplicationLimited();
46
47 private:
48 static const QuicTime::Delta MaxCubicTimeInterval() {
49 return QuicTime::Delta::FromMilliseconds(30);
50 }
51
52 // Compute the TCP Cubic alpha and beta based on the current number of
53 // connections.
54 float Alpha() const;
55 float Beta() const;
56
57 const QuicClock* clock_;
58
59 // Number of connections to simulate.
60 int num_connections_;
61
62 // Time when this cycle started, after last loss event.
63 QuicTime epoch_;
64
65 // Time when sender went into application-limited period. Zero if not in
66 // application-limited period.
67 QuicTime app_limited_start_time_;
68
69 // Time when we updated last_congestion_window.
70 QuicTime last_update_time_;
71
72 // Last congestion window (in packets) used.
73 QuicPacketCount last_congestion_window_;
74
75 // Max congestion window (in packets) used just before last loss event.
76 // Note: to improve fairness to other streams an additional back off is
77 // applied to this value if the new value is below our latest value.
78 QuicPacketCount last_max_congestion_window_;
79
80 // Number of acked packets since the cycle started (epoch).
81 QuicPacketCount acked_packets_count_;
82
83 // TCP Reno equivalent congestion window in packets.
84 QuicPacketCount estimated_tcp_congestion_window_;
85
86 // Origin point of cubic function.
87 QuicPacketCount origin_point_congestion_window_;
88
89 // Time to origin point of cubic function in 2^10 fractions of a second.
90 uint32_t time_to_origin_point_;
91
92 // Last congestion window in packets computed by cubic function.
93 QuicPacketCount last_target_congestion_window_;
94
95 DISALLOW_COPY_AND_ASSIGN(Cubic);
96 };
97
98 } // namespace net
99
100 #endif // NET_QUIC_CONGESTION_CONTROL_CUBIC_H_
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_stream_factory_test.cc ('k') | net/quic/congestion_control/cubic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698