OLD | NEW |
---|---|
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 network quality of a network connection as |
15 // NetworkQualityEstimator. | 16 // estimated by the 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. |
19 uint64_t peak_throughput_kbps, | 20 // |downstream_throughput_kbps| is the estimate of the downstream throughput. |
20 double peak_throughput_kbps_confidence) | 21 NetworkQuality(const base::TimeDelta& rtt, |
21 : fastest_rtt(fastest_rtt), | 22 int32_t downstream_throughput_kbps); |
22 fastest_rtt_confidence(fastest_rtt_confidence), | |
23 peak_throughput_kbps(peak_throughput_kbps), | |
24 peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} | |
25 | 23 |
26 ~NetworkQuality() {} | 24 ~NetworkQuality(); |
27 | 25 |
28 // The fastest round trip time observed for the current connection. | 26 // Returns the estimate of the round trip time. |
29 const base::TimeDelta fastest_rtt; | 27 const base::TimeDelta& rtt() const { return rtt_; } |
30 | 28 |
31 // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 | 29 // Returns the estimate of the downstream throughput in Kbps. |
bengr
2015/06/11 00:14:56
Is this bytes or bits? Maybe KB/s?
tbansal1
2015/06/11 01:43:00
Kilo bits per second. Added comment to make it una
| |
32 // with 0.0 being no confidence and 1.0 implying that estimates are same as | 30 int32_t downstream_throughput_kbps() const { |
33 // ground truth. | 31 return downstream_throughput_kbps_; |
34 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are | 32 } |
35 // meaningful. | |
36 const double fastest_rtt_confidence; | |
37 | 33 |
38 // Peak throughput in Kbps observed for the current connection. | 34 private: |
39 const uint64_t peak_throughput_kbps; | 35 // Estimated round trip time. |
36 const base::TimeDelta rtt_; | |
40 | 37 |
41 // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 | 38 // Estimated downstream throughput in Kbps. |
42 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are | 39 const int32_t downstream_throughput_kbps_; |
43 // same as ground truth. | |
44 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are | |
45 // meaningful. | |
46 const double peak_throughput_kbps_confidence; | |
47 }; | 40 }; |
48 | 41 |
49 } // namespace net | 42 } // namespace net |
50 | 43 |
51 #endif // NET_BASE_NETWORK_QUALITY_H_ | 44 #endif // NET_BASE_NETWORK_QUALITY_H_ |
OLD | NEW |