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

Side by Side Diff: chrome/browser/prerender/prerender_histograms.cc

Issue 2738783002: Prerender: Remove PerceivedPLT histograms (Closed)
Patch Set: remove PrerenderManager::RecordPerceivedPageLoadTime as well 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/prerender/prerender_histograms.h" 5 #include "chrome/browser/prerender/prerender_histograms.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER) { \ 134 } else if (origin == ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER) { \
135 HISTOGRAM; \ 135 HISTOGRAM; \
136 } else if (origin == ORIGIN_OFFLINE) { \ 136 } else if (origin == ORIGIN_OFFLINE) { \
137 HISTOGRAM; \ 137 HISTOGRAM; \
138 } else { \ 138 } else { \
139 HISTOGRAM; \ 139 HISTOGRAM; \
140 } \ 140 } \
141 } while (0) 141 } while (0)
142 142
143 PrerenderHistograms::PrerenderHistograms() 143 PrerenderHistograms::PrerenderHistograms()
144 : last_origin_(ORIGIN_MAX), 144 : last_origin_(ORIGIN_MAX), origin_wash_(false) {}
145 origin_wash_(false),
146 seen_any_pageload_(true),
147 seen_pageload_started_after_prerender_(true) {
148 }
149 145
150 void PrerenderHistograms::RecordPrerender(Origin origin, const GURL& url) { 146 void PrerenderHistograms::RecordPrerender(Origin origin, const GURL& url) {
151 // We need to update last_origin_ and origin_wash_. 147 // We need to update last_origin_ and origin_wash_.
152 if (!WithinWindow()) { 148 if (!WithinWindow()) {
153 // If we are outside a window, this is a fresh start and we are fine, 149 // If we are outside a window, this is a fresh start and we are fine,
154 // and there is no mix. 150 // and there is no mix.
155 origin_wash_ = false; 151 origin_wash_ = false;
156 } else { 152 } else {
157 // If we are inside the last window, there is a mish mash of origins if 153 // If we are inside the last window, there is a mish mash of origins if
158 // either there was a mish mash before, or the current origin does not match 154 // either there was a mish mash before, or the current origin does not match
159 // the previous one. 155 // the previous one.
160 if (origin != last_origin_) 156 if (origin != last_origin_)
161 origin_wash_ = true; 157 origin_wash_ = true;
162 } 158 }
163 159
164 last_origin_ = origin; 160 last_origin_ = origin;
165 161
166 // If we observe multiple tags within the 30 second window, we will still 162 // If we observe multiple tags within the 30 second window, we will still
167 // reset the window to begin at the most recent occurrence, so that we will 163 // reset the window to begin at the most recent occurrence, so that we will
168 // always be in a window in the 30 seconds from each occurrence. 164 // always be in a window in the 30 seconds from each occurrence.
169 last_prerender_seen_time_ = GetCurrentTimeTicks(); 165 last_prerender_seen_time_ = GetCurrentTimeTicks();
170 seen_any_pageload_ = false;
171 seen_pageload_started_after_prerender_ = false;
172 } 166 }
173 167
174 void PrerenderHistograms::RecordPrerenderStarted(Origin origin) const { 168 void PrerenderHistograms::RecordPrerenderStarted(Origin origin) const {
175 if (OriginIsOmnibox(origin)) { 169 if (OriginIsOmnibox(origin)) {
176 UMA_HISTOGRAM_ENUMERATION( 170 UMA_HISTOGRAM_ENUMERATION(
177 "Prerender.OmniboxPrerenderCount", 1, 2); 171 "Prerender.OmniboxPrerenderCount", 1, 2);
178 } 172 }
179 } 173 }
180 174
181 void PrerenderHistograms::RecordConcurrency(size_t prerender_count) const { 175 void PrerenderHistograms::RecordConcurrency(size_t prerender_count) const {
(...skipping 17 matching lines...) Expand all
199 base::TimeDelta delta) const { 193 base::TimeDelta delta) const {
200 PREFIXED_HISTOGRAM( 194 PREFIXED_HISTOGRAM(
201 "TimeSinceLastRecentVisit", origin, 195 "TimeSinceLastRecentVisit", origin,
202 UMA_HISTOGRAM_TIMES(name, delta)); 196 UMA_HISTOGRAM_TIMES(name, delta));
203 } 197 }
204 198
205 base::TimeTicks PrerenderHistograms::GetCurrentTimeTicks() const { 199 base::TimeTicks PrerenderHistograms::GetCurrentTimeTicks() const {
206 return base::TimeTicks::Now(); 200 return base::TimeTicks::Now();
207 } 201 }
208 202
209 // Helper macro for histograms.
210 #define RECORD_PLT(tag, perceived_page_load_time) \
211 PREFIXED_HISTOGRAM( \
212 tag, origin, \
213 UMA_HISTOGRAM_CUSTOM_TIMES( \
214 name, \
215 perceived_page_load_time, \
216 base::TimeDelta::FromMilliseconds(10), \
217 base::TimeDelta::FromSeconds(60), \
218 100))
219
220 // Summary of all histograms Perceived PLT histograms:
221 // (all prefixed PerceivedPLT)
222 // PerceivedPLT -- Perceived Pageloadtimes (PPLT) for all pages in the group.
223 // ...Windowed -- PPLT for pages in the 30s after a prerender is created.
224 // ...FirstAfterMiss -- First page to finish loading after a prerender, which
225 // is different from the page that was prerendered.
226 // ...FirstAfterMissNonOverlapping -- Same as FirstAfterMiss, but only
227 // triggering for the first page to finish after the prerender that also started
228 // after the prerender started.
229 // ...FirstAfterMissBoth -- pages meeting
230 // FirstAfterMiss AND FirstAfterMissNonOverlapping
231 // ...FirstAfterMissAnyOnly -- pages meeting
232 // FirstAfterMiss but NOT FirstAfterMissNonOverlapping
233 // ..FirstAfterMissNonOverlappingOnly -- pages meeting
234 // FirstAfterMissNonOverlapping but NOT FirstAfterMiss
235
236 void PrerenderHistograms::RecordPerceivedPageLoadTime(
237 Origin origin,
238 base::TimeDelta perceived_page_load_time,
239 NavigationType navigation_type,
240 const GURL& url) {
241 if (!url.SchemeIsHTTPOrHTTPS())
242 return;
243 bool within_window = WithinWindow();
244 bool is_google_url =
245 google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN,
246 google_util::ALLOW_NON_STANDARD_PORTS);
247 RECORD_PLT("PerceivedPLT", perceived_page_load_time);
248 if (within_window)
249 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time);
250 if (navigation_type != NAVIGATION_TYPE_NORMAL) {
251 DCHECK(navigation_type == NAVIGATION_TYPE_PRERENDERED);
252 seen_any_pageload_ = true;
253 seen_pageload_started_after_prerender_ = true;
254 } else if (within_window) {
255 if (!is_google_url) {
256 bool recorded_any = false;
257 bool recorded_non_overlapping = false;
258 if (!seen_any_pageload_) {
259 seen_any_pageload_ = true;
260 RECORD_PLT("PerceivedPLTFirstAfterMiss", perceived_page_load_time);
261 recorded_any = true;
262 }
263 if (!seen_pageload_started_after_prerender_ &&
264 perceived_page_load_time <= GetTimeSinceLastPrerender()) {
265 seen_pageload_started_after_prerender_ = true;
266 RECORD_PLT("PerceivedPLTFirstAfterMissNonOverlapping",
267 perceived_page_load_time);
268 recorded_non_overlapping = true;
269 }
270 if (recorded_any || recorded_non_overlapping) {
271 if (recorded_any && recorded_non_overlapping) {
272 RECORD_PLT("PerceivedPLTFirstAfterMissBoth",
273 perceived_page_load_time);
274 } else if (recorded_any) {
275 RECORD_PLT("PerceivedPLTFirstAfterMissAnyOnly",
276 perceived_page_load_time);
277 } else if (recorded_non_overlapping) {
278 RECORD_PLT("PerceivedPLTFirstAfterMissNonOverlappingOnly",
279 perceived_page_load_time);
280 }
281 }
282 }
283 }
284 }
285
286 void PrerenderHistograms::RecordPerceivedFirstContentfulPaintStatus( 203 void PrerenderHistograms::RecordPerceivedFirstContentfulPaintStatus(
287 Origin origin, 204 Origin origin,
288 bool successful, 205 bool successful,
289 bool was_hidden) { 206 bool was_hidden) {
290 base::UmaHistogramBoolean( 207 base::UmaHistogramBoolean(
291 GetHistogramName(origin, IsOriginWash(), "PerceivedTTFCPRecorded") + 208 GetHistogramName(origin, IsOriginWash(), "PerceivedTTFCPRecorded") +
292 FirstContentfulPaintHiddenName(was_hidden), 209 FirstContentfulPaintHiddenName(was_hidden),
293 successful); 210 successful);
294 } 211 }
295 212
296 void PrerenderHistograms::RecordPageLoadTimeNotSwappedIn(
297 Origin origin,
298 base::TimeDelta page_load_time,
299 const GURL& url) const {
300 // If the URL to be prerendered is not a http[s] URL, or is a Google URL,
301 // do not record.
302 if (!url.SchemeIsHTTPOrHTTPS() ||
303 google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN,
304 google_util::ALLOW_NON_STANDARD_PORTS)) {
305 return;
306 }
307 RECORD_PLT("PrerenderNotSwappedInPLT", page_load_time);
308 }
309
310 void PrerenderHistograms::RecordPercentLoadDoneAtSwapin(Origin origin, 213 void PrerenderHistograms::RecordPercentLoadDoneAtSwapin(Origin origin,
311 double fraction) const { 214 double fraction) const {
312 if (fraction < 0.0 || fraction > 1.0) 215 if (fraction < 0.0 || fraction > 1.0)
313 return; 216 return;
314 int percentage = static_cast<int>(fraction * 100); 217 int percentage = static_cast<int>(fraction * 100);
315 if (percentage < 0 || percentage > 100) 218 if (percentage < 0 || percentage > 100)
316 return; 219 return;
317 PREFIXED_HISTOGRAM("PercentLoadDoneAtSwapin", 220 PREFIXED_HISTOGRAM("PercentLoadDoneAtSwapin",
318 origin, UMA_HISTOGRAM_PERCENTAGE(name, percentage)); 221 origin, UMA_HISTOGRAM_PERCENTAGE(name, percentage));
319 } 222 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 base::TimeDelta::FromMinutes(2), 50); 378 base::TimeDelta::FromMinutes(2), 50);
476 } 379 }
477 380
478 bool PrerenderHistograms::IsOriginWash() const { 381 bool PrerenderHistograms::IsOriginWash() const {
479 if (!WithinWindow()) 382 if (!WithinWindow())
480 return false; 383 return false;
481 return origin_wash_; 384 return origin_wash_;
482 } 385 }
483 386
484 } // namespace prerender 387 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698