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

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

Issue 2731333003: Record UMA only when network quality is eligible for caching (Closed)
Patch Set: rebase, ryansturm comment Created 3 years, 9 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
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/nqe/network_quality_estimator.h" 5 #include "net/nqe/network_quality_estimator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 bool NetworkQualityEstimator::ReadCachedNetworkQualityEstimate() { 1463 bool NetworkQualityEstimator::ReadCachedNetworkQualityEstimate() {
1464 DCHECK(thread_checker_.CalledOnValidThread()); 1464 DCHECK(thread_checker_.CalledOnValidThread());
1465 1465
1466 if (!persistent_cache_reading_enabled_) 1466 if (!persistent_cache_reading_enabled_)
1467 return false; 1467 return false;
1468 1468
1469 nqe::internal::CachedNetworkQuality cached_network_quality; 1469 nqe::internal::CachedNetworkQuality cached_network_quality;
1470 1470
1471 const bool cached_estimate_available = network_quality_store_->GetById( 1471 const bool cached_estimate_available = network_quality_store_->GetById(
1472 current_network_id_, &cached_network_quality); 1472 current_network_id_, &cached_network_quality);
1473 UMA_HISTOGRAM_BOOLEAN("NQE.CachedNetworkQualityAvailable", 1473 if (network_quality_store_->EligibleForCaching(current_network_id_)) {
1474 cached_estimate_available); 1474 UMA_HISTOGRAM_BOOLEAN("NQE.CachedNetworkQualityAvailable",
1475 cached_estimate_available);
1476 }
1475 1477
1476 if (!cached_estimate_available) 1478 if (!cached_estimate_available)
1477 return false; 1479 return false;
1478 1480
1479 const base::TimeTicks now = tick_clock_->NowTicks(); 1481 const base::TimeTicks now = tick_clock_->NowTicks();
1480 1482
1481 if (cached_network_quality.network_quality().downstream_throughput_kbps() != 1483 if (cached_network_quality.network_quality().downstream_throughput_kbps() !=
1482 nqe::internal::kInvalidThroughput) { 1484 nqe::internal::kInvalidThroughput) {
1483 ThroughputObservation througphput_observation( 1485 ThroughputObservation througphput_observation(
1484 cached_network_quality.network_quality().downstream_throughput_kbps(), 1486 cached_network_quality.network_quality().downstream_throughput_kbps(),
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 return "UnweightedAverage"; 1815 return "UnweightedAverage";
1814 case STATISTIC_LAST: 1816 case STATISTIC_LAST:
1815 NOTREACHED(); 1817 NOTREACHED();
1816 return ""; 1818 return "";
1817 } 1819 }
1818 NOTREACHED(); 1820 NOTREACHED();
1819 return ""; 1821 return "";
1820 } 1822 }
1821 1823
1822 } // namespace net 1824 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698