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

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

Issue 497553004: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with TOT 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "net/quic/quic_sustained_bandwidth_recorder.h" 5 #include "net/quic/quic_sustained_bandwidth_recorder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/quic_bandwidth.h" 8 #include "net/quic/quic_bandwidth.h"
9 #include "net/quic/quic_time.h" 9 #include "net/quic/quic_time.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 QuicSustainedBandwidthRecorder::QuicSustainedBandwidthRecorder() 13 QuicSustainedBandwidthRecorder::QuicSustainedBandwidthRecorder()
14 : has_estimate_(false), 14 : has_estimate_(false),
15 is_recording_(false), 15 is_recording_(false),
16 bandwidth_estimate_recorded_during_slow_start_(false), 16 bandwidth_estimate_recorded_during_slow_start_(false),
17 bandwidth_estimate_(QuicBandwidth::Zero()), 17 bandwidth_estimate_(QuicBandwidth::Zero()),
18 max_bandwidth_estimate_(QuicBandwidth::Zero()), 18 max_bandwidth_estimate_(QuicBandwidth::Zero()),
19 max_bandwidth_timestamp_(0), 19 max_bandwidth_timestamp_(0),
20 start_time_(QuicTime::Zero()) {} 20 start_time_(QuicTime::Zero()) {}
21 21
22 void QuicSustainedBandwidthRecorder::RecordEstimate(bool is_reliable_estimate, 22 void QuicSustainedBandwidthRecorder::RecordEstimate(bool in_recovery,
23 bool in_slow_start, 23 bool in_slow_start,
24 QuicBandwidth bandwidth, 24 QuicBandwidth bandwidth,
25 QuicTime estimate_time, 25 QuicTime estimate_time,
26 QuicWallTime wall_time, 26 QuicWallTime wall_time,
27 QuicTime::Delta srtt) { 27 QuicTime::Delta srtt) {
28 if (!is_reliable_estimate) { 28 if (in_recovery) {
29 is_recording_ = false; 29 is_recording_ = false;
30 DVLOG(1) << "Stopped recording due to unreliable estimate at: " 30 DVLOG(1) << "Stopped recording at: " << estimate_time.ToDebuggingValue();
31 << estimate_time.ToDebuggingValue();
32 return; 31 return;
33 } 32 }
34 33
35 if (!is_recording_) { 34 if (!is_recording_) {
36 // This is the first estimate of a new recording period. 35 // This is the first estimate of a new recording period.
37 start_time_ = estimate_time; 36 start_time_ = estimate_time;
38 is_recording_ = true; 37 is_recording_ = true;
39 DVLOG(1) << "Started recording at: " << start_time_.ToDebuggingValue(); 38 DVLOG(1) << "Started recording at: " << start_time_.ToDebuggingValue();
40 return; 39 return;
41 } 40 }
(...skipping 11 matching lines...) Expand all
53 // Check for an increase in max bandwidth. 52 // Check for an increase in max bandwidth.
54 if (bandwidth > max_bandwidth_estimate_) { 53 if (bandwidth > max_bandwidth_estimate_) {
55 max_bandwidth_estimate_ = bandwidth; 54 max_bandwidth_estimate_ = bandwidth;
56 max_bandwidth_timestamp_ = wall_time.ToUNIXSeconds(); 55 max_bandwidth_timestamp_ = wall_time.ToUNIXSeconds();
57 DVLOG(1) << "New max bandwidth estimate (KBytes/s): " 56 DVLOG(1) << "New max bandwidth estimate (KBytes/s): "
58 << max_bandwidth_estimate_.ToKBytesPerSecond(); 57 << max_bandwidth_estimate_.ToKBytesPerSecond();
59 } 58 }
60 } 59 }
61 60
62 } // namespace net 61 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sustained_bandwidth_recorder.h ('k') | net/quic/quic_sustained_bandwidth_recorder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698