Chromium Code Reviews| 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 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 // |rtt_confidence| is the confidence of the |rtt| estimate. |
| 20 double peak_throughput_kbps_confidence) | 21 // |throughput_kbps| is the estimate of the Kbps for the current connection. |
| 21 : fastest_rtt(fastest_rtt), | 22 // |throughput_kbps_confidence| is the confidence of the |throughput_kbps| |
| 22 fastest_rtt_confidence(fastest_rtt_confidence), | 23 // estimate. |
| 23 peak_throughput_kbps(peak_throughput_kbps), | 24 NetworkQuality(const base::TimeDelta& rtt, |
| 24 peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} | 25 double rtt_confidence, |
| 26 uint64_t throughput_kbps, | |
|
bengr
2015/06/05 20:44:13
Be clear that this is downlink throuput.
tbansal1
2015/06/05 23:45:57
Done.
| |
| 27 double throughput_kbps_confidence); | |
|
bengr
2015/06/05 20:44:13
Follow the design and make this an enum, and don't
tbansal1
2015/06/05 23:45:57
Will do this in next CL, added TODO
| |
| 25 | 28 |
| 26 ~NetworkQuality() {} | 29 ~NetworkQuality(); |
| 27 | 30 |
| 28 // The fastest round trip time observed for the current connection. | 31 // Returns the round trip time observed for the current connection. |
| 29 const base::TimeDelta fastest_rtt; | 32 base::TimeDelta GetRtt() const; |
| 30 | 33 |
| 31 // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 | 34 // Returns the throughput in Kbps observed for the current connection. |
| 35 uint64_t GetThroughputKbps() const; | |
|
bengr
2015/06/05 20:44:13
GetDownlinkThroughputKbps?
Should this be an int3
tbansal1
2015/06/05 23:45:57
Added TODO.
| |
| 36 | |
| 37 private: | |
| 38 // The round trip time observed for the current connection. | |
| 39 const base::TimeDelta rtt_; | |
| 40 | |
| 41 // 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 | 42 // with 0.0 being no confidence and 1.0 implying that estimates are same as |
| 33 // ground truth. | 43 // ground truth. |
| 34 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are | 44 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are |
| 35 // meaningful. | 45 // meaningful. |
| 36 const double fastest_rtt_confidence; | 46 const double rtt_confidence_; |
|
bengr
2015/06/05 20:44:13
I would assign one confidence to the NetworkQualit
tbansal1
2015/06/05 23:45:57
Done.
| |
| 37 | 47 |
| 38 // Peak throughput in Kbps observed for the current connection. | 48 // Throughput in Kbps observed for the current connection. |
| 39 const uint64_t peak_throughput_kbps; | 49 const uint64_t throughput_kbps_; |
| 40 | 50 |
| 41 // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 | 51 // 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 | 52 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are |
| 43 // same as ground truth. | 53 // same as ground truth. |
| 44 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are | 54 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are |
| 45 // meaningful. | 55 // meaningful. |
| 46 const double peak_throughput_kbps_confidence; | 56 const double throughput_kbps_confidence_; |
| 47 }; | 57 }; |
| 48 | 58 |
| 49 } // namespace net | 59 } // namespace net |
| 50 | 60 |
| 51 #endif // NET_BASE_NETWORK_QUALITY_H_ | 61 #endif // NET_BASE_NETWORK_QUALITY_H_ |
| OLD | NEW |