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

Unified Diff: net/nqe/network_quality_estimator.h

Issue 2020353002: Record NQE accuracy at main frame requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed asvitkine comments Created 4 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 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 f38deb8d1ae5444d8c92f3a3d161d92d8a039871..32cd8d14a584b4632dadffc96b996dc888286aff 100644
--- a/net/nqe/network_quality_estimator.h
+++ b/net/nqe/network_quality_estimator.h
@@ -189,8 +189,9 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
WARN_UNUSED_RESULT;
// Returns true if the RTT is available and sets |rtt| to the RTT estimated at
- // the transport layer. |rtt| should not be null.
- bool GetTransportRTTEstimate(base::TimeDelta* rtt) const WARN_UNUSED_RESULT;
+ // the transport layer. |rtt| should not be null. Virtualized for testing.
+ virtual bool GetTransportRTTEstimate(base::TimeDelta* rtt) const
+ WARN_UNUSED_RESULT;
// Returns true if downlink throughput is available and sets |kbps| to
// estimated downlink throughput (in kilobits per second).
@@ -224,15 +225,15 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
// Returns true if the median RTT at the transport layer is available and sets
// |rtt| to the median of transport layer RTT observations since
- // |start_time|. |rtt| should not be null.
- bool GetRecentTransportRTTMedian(const base::TimeTicks& start_time,
- base::TimeDelta* rtt) const
+ // |start_time|. |rtt| should not be null. Virtualized for testing.
+ virtual bool GetRecentTransportRTTMedian(const base::TimeTicks& start_time,
+ base::TimeDelta* rtt) const
WARN_UNUSED_RESULT;
// Returns true if median downstream throughput is available and sets |kbps|
// to the median of downstream throughput (in kilobits per second)
// observations since |start_time|. Virtualized for testing. |kbps|
- // should not be null.
+ // should not be null. Virtualized for testing.
virtual bool GetRecentMedianDownlinkThroughputKbps(
const base::TimeTicks& start_time,
int32_t* kbps) const WARN_UNUSED_RESULT;
@@ -309,6 +310,11 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
const char* GetNameForEffectiveConnectionType(
EffectiveConnectionType type) const;
+ // Returns the list of intervals at which the accuracy of network quality
+ // prediction should be recorded. Virtualized for testing.
+ virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals()
+ const;
+
// Overrides the tick clock used by |this| for testing.
void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
@@ -435,6 +441,12 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
// Notify observers of a change in effective connection type.
void NotifyObserversOfEffectiveConnectionTypeChanged();
+ // Records NQE accuracy metrics. |measuring_duration| should belong to the
+ // vector returned by AccuracyRecordingIntervals().
+ // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a
+ // main frame request is observed.
+ void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const;
+
// Values of external estimate provider status. This enum must remain
// synchronized with the enum of the same name in
// metrics/histograms/histograms.xml.
@@ -475,6 +487,10 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
// Time when the effective connection type was last computed.
base::TimeTicks last_effective_connection_type_computation_;
+ // Intervals after the main frame request arrives at which accuracy of network
+ // quality prediction is recorded.
+ std::vector<base::TimeDelta> accuracy_recording_intervals_;
+
// Time when last connection change was observed.
base::TimeTicks last_connection_change_;
@@ -512,8 +528,12 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
nqe::internal::NetworkQuality
connection_thresholds_[EFFECTIVE_CONNECTION_TYPE_LAST];
- // Estimated network quality. Updated on mainframe requests.
- nqe::internal::NetworkQuality estimated_median_network_quality_;
+ // Latest time when the headers for a main frame request were received.
+ base::TimeTicks last_main_frame_request_;
+
+ // Estimated network quality when the response headers for the last mainframe
+ // request were received.
+ nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_;
// ExternalEstimateProvider that provides network quality using operating
// system APIs. May be NULL.
« 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