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

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: Addressed comments 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 #include "net/base/net_export.h"
11 12
12 namespace net { 13 namespace net {
13 14
14 // API that is used to report the current network quality as estimated by the 15 // API that is used to report the current network quality as estimated by the
15 // NetworkQualityEstimator. 16 // NetworkQualityEstimator.
16 struct NET_EXPORT_PRIVATE NetworkQuality { 17 class NET_EXPORT_PRIVATE NetworkQuality {
17 NetworkQuality(const base::TimeDelta& fastest_rtt, 18 public:
18 double fastest_rtt_confidence, 19 // |rtt| is the estimate of the round trip time for the current connection.
19 uint64_t peak_throughput_kbps, 20 // |downlink_throughput_kbps| is the estimate of the downlink throughput for
20 double peak_throughput_kbps_confidence) 21 // the current connection.
21 : fastest_rtt(fastest_rtt), 22 // |confidence| is the confidence of the estimates.
22 fastest_rtt_confidence(fastest_rtt_confidence), 23 NetworkQuality(const base::TimeDelta& rtt,
23 peak_throughput_kbps(peak_throughput_kbps), 24 uint64_t downlink_throughput_kbps,
24 peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} 25 double confidence);
25 26
26 ~NetworkQuality() {} 27 ~NetworkQuality();
27 28
28 // The fastest round trip time observed for the current connection. 29 // Returns the round trip time observed for the current connection.
29 const base::TimeDelta fastest_rtt; 30 base::TimeDelta rtt() const { return rtt_; }
30 31
31 // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 32 // Returns the downlink throughput in Kbps observed for the current
32 // with 0.0 being no confidence and 1.0 implying that estimates are same as 33 // connection.
33 // ground truth. 34 uint64_t downlink_throughput_kbps() const {
mmenke 2015/06/08 17:30:16 Believe this should be downstream (Or download)
tbansal1 2015/06/08 20:27:52 Done.
34 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are 35 return downlink_throughput_kbps_;
35 // meaningful. 36 }
36 const double fastest_rtt_confidence;
37 37
38 // Peak throughput in Kbps observed for the current connection. 38 private:
39 const uint64_t peak_throughput_kbps; 39 // The round trip time observed for the current connection.
40 const base::TimeDelta rtt_;
40 41
41 // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 42 // Downlink throughput in Kbps observed for the current connection.
43 // TODO(tbansal): Change this to int32_t.
44 const uint64_t downlink_throughput_kbps_;
45
46 // Confidence of this network estimate. Value lies between 0.0
42 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are 47 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are
43 // same as ground truth. 48 // same as ground truth.
44 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are 49 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are
45 // meaningful. 50 // meaningful.
46 const double peak_throughput_kbps_confidence; 51 // TODO(tbansal): Change it to an enum.
52 const double confidence_;
mmenke 2015/06/08 16:07:04 Actually, can we just get rid of all this until it
tbansal1 2015/06/08 20:27:51 Done.
47 }; 53 };
48 54
49 } // namespace net 55 } // namespace net
50 56
51 #endif // NET_BASE_NETWORK_QUALITY_H_ 57 #endif // NET_BASE_NETWORK_QUALITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698