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

Side by Side Diff: components/precache/core/precache_database.cc

Issue 2621413004: Add Precache.CacheStatus.Prefetch UMA. (Closed)
Patch Set: Created 3 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/precache/core/precache_database.h" 5 #include "components/precache/core/precache_database.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
11 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 15 #include "base/time/time.h"
14 #include "components/history/core/browser/history_constants.h" 16 #include "components/history/core/browser/history_constants.h"
15 #include "components/precache/core/proto/unfinished_work.pb.h" 17 #include "components/precache/core/proto/unfinished_work.pb.h"
16 #include "net/http/http_response_headers.h" 18 #include "net/http/http_response_headers.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 downloaded_urls); 146 downloaded_urls);
145 precache_url_table_.SetDownloadReported(referrer_host_id); 147 precache_url_table_.SetDownloadReported(referrer_host_id);
146 } 148 }
147 149
148 void PrecacheDatabase::RecordURLPrefetchMetrics( 150 void PrecacheDatabase::RecordURLPrefetchMetrics(
149 const net::HttpResponseInfo& info, 151 const net::HttpResponseInfo& info,
150 const base::TimeDelta& latency) { 152 const base::TimeDelta& latency) {
151 DCHECK(thread_checker_.CalledOnValidThread()); 153 DCHECK(thread_checker_.CalledOnValidThread());
152 154
153 UMA_HISTOGRAM_TIMES("Precache.Latency.Prefetch", latency); 155 UMA_HISTOGRAM_TIMES("Precache.Latency.Prefetch", latency);
156 UMA_HISTOGRAM_ENUMERATION("Precache.CacheStatus.Prefetch",
157 info.cache_entry_status,
158 net::HttpResponseInfo::CacheEntryStatus::ENTRY_MAX);
154 159
155 DCHECK(info.headers) << "The headers are required to get the freshness."; 160 DCHECK(info.headers) << "The headers are required to get the freshness.";
156 if (info.headers) { 161 if (info.headers) {
157 UMA_HISTOGRAM_CUSTOM_COUNTS( 162 UMA_HISTOGRAM_CUSTOM_COUNTS(
158 "Precache.Freshness.Prefetch", 163 "Precache.Freshness.Prefetch",
159 info.headers->GetFreshnessLifetimes(info.response_time) 164 info.headers->GetFreshnessLifetimes(info.response_time)
160 .freshness.InSeconds(), 165 .freshness.InSeconds(),
161 base::TimeDelta::FromMinutes(5).InSeconds() /* min */, 166 base::TimeDelta::FromMinutes(5).InSeconds() /* min */,
162 base::TimeDelta::FromDays(356).InSeconds() /* max */, 167 base::TimeDelta::FromDays(356).InSeconds() /* max */,
163 100 /* bucket_count */); 168 100 /* bucket_count */);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 458
454 PrecacheQuota PrecacheDatabase::GetQuota() { 459 PrecacheQuota PrecacheDatabase::GetQuota() {
455 return precache_session_table_.GetQuota(); 460 return precache_session_table_.GetQuota();
456 } 461 }
457 462
458 base::WeakPtr<PrecacheDatabase> PrecacheDatabase::GetWeakPtr() { 463 base::WeakPtr<PrecacheDatabase> PrecacheDatabase::GetWeakPtr() {
459 return weak_factory_.GetWeakPtr(); 464 return weak_factory_.GetWeakPtr();
460 } 465 }
461 466
462 } // namespace precache 467 } // namespace precache
OLDNEW
« no previous file with comments | « components/precache/content/precache_manager_unittest.cc ('k') | components/precache/core/precache_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698