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

Side by Side Diff: net/nqe/network_quality_estimator.h

Issue 2107243003: NQE: Record correlation metric in UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add resource size Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 int32_t* kbps) const WARN_UNUSED_RESULT; 337 int32_t* kbps) const WARN_UNUSED_RESULT;
338 338
339 // Returns the list of intervals at which the accuracy of network quality 339 // Returns the list of intervals at which the accuracy of network quality
340 // prediction should be recorded. Virtualized for testing. 340 // prediction should be recorded. Virtualized for testing.
341 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() 341 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals()
342 const; 342 const;
343 343
344 // Overrides the tick clock used by |this| for testing. 344 // Overrides the tick clock used by |this| for testing.
345 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 345 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
346 346
347 // Returns a random double in the range [0.0, 1.0). Virtualized for testing.
348 virtual double RandDouble() const;
349
347 private: 350 private:
348 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); 351 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations);
349 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); 352 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation);
350 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); 353 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams);
351 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 354 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
352 ObtainAlgorithmToUseFromParams); 355 ObtainAlgorithmToUseFromParams);
353 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); 356 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam);
354 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); 357 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles);
355 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); 358 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching);
356 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 359 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, 530 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK,
528 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE, 531 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE,
529 EXTERNAL_ESTIMATE_PROVIDER_STATUS_DOWNLINK_BANDWIDTH_AVAILABLE, 532 EXTERNAL_ESTIMATE_PROVIDER_STATUS_DOWNLINK_BANDWIDTH_AVAILABLE,
530 EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY 533 EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY
531 }; 534 };
532 535
533 // Records the metrics related to external estimate provider. 536 // Records the metrics related to external estimate provider.
534 void RecordExternalEstimateProviderMetrics( 537 void RecordExternalEstimateProviderMetrics(
535 NQEExternalEstimateProviderStatus status) const; 538 NQEExternalEstimateProviderStatus status) const;
536 539
540 // Records a correlation metric that can be used for computing the correlation
541 // between HTTP-layer RTT, transport-layer RTT, throughput and the time
542 // taken to complete |request|.
543 void RecordCorrelationMetric(const URLRequest& request) const;
544
545 // Returns true if transport RTT should be used for computing the effective
546 // connection type.
547 bool UseTransportRTT() const;
548
537 // Determines if the requests to local host can be used in estimating the 549 // Determines if the requests to local host can be used in estimating the
538 // network quality. Set to true only for tests. 550 // network quality. Set to true only for tests.
539 bool use_localhost_requests_; 551 bool use_localhost_requests_;
540 552
541 // Determines if the responses smaller than |kMinTransferSizeInBytes| 553 // Determines if the responses smaller than |kMinTransferSizeInBytes|
542 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the 554 // or shorter than |kMinTransferSizeInBytes| can be used in estimating the
543 // network quality. Set to true only for tests. 555 // network quality. Set to true only for tests.
544 bool use_small_responses_; 556 bool use_small_responses_;
545 557
546 // The factor by which the weight of an observation reduces every second. 558 // The factor by which the weight of an observation reduces every second.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 // events. It is also updated every time there is network traffic (provided 647 // events. It is also updated every time there is network traffic (provided
636 // the last computation was more than 648 // the last computation was more than
637 // |effective_connection_type_recomputation_interval_| ago). 649 // |effective_connection_type_recomputation_interval_| ago).
638 EffectiveConnectionType effective_connection_type_; 650 EffectiveConnectionType effective_connection_type_;
639 651
640 // Minimum and Maximum signal strength (in dbM) observed since last connection 652 // Minimum and Maximum signal strength (in dbM) observed since last connection
641 // change. Updated on connection change and main frame requests. 653 // change. Updated on connection change and main frame requests.
642 int32_t min_signal_strength_since_connection_change_; 654 int32_t min_signal_strength_since_connection_change_;
643 int32_t max_signal_strength_since_connection_change_; 655 int32_t max_signal_strength_since_connection_change_;
644 656
657 // It is costlier to add values to a sparse histogram. So, the correlation UMA
658 // is recorded with |correlation_uma_logging_probability_| since recording it
659 // in a sparse histogram for each request is unnecessary and cost-prohibitive.
660 // e.g., if it is 0.0, then the UMA will never be recorded. On the other hand,
661 // if it is 1.0, then it will be recorded for all valid HTTP requests.
662 const double correlation_uma_logging_probability_;
663
645 base::ThreadChecker thread_checker_; 664 base::ThreadChecker thread_checker_;
646 665
647 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 666 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
648 667
649 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 668 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
650 }; 669 };
651 670
652 } // namespace net 671 } // namespace net
653 672
654 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 673 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.cc » ('j') | net/nqe/network_quality_estimator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698