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

Unified Diff: net/nqe/network_quality_estimator.h

Issue 2710973003: Record RTT prediction accuracy when using average algorithms (Closed)
Patch Set: Add unweighted average Created 3 years, 10 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/nqe/network_quality_estimator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator.h
diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h
index e003654bb7e6da2b79efd21d07aac2e85fba8924..696e9b0e85d39c0e2095b90a48dc00a083f8efb2 100644
--- a/net/nqe/network_quality_estimator.h
+++ b/net/nqe/network_quality_estimator.h
@@ -17,6 +17,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "base/optional.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "net/base/net_export.h"
@@ -320,6 +321,15 @@ class NET_EXPORT NetworkQualityEstimator
bool add_default_platform_observations,
const NetLogWithSource& net_log);
+ // Different experimental statistic algorithms that can be used for computing
+ // the predictions.
+ enum Statistic {
+ STATISTIC_WEIGHTED_AVERAGE = 0,
+ STATISTIC_UNWEIGHTED_AVERAGE = 1,
+ // Last statistic. Not to be used.
+ STATISTIC_LAST = 2
+ };
+
// NetworkChangeNotifier::ConnectionTypeObserver implementation:
void OnConnectionTypeChanged(
NetworkChangeNotifier::ConnectionType type) override;
@@ -385,6 +395,27 @@ class NET_EXPORT NetworkQualityEstimator
void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol,
const base::TimeDelta& rtt);
+ // Returns an estimate of network quality at the specified |percentile|.
+ // |disallowed_observation_sources| is the list of observation sources that
+ // should be excluded when computing the percentile.
+ // Only the observations later than |start_time| are taken into account.
+ // |percentile| must be between 0 and 100 (both inclusive) with higher
+ // percentiles indicating less performant networks. For example, if
+ // |percentile| is 90, then the network is expected to be faster than the
+ // returned estimate with 0.9 probability. Similarly, network is expected to
+ // be slower than the returned estimate with 0.1 probability. |statistic|
+ // is the statistic that should be used for computing the estimate. If unset,
+ // the default statistic is used. Virtualized for testing.
+ virtual base::TimeDelta GetRTTEstimateInternal(
+ const std::vector<NetworkQualityObservationSource>&
+ disallowed_observation_sources,
+ base::TimeTicks start_time,
+ const base::Optional<Statistic>& statistic,
+ int percentile) const;
+ int32_t GetDownlinkThroughputKbpsEstimateInternal(
+ const base::TimeTicks& start_time,
+ int percentile) const;
+
private:
FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
AdaptiveRecomputationEffectiveConnectionType);
@@ -483,24 +514,6 @@ class NET_EXPORT NetworkQualityEstimator
// current connection type to the observation buffer.
void AddDefaultEstimates();
- // Returns an estimate of network quality at the specified |percentile|.
- // |disallowed_observation_sources| is the list of observation sources that
- // should be excluded when computing the percentile.
- // Only the observations later than |start_time| are taken into account.
- // |percentile| must be between 0 and 100 (both inclusive) with higher
- // percentiles indicating less performant networks. For example, if
- // |percentile| is 90, then the network is expected to be faster than the
- // returned estimate with 0.9 probability. Similarly, network is expected to
- // be slower than the returned estimate with 0.1 probability.
- base::TimeDelta GetRTTEstimateInternal(
- const std::vector<NetworkQualityObservationSource>&
- disallowed_observation_sources,
- const base::TimeTicks& start_time,
- int percentile) const;
- int32_t GetDownlinkThroughputKbpsEstimateInternal(
- const base::TimeTicks& start_time,
- int percentile) const;
-
// Returns the current network ID checking by calling the platform APIs.
// Virtualized for testing.
virtual nqe::internal::NetworkID GetCurrentNetworkID() const;
@@ -606,6 +619,8 @@ class NET_EXPORT NetworkQualityEstimator
const nqe::internal::NetworkID& network_id,
const nqe::internal::CachedNetworkQuality& cached_network_quality);
+ const char* GetNameForStatistic(int i) const;
+
// Determines if the requests to local host can be used in estimating the
// network quality. Set to true only for tests.
bool use_localhost_requests_;
@@ -689,6 +704,10 @@ class NET_EXPORT NetworkQualityEstimator
nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_;
EffectiveConnectionType effective_connection_type_at_last_main_frame_;
+ // Estimated RTT at HTTP layer when the last main frame transaction was
+ // started. Computed using different statistics.
+ base::TimeDelta http_rtt_at_last_main_frame_[STATISTIC_LAST];
+
// Estimated network quality obtained from external estimate provider when the
// external estimate provider was last queried.
nqe::internal::NetworkQuality external_estimate_provider_quality_;
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698