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

Side by Side Diff: net/base/network_quality.h

Issue 1164713004: Store network quality samples so we can compute percentiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added RingBuffer class Created 5 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_BASE_NETWORK_QUALITY_H_ 5 #ifndef NET_BASE_NETWORK_QUALITY_H_
6 #define NET_BASE_NETWORK_QUALITY_H_ 6 #define NET_BASE_NETWORK_QUALITY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 11
12 namespace {
13
14 // If two double values are within |kDelta| of each other, they are assumed to
15 // be equal.
16 const double kDelta = 0.001;
17
18 } // namespace
19
12 namespace net { 20 namespace net {
13 21
14 // API that is used to report the current network quality as estimated by the 22 // API that is used to report the current network quality as estimated by the
15 // NetworkQualityEstimator. 23 // NetworkQualityEstimator.
24 // |rtt| is the estimate of the round trip time for the current connection.
25 // |rtt_confidence| is the confidence of the |rtt| estimate.
26 // |throughput_kbps| is the estimate of the Kbps for the current connection.
27 // |throughput_kbps_confidence| is the confidence of the |throughput_kbps|
28 // estimate.
16 struct NET_EXPORT_PRIVATE NetworkQuality { 29 struct NET_EXPORT_PRIVATE NetworkQuality {
17 NetworkQuality(const base::TimeDelta& fastest_rtt, 30 NetworkQuality(const base::TimeDelta& rtt,
18 double fastest_rtt_confidence, 31 double rtt_confidence,
19 uint64_t peak_throughput_kbps, 32 uint64_t throughput_kbps,
20 double peak_throughput_kbps_confidence) 33 double throughput_kbps_confidence)
21 : fastest_rtt(fastest_rtt), 34 : rtt(rtt),
22 fastest_rtt_confidence(fastest_rtt_confidence), 35 rtt_confidence(rtt_confidence),
23 peak_throughput_kbps(peak_throughput_kbps), 36 throughput_kbps(throughput_kbps),
24 peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} 37 throughput_kbps_confidence(throughput_kbps_confidence) {
38 DCHECK_GE(rtt, base::TimeDelta());
39 DCHECK_GE(rtt_confidence, 0 - kDelta);
40 DCHECK_LE(rtt_confidence, 1 + kDelta);
41
42 DCHECK_GE(throughput_kbps, 0U);
43 DCHECK_GE(throughput_kbps_confidence, 0 - kDelta);
44 DCHECK_LE(throughput_kbps_confidence, 1 + kDelta);
mmenke 2015/06/03 18:31:39 Need base/logging.h (Which is weird to include in
tbansal1 2015/06/05 01:50:08 Done.
45 }
mmenke 2015/06/03 18:31:39 De-inline this constructor. Inline constructors s
tbansal1 2015/06/05 01:50:08 Done.
25 46
26 ~NetworkQuality() {} 47 ~NetworkQuality() {}
27 48
28 // The fastest round trip time observed for the current connection. 49 // The round trip time observed for the current connection.
29 const base::TimeDelta fastest_rtt; 50 const base::TimeDelta rtt;
30 51
31 // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 52 // Confidence of the |rtt| estimate. Value lies between 0.0 and 1.0
32 // with 0.0 being no confidence and 1.0 implying that estimates are same as 53 // with 0.0 being no confidence and 1.0 implying that estimates are same as
33 // ground truth. 54 // ground truth.
34 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are 55 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are
35 // meaningful. 56 // meaningful.
36 const double fastest_rtt_confidence; 57 const double rtt_confidence;
37 58
38 // Peak throughput in Kbps observed for the current connection. 59 // Throughput in Kbps observed for the current connection.
39 const uint64_t peak_throughput_kbps; 60 const uint64_t throughput_kbps;
40 61
41 // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 62 // Confidence of the |throughput_kbps| estimate. Value lies between 0.0
42 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are 63 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are
43 // same as ground truth. 64 // same as ground truth.
44 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are 65 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are
45 // meaningful. 66 // meaningful.
46 const double peak_throughput_kbps_confidence; 67 const double throughput_kbps_confidence;
47 }; 68 };
48 69
49 } // namespace net 70 } // namespace net
50 71
51 #endif // NET_BASE_NETWORK_QUALITY_H_ 72 #endif // NET_BASE_NETWORK_QUALITY_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/network_quality_estimator.h » ('j') | net/base/network_quality_estimator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698