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

Side by Side Diff: net/quic/quic_sustained_bandwidth_recorder.h

Issue 479443002: Not used in production. Add InRecovery() method to QUIC send algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Add_flag_to_enable_BBR_73146298
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 #ifndef NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ 5 #ifndef NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_
6 #define NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ 6 #define NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/quic/quic_bandwidth.h" 9 #include "net/quic/quic_bandwidth.h"
10 #include "net/quic/quic_time.h" 10 #include "net/quic/quic_time.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 // This class keeps track of a sustained bandwidth estimate to ultimately send 14 // This class keeps track of a sustained bandwidth estimate to ultimately send
15 // to the client in a server config update message. A sustained bandwidth 15 // to the client in a server config update message. A sustained bandwidth
16 // estimate is only marked as valid if the QuicSustainedBandwidthRecorder has 16 // estimate is only marked as valid if the QuicSustainedBandwidthRecorder has
17 // been given uninterrupted reliable estimates over a certain period of time. 17 // been given uninterrupted reliable estimates over a certain period of time.
18 class NET_EXPORT_PRIVATE QuicSustainedBandwidthRecorder { 18 class NET_EXPORT_PRIVATE QuicSustainedBandwidthRecorder {
19 public: 19 public:
20 QuicSustainedBandwidthRecorder(); 20 QuicSustainedBandwidthRecorder();
21 21
22 // As long as |is_reliable_estimate| is consistently true, multiple calls to 22 // As long as |is_reliable_estimate| is consistently true, multiple calls to
23 // this method over a 3 * srtt period results in storage of a valid sustained 23 // this method over a 3 * srtt period results in storage of a valid sustained
24 // bandwidth estimate. 24 // bandwidth estimate.
25 // |time_now| is used as a max bandwidth timestamp if needed. 25 // |time_now| is used as a max bandwidth timestamp if needed.
26 void RecordEstimate(bool is_reliable_estimate, 26 void RecordEstimate(bool is_reliable_estimate,
27 bool in_slow_start,
27 QuicBandwidth bandwidth, 28 QuicBandwidth bandwidth,
28 QuicTime estimate_time, 29 QuicTime estimate_time,
29 QuicWallTime wall_time, 30 QuicWallTime wall_time,
30 QuicTime::Delta srtt); 31 QuicTime::Delta srtt);
31 32
32 bool HasEstimate() const { 33 bool HasEstimate() const {
33 return has_estimate_; 34 return has_estimate_;
34 } 35 }
35 36
36 QuicBandwidth BandwidthEstimate() const { 37 QuicBandwidth BandwidthEstimate() const {
37 DCHECK(has_estimate_); 38 DCHECK(has_estimate_);
38 return bandwidth_estimate_; 39 return bandwidth_estimate_;
39 } 40 }
40 41
41 QuicBandwidth MaxBandwidthEstimate() const { 42 QuicBandwidth MaxBandwidthEstimate() const {
42 DCHECK(has_estimate_); 43 DCHECK(has_estimate_);
43 return max_bandwidth_estimate_; 44 return max_bandwidth_estimate_;
44 } 45 }
45 46
46 int32 MaxBandwidthTimestamp() const { 47 int32 MaxBandwidthTimestamp() const {
47 DCHECK(has_estimate_); 48 DCHECK(has_estimate_);
48 return max_bandwidth_timestamp_; 49 return max_bandwidth_timestamp_;
49 } 50 }
50 51
52 bool EstimateRecordedDuringSlowStart() const {
53 DCHECK(has_estimate_);
54 return bandwidth_estimate_recorded_during_slow_start_;
55 }
56
51 private: 57 private:
52 // True if we have been able to calculate sustained bandwidth, over at least 58 // True if we have been able to calculate sustained bandwidth, over at least
53 // one recording period (3 * rtt). 59 // one recording period (3 * rtt).
54 bool has_estimate_; 60 bool has_estimate_;
55 61
56 // True if the last call to RecordEstimate had a reliable estimate. 62 // True if the last call to RecordEstimate had a reliable estimate.
57 bool is_recording_; 63 bool is_recording_;
58 64
65 // True if the current sustained bandwidth estimate was generated while in
66 // slow start.
67 bool bandwidth_estimate_recorded_during_slow_start_;
68
59 // The latest sustained bandwidth estimate. 69 // The latest sustained bandwidth estimate.
60 QuicBandwidth bandwidth_estimate_; 70 QuicBandwidth bandwidth_estimate_;
61 71
62 // The maximum sustained bandwidth seen over the lifetime of the connection. 72 // The maximum sustained bandwidth seen over the lifetime of the connection.
63 QuicBandwidth max_bandwidth_estimate_; 73 QuicBandwidth max_bandwidth_estimate_;
64 74
65 // Timestamp indicating when the max_bandwidth_estimate_ was seen. 75 // Timestamp indicating when the max_bandwidth_estimate_ was seen.
66 int32 max_bandwidth_timestamp_; 76 int32 max_bandwidth_timestamp_;
67 77
68 // Timestamp marking the beginning of the latest recording period. 78 // Timestamp marking the beginning of the latest recording period.
69 QuicTime start_time_; 79 QuicTime start_time_;
70 80
71 DISALLOW_COPY_AND_ASSIGN(QuicSustainedBandwidthRecorder); 81 DISALLOW_COPY_AND_ASSIGN(QuicSustainedBandwidthRecorder);
72 }; 82 };
73 83
74 } // namespace net 84 } // namespace net
75 85
76 #endif // NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ 86 #endif // NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.h ('k') | net/quic/quic_sustained_bandwidth_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698