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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/network_quality_estimator.h » ('j') | net/base/network_quality_estimator.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_quality.h
diff --git a/net/base/network_quality.h b/net/base/network_quality.h
index 4e2985776e0f4a8430b80c7523751391b4b0c0b7..a6f42dc370abb3ea2fe86dd6823256450fcd250a 100644
--- a/net/base/network_quality.h
+++ b/net/base/network_quality.h
@@ -9,41 +9,62 @@
#include "base/time/time.h"
+namespace {
+
+// If two double values are within |kDelta| of each other, they are assumed to
+// be equal.
+const double kDelta = 0.001;
+
+} // namespace
+
namespace net {
// API that is used to report the current network quality as estimated by the
// NetworkQualityEstimator.
+// |rtt| is the estimate of the round trip time for the current connection.
+// |rtt_confidence| is the confidence of the |rtt| estimate.
+// |throughput_kbps| is the estimate of the Kbps for the current connection.
+// |throughput_kbps_confidence| is the confidence of the |throughput_kbps|
+// estimate.
struct NET_EXPORT_PRIVATE NetworkQuality {
- NetworkQuality(const base::TimeDelta& fastest_rtt,
- double fastest_rtt_confidence,
- uint64_t peak_throughput_kbps,
- double peak_throughput_kbps_confidence)
- : fastest_rtt(fastest_rtt),
- fastest_rtt_confidence(fastest_rtt_confidence),
- peak_throughput_kbps(peak_throughput_kbps),
- peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {}
+ NetworkQuality(const base::TimeDelta& rtt,
+ double rtt_confidence,
+ uint64_t throughput_kbps,
+ double throughput_kbps_confidence)
+ : rtt(rtt),
+ rtt_confidence(rtt_confidence),
+ throughput_kbps(throughput_kbps),
+ throughput_kbps_confidence(throughput_kbps_confidence) {
+ DCHECK_GE(rtt, base::TimeDelta());
+ DCHECK_GE(rtt_confidence, 0 - kDelta);
+ DCHECK_LE(rtt_confidence, 1 + kDelta);
+
+ DCHECK_GE(throughput_kbps, 0U);
+ DCHECK_GE(throughput_kbps_confidence, 0 - kDelta);
+ 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.
+ }
mmenke 2015/06/03 18:31:39 De-inline this constructor. Inline constructors s
tbansal1 2015/06/05 01:50:08 Done.
~NetworkQuality() {}
- // The fastest round trip time observed for the current connection.
- const base::TimeDelta fastest_rtt;
+ // The round trip time observed for the current connection.
+ const base::TimeDelta rtt;
- // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0
+ // Confidence of the |rtt| estimate. Value lies between 0.0 and 1.0
// with 0.0 being no confidence and 1.0 implying that estimates are same as
// ground truth.
// TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are
// meaningful.
- const double fastest_rtt_confidence;
+ const double rtt_confidence;
- // Peak throughput in Kbps observed for the current connection.
- const uint64_t peak_throughput_kbps;
+ // Throughput in Kbps observed for the current connection.
+ const uint64_t throughput_kbps;
- // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0
+ // Confidence of the |throughput_kbps| estimate. Value lies between 0.0
// and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are
// same as ground truth.
// TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are
// meaningful.
- const double peak_throughput_kbps_confidence;
+ const double throughput_kbps_confidence;
};
} // namespace net
« 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