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

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

Issue 2132623002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing comment about RPCs Created 4 years, 5 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/quic_stream_sequencer.cc ('k') | net/quic/quic_sustained_bandwidth_recorder_test.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 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
(...skipping 23 matching lines...) Expand all
34 if (!is_recording_) { 34 if (!is_recording_) {
35 // This is the first estimate of a new recording period. 35 // This is the first estimate of a new recording period.
36 start_time_ = estimate_time; 36 start_time_ = estimate_time;
37 is_recording_ = true; 37 is_recording_ = true;
38 DVLOG(1) << "Started recording at: " << start_time_.ToDebuggingValue(); 38 DVLOG(1) << "Started recording at: " << start_time_.ToDebuggingValue();
39 return; 39 return;
40 } 40 }
41 41
42 // If we have been recording for at least 3 * srtt, then record the latest 42 // If we have been recording for at least 3 * srtt, then record the latest
43 // bandwidth estimate as a valid sustained bandwidth estimate. 43 // bandwidth estimate as a valid sustained bandwidth estimate.
44 if (estimate_time.Subtract(start_time_) >= srtt.Multiply(3)) { 44 if (estimate_time - start_time_ >= 3 * srtt) {
45 has_estimate_ = true; 45 has_estimate_ = true;
46 bandwidth_estimate_recorded_during_slow_start_ = in_slow_start; 46 bandwidth_estimate_recorded_during_slow_start_ = in_slow_start;
47 bandwidth_estimate_ = bandwidth; 47 bandwidth_estimate_ = bandwidth;
48 DVLOG(1) << "New sustained bandwidth estimate (KBytes/s): " 48 DVLOG(1) << "New sustained bandwidth estimate (KBytes/s): "
49 << bandwidth_estimate_.ToKBytesPerSecond(); 49 << bandwidth_estimate_.ToKBytesPerSecond();
50 } 50 }
51 51
52 // Check for an increase in max bandwidth. 52 // Check for an increase in max bandwidth.
53 if (bandwidth > max_bandwidth_estimate_) { 53 if (bandwidth > max_bandwidth_estimate_) {
54 max_bandwidth_estimate_ = bandwidth; 54 max_bandwidth_estimate_ = bandwidth;
55 max_bandwidth_timestamp_ = wall_time.ToUNIXSeconds(); 55 max_bandwidth_timestamp_ = wall_time.ToUNIXSeconds();
56 DVLOG(1) << "New max bandwidth estimate (KBytes/s): " 56 DVLOG(1) << "New max bandwidth estimate (KBytes/s): "
57 << max_bandwidth_estimate_.ToKBytesPerSecond(); 57 << max_bandwidth_estimate_.ToKBytesPerSecond();
58 } 58 }
59 } 59 }
60 60
61 } // namespace net 61 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_sequencer.cc ('k') | net/quic/quic_sustained_bandwidth_recorder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698