OLD | NEW |
---|---|
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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 13 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
14 #include "chrome/browser/prerender/prerender_field_trial.h" | 14 #include "chrome/browser/prerender/prerender_field_trial.h" |
15 #include "chrome/browser/prerender/prerender_manager.h" | 15 #include "chrome/browser/prerender/prerender_manager.h" |
16 #include "chrome/browser/prerender/prerender_util.h" | 16 #include "chrome/browser/prerender/prerender_util.h" |
17 | 17 |
18 using predictors::AutocompleteActionPredictor; | 18 using predictors::AutocompleteActionPredictor; |
19 | 19 |
20 namespace prerender { | 20 namespace prerender { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // Time window for which we will record windowed PLT's from the last | 24 // Time window for which we will record windowed PLTs from the last observed |
25 // observed link rel=prefetch tag. | 25 // link rel=prefetch tag. This is not intended to be the same as the prerender |
26 // ttl, it's just intended to be a window during which a prerender has likely | |
27 // affected performance. | |
26 const int kWindowDurationSeconds = 30; | 28 const int kWindowDurationSeconds = 30; |
27 | 29 |
28 std::string ComposeHistogramName(const std::string& prefix_type, | 30 std::string ComposeHistogramName(const std::string& prefix_type, |
29 const std::string& name) { | 31 const std::string& name) { |
30 if (prefix_type.empty()) | 32 if (prefix_type.empty()) |
31 return std::string("Prerender.") + name; | 33 return std::string("Prerender.") + name; |
32 return std::string("Prerender.") + prefix_type + std::string("_") + name; | 34 return std::string("Prerender.") + prefix_type + std::string("_") + name; |
33 } | 35 } |
34 | 36 |
35 std::string GetHistogramName(Origin origin, uint8 experiment_id, | 37 std::string GetHistogramName(Origin origin, uint8 experiment_id, |
36 bool is_wash, const std::string& name) { | 38 bool is_wash, const std::string& name) { |
mmenke
2012/10/15 15:28:28
Random comment for future refactoring: This seems
| |
37 if (is_wash) | 39 if (is_wash) |
38 return ComposeHistogramName("wash", name); | 40 return ComposeHistogramName("wash", name); |
39 | 41 |
40 if (origin == ORIGIN_GWS_PRERENDER) { | 42 if (origin == ORIGIN_GWS_PRERENDER) { |
41 if (experiment_id == kNoExperiment) | 43 if (experiment_id == kNoExperiment) |
42 return ComposeHistogramName("gws", name); | 44 return ComposeHistogramName("gws", name); |
43 return ComposeHistogramName("exp" + std::string(1, experiment_id + '0'), | 45 return ComposeHistogramName("exp" + std::string(1, experiment_id + '0'), |
44 name); | 46 name); |
45 } | 47 } |
46 | 48 |
47 if (experiment_id != kNoExperiment) | 49 if (experiment_id != kNoExperiment) |
48 return ComposeHistogramName("wash", name); | 50 return ComposeHistogramName("wash", name); |
49 | 51 |
50 switch (origin) { | 52 switch (origin) { |
51 case ORIGIN_OMNIBOX: | 53 case ORIGIN_OMNIBOX: |
52 return ComposeHistogramName("omnibox", name); | 54 return ComposeHistogramName("omnibox", name); |
53 case ORIGIN_LINK_REL_PRERENDER: | 55 case ORIGIN_LINK_REL_PRERENDER: |
54 return ComposeHistogramName("web", name); | 56 return ComposeHistogramName("web", name); |
57 case ORIGIN_NONE: | |
58 return ComposeHistogramName("none", name); | |
55 case ORIGIN_GWS_PRERENDER: // Handled above. | 59 case ORIGIN_GWS_PRERENDER: // Handled above. |
56 default: | 60 default: |
57 NOTREACHED(); | 61 NOTREACHED(); |
58 break; | 62 break; |
59 }; | 63 }; |
60 | 64 |
61 // Dummy return value to make the compiler happy. | 65 // Dummy return value to make the compiler happy. |
62 NOTREACHED(); | 66 NOTREACHED(); |
63 return ComposeHistogramName("wash", name); | 67 return ComposeHistogramName("wash", name); |
64 } | 68 } |
65 | 69 |
66 bool OriginIsOmnibox(Origin origin) { | 70 bool OriginIsOmnibox(Origin origin) { |
67 return origin == ORIGIN_OMNIBOX; | 71 return origin == ORIGIN_OMNIBOX; |
68 } | 72 } |
69 | 73 |
70 } // namespace | 74 } // namespace |
71 | 75 |
72 // Helper macros for experiment-based and origin-based histogram reporting. | 76 // Helper macros for experiment-based and origin-based histogram reporting. |
73 // All HISTOGRAM arguments must be UMA_HISTOGRAM... macros that contain an | 77 // All HISTOGRAM arguments must be UMA_HISTOGRAM... macros that contain an |
74 // argument "name" which these macros will eventually substitute for the | 78 // argument "name" which these macros will eventually substitute for the |
75 // actual name used. | 79 // actual name used. |
76 #define PREFIXED_HISTOGRAM(histogram_name, HISTOGRAM) \ | 80 #define PREFIXED_HISTOGRAM(histogram_name, origin, HISTOGRAM) \ |
77 PREFIXED_HISTOGRAM_INTERNAL(GetCurrentOrigin(), GetCurrentExperimentId(), \ | 81 PREFIXED_HISTOGRAM_INTERNAL(origin, GetCurrentExperimentId(), \ |
78 IsOriginExperimentWash(), HISTOGRAM, \ | 82 IsOriginExperimentWash(), HISTOGRAM, \ |
79 histogram_name) | 83 histogram_name) |
80 | 84 |
81 #define PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT(histogram_name, origin, \ | 85 #define PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT(histogram_name, origin, \ |
82 experiment, HISTOGRAM) \ | 86 experiment, HISTOGRAM) \ |
83 PREFIXED_HISTOGRAM_INTERNAL(origin, experiment, false, HISTOGRAM, \ | 87 PREFIXED_HISTOGRAM_INTERNAL(origin, experiment, false, HISTOGRAM, \ |
84 histogram_name) | 88 histogram_name) |
85 | 89 |
86 #define PREFIXED_HISTOGRAM_INTERNAL(origin, experiment, wash, HISTOGRAM, \ | 90 #define PREFIXED_HISTOGRAM_INTERNAL(origin, experiment, wash, HISTOGRAM, \ |
87 histogram_name) { \ | 91 histogram_name) { \ |
88 { \ | 92 { \ |
89 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ | 93 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ |
90 std::string name = ComposeHistogramName("", histogram_name); \ | 94 std::string name = ComposeHistogramName("", histogram_name); \ |
91 HISTOGRAM; \ | 95 HISTOGRAM; \ |
92 } \ | 96 } \ |
93 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ | 97 /* Do not rename. HISTOGRAM expects a local variable "name". */ \ |
94 std::string name = GetHistogramName(origin, experiment, wash, \ | 98 std::string name = GetHistogramName(origin, experiment, wash, \ |
95 histogram_name); \ | 99 histogram_name); \ |
96 static uint8 recording_experiment = kNoExperiment; \ | 100 static uint8 recording_experiment = kNoExperiment; \ |
97 if (recording_experiment == kNoExperiment && experiment != kNoExperiment) \ | 101 if (recording_experiment == kNoExperiment && experiment != kNoExperiment) \ |
98 recording_experiment = experiment; \ | 102 recording_experiment = experiment; \ |
99 if (wash) { \ | 103 if (wash) { \ |
100 HISTOGRAM; \ | 104 HISTOGRAM; \ |
101 } else if (experiment != kNoExperiment && \ | 105 } else if (experiment != kNoExperiment && \ |
102 (origin != ORIGIN_GWS_PRERENDER || \ | 106 (origin != ORIGIN_GWS_PRERENDER || \ |
103 experiment != recording_experiment)) { \ | 107 experiment != recording_experiment)) { \ |
104 } else if (origin == ORIGIN_LINK_REL_PRERENDER) { \ | 108 } else if (origin == ORIGIN_LINK_REL_PRERENDER) { \ |
105 HISTOGRAM; \ | 109 HISTOGRAM; \ |
106 } else if (origin == ORIGIN_OMNIBOX) { \ | 110 } else if (origin == ORIGIN_OMNIBOX) { \ |
107 HISTOGRAM; \ | 111 HISTOGRAM; \ |
mmenke
2012/10/15 15:31:30
Wait...you need a NONE case in here, too, I believ
mmenke
2012/10/15 15:34:04
Actually, we should never be returning such a hist
gavinp
2012/10/15 18:32:39
Done.
| |
108 } else if (experiment != kNoExperiment) { \ | 112 } else if (experiment != kNoExperiment) { \ |
109 HISTOGRAM; \ | 113 HISTOGRAM; \ |
110 } else { \ | 114 } else { \ |
111 HISTOGRAM; \ | 115 HISTOGRAM; \ |
112 } \ | 116 } \ |
113 } | 117 } |
114 | 118 |
115 PrerenderHistograms::PrerenderHistograms() | 119 PrerenderHistograms::PrerenderHistograms() |
116 : last_experiment_id_(kNoExperiment), | 120 : last_experiment_id_(kNoExperiment), |
117 last_origin_(ORIGIN_LINK_REL_PRERENDER), | 121 last_origin_(ORIGIN_LINK_REL_PRERENDER), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 | 175 |
172 void PrerenderHistograms::RecordUsedPrerender(Origin origin) const { | 176 void PrerenderHistograms::RecordUsedPrerender(Origin origin) const { |
173 if (OriginIsOmnibox(origin)) { | 177 if (OriginIsOmnibox(origin)) { |
174 UMA_HISTOGRAM_ENUMERATION( | 178 UMA_HISTOGRAM_ENUMERATION( |
175 StringPrintf("Prerender.OmniboxNavigationsUsedPrerenderCount%s", | 179 StringPrintf("Prerender.OmniboxNavigationsUsedPrerenderCount%s", |
176 PrerenderManager::GetModeString()), 1, 2); | 180 PrerenderManager::GetModeString()), 1, 2); |
177 } | 181 } |
178 } | 182 } |
179 | 183 |
180 void PrerenderHistograms::RecordTimeSinceLastRecentVisit( | 184 void PrerenderHistograms::RecordTimeSinceLastRecentVisit( |
185 Origin origin, | |
181 base::TimeDelta delta) const { | 186 base::TimeDelta delta) const { |
182 PREFIXED_HISTOGRAM( | 187 PREFIXED_HISTOGRAM( |
183 "TimeSinceLastRecentVisit", | 188 "TimeSinceLastRecentVisit", origin, |
184 UMA_HISTOGRAM_TIMES(name, delta)); | 189 UMA_HISTOGRAM_TIMES(name, delta)); |
185 } | 190 } |
186 | 191 |
187 void PrerenderHistograms::RecordFractionPixelsFinalAtSwapin( | 192 void PrerenderHistograms::RecordFractionPixelsFinalAtSwapin( |
193 Origin origin, | |
188 double fraction) const { | 194 double fraction) const { |
189 if (fraction < 0.0 || fraction > 1.0) | 195 if (fraction < 0.0 || fraction > 1.0) |
190 return; | 196 return; |
191 int percentage = static_cast<int>(fraction * 100); | 197 int percentage = static_cast<int>(fraction * 100); |
192 if (percentage < 0 || percentage > 100) | 198 if (percentage < 0 || percentage > 100) |
193 return; | 199 return; |
194 PREFIXED_HISTOGRAM( | 200 PREFIXED_HISTOGRAM( |
195 base::FieldTrial::MakeName("FractionPixelsFinalAtSwapin", "Prerender"), | 201 base::FieldTrial::MakeName("FractionPixelsFinalAtSwapin", "Prerender"), |
196 UMA_HISTOGRAM_PERCENTAGE(name, percentage)); | 202 origin, UMA_HISTOGRAM_PERCENTAGE(name, percentage)); |
197 } | 203 } |
198 | 204 |
199 base::TimeTicks PrerenderHistograms::GetCurrentTimeTicks() const { | 205 base::TimeTicks PrerenderHistograms::GetCurrentTimeTicks() const { |
200 return base::TimeTicks::Now(); | 206 return base::TimeTicks::Now(); |
201 } | 207 } |
202 | 208 |
203 // Helper macro for histograms. | 209 // Helper macro for histograms. |
204 #define RECORD_PLT(tag, perceived_page_load_time) { \ | 210 #define RECORD_PLT(tag, perceived_page_load_time) { \ |
205 PREFIXED_HISTOGRAM( \ | 211 PREFIXED_HISTOGRAM( \ |
206 base::FieldTrial::MakeName(tag, "Prerender"), \ | 212 base::FieldTrial::MakeName(tag, "Prerender"), origin, \ |
207 UMA_HISTOGRAM_CUSTOM_TIMES( \ | 213 UMA_HISTOGRAM_CUSTOM_TIMES( \ |
mmenke
2012/10/15 15:28:28
While you're here, believe this should be indented
gavinp
2012/10/15 18:32:39
Done.
| |
208 name, \ | 214 name, \ |
209 perceived_page_load_time, \ | 215 perceived_page_load_time, \ |
210 base::TimeDelta::FromMilliseconds(10), \ | 216 base::TimeDelta::FromMilliseconds(10), \ |
211 base::TimeDelta::FromSeconds(60), \ | 217 base::TimeDelta::FromSeconds(60), \ |
212 100)); \ | 218 100)); \ |
213 } | 219 } |
214 | 220 |
215 // Summary of all histograms Perceived PLT histograms: | 221 // Summary of all histograms Perceived PLT histograms: |
216 // (all prefixed PerceivedPLT) | 222 // (all prefixed PerceivedPLT) |
217 // PerceivedPLT -- Perceived Pageloadtimes (PPLT) for all pages in the group. | 223 // PerceivedPLT -- Perceived Pageloadtimes (PPLT) for all pages in the group. |
(...skipping 11 matching lines...) Expand all Loading... | |
229 // triggering for the first page to finish after the prerender that also started | 235 // triggering for the first page to finish after the prerender that also started |
230 // after the prerender started. | 236 // after the prerender started. |
231 // ...FirstAfterMissBoth -- pages meeting | 237 // ...FirstAfterMissBoth -- pages meeting |
232 // FirstAfterMiss AND FirstAfterMissNonOverlapping | 238 // FirstAfterMiss AND FirstAfterMissNonOverlapping |
233 // ...FirstAfterMissAnyOnly -- pages meeting | 239 // ...FirstAfterMissAnyOnly -- pages meeting |
234 // FirstAfterMiss but NOT FirstAfterMissNonOverlapping | 240 // FirstAfterMiss but NOT FirstAfterMissNonOverlapping |
235 // ..FirstAfterMissNonOverlappingOnly -- pages meeting | 241 // ..FirstAfterMissNonOverlappingOnly -- pages meeting |
236 // FirstAfterMissNonOverlapping but NOT FirstAfterMiss | 242 // FirstAfterMissNonOverlapping but NOT FirstAfterMiss |
237 | 243 |
238 void PrerenderHistograms::RecordPerceivedPageLoadTime( | 244 void PrerenderHistograms::RecordPerceivedPageLoadTime( |
239 base::TimeDelta perceived_page_load_time, bool was_prerender, | 245 Origin origin, |
246 base::TimeDelta perceived_page_load_time, | |
247 bool was_prerender, | |
240 bool was_complete_prerender, const GURL& url) { | 248 bool was_complete_prerender, const GURL& url) { |
241 if (!IsWebURL(url)) | 249 if (!IsWebURL(url)) |
242 return; | 250 return; |
243 bool within_window = WithinWindow(); | 251 bool within_window = WithinWindow(); |
244 bool is_google_url = IsGoogleDomain(url); | 252 bool is_google_url = IsGoogleDomain(url); |
245 RECORD_PLT("PerceivedPLT", perceived_page_load_time); | 253 RECORD_PLT("PerceivedPLT", perceived_page_load_time); |
246 if (within_window) | 254 if (within_window) |
247 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time); | 255 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time); |
248 if (was_prerender || was_complete_prerender) { | 256 if (was_prerender || was_complete_prerender) { |
249 if (was_prerender) | 257 if (was_prerender) |
(...skipping 29 matching lines...) Expand all Loading... | |
279 } else if (recorded_non_overlapping) { | 287 } else if (recorded_non_overlapping) { |
280 RECORD_PLT("PerceivedPLTFirstAfterMissNonOverlappingOnly", | 288 RECORD_PLT("PerceivedPLTFirstAfterMissNonOverlappingOnly", |
281 perceived_page_load_time); | 289 perceived_page_load_time); |
282 } | 290 } |
283 } | 291 } |
284 } | 292 } |
285 } | 293 } |
286 } | 294 } |
287 | 295 |
288 void PrerenderHistograms::RecordPageLoadTimeNotSwappedIn( | 296 void PrerenderHistograms::RecordPageLoadTimeNotSwappedIn( |
289 base::TimeDelta page_load_time, const GURL& url) const { | 297 Origin origin, |
298 base::TimeDelta page_load_time, | |
299 const GURL& url) const { | |
290 // If the URL to be prerendered is not a http[s] URL, or is a Google URL, | 300 // If the URL to be prerendered is not a http[s] URL, or is a Google URL, |
291 // do not record. | 301 // do not record. |
292 if (!IsWebURL(url) || IsGoogleDomain(url)) | 302 if (!IsWebURL(url) || IsGoogleDomain(url)) |
293 return; | 303 return; |
294 RECORD_PLT("PrerenderNotSwappedInPLT", page_load_time); | 304 RECORD_PLT("PrerenderNotSwappedInPLT", page_load_time); |
295 } | 305 } |
296 | 306 |
297 void PrerenderHistograms::RecordSimulatedLocalBrowsingBaselinePLT( | 307 void PrerenderHistograms::RecordPercentLoadDoneAtSwapin(Origin origin, |
298 base::TimeDelta page_load_time, const GURL& url) const { | 308 double fraction) const { |
299 // If the URL to be prerendered is not a http[s] URL do not record. | |
300 if (!IsWebURL(url)) | |
301 return; | |
302 RECORD_PLT("SimulatedLocalBrowsingBaselinePLT", page_load_time); | |
303 } | |
304 | |
305 void PrerenderHistograms::RecordSimulatedLocalBrowsingPLT( | |
306 base::TimeDelta page_load_time, const GURL& url) const { | |
307 // If the URL to be prerendered is not a http[s] URL do not record. | |
308 if (!IsWebURL(url)) | |
309 return; | |
310 RECORD_PLT("SimulatedLocalBrowsingPLT", page_load_time); | |
311 } | |
312 | |
313 void PrerenderHistograms::RecordPercentLoadDoneAtSwapin(double fraction) | |
314 const { | |
315 if (fraction < 0.0 || fraction > 1.0) | 309 if (fraction < 0.0 || fraction > 1.0) |
316 return; | 310 return; |
317 int percentage = static_cast<int>(fraction * 100); | 311 int percentage = static_cast<int>(fraction * 100); |
318 if (percentage < 0 || percentage > 100) | 312 if (percentage < 0 || percentage > 100) |
319 return; | 313 return; |
320 PREFIXED_HISTOGRAM( | 314 PREFIXED_HISTOGRAM( |
321 base::FieldTrial::MakeName("PercentLoadDoneAtSwapin", "Prerender"), | 315 base::FieldTrial::MakeName("PercentLoadDoneAtSwapin", "Prerender"), |
322 UMA_HISTOGRAM_PERCENTAGE(name, percentage)); | 316 origin, UMA_HISTOGRAM_PERCENTAGE(name, percentage)); |
323 } | 317 } |
324 | 318 |
325 base::TimeDelta PrerenderHistograms::GetTimeSinceLastPrerender() const { | 319 base::TimeDelta PrerenderHistograms::GetTimeSinceLastPrerender() const { |
326 return base::TimeTicks::Now() - last_prerender_seen_time_; | 320 return base::TimeTicks::Now() - last_prerender_seen_time_; |
327 } | 321 } |
328 | 322 |
329 bool PrerenderHistograms::WithinWindow() const { | 323 bool PrerenderHistograms::WithinWindow() const { |
330 if (last_prerender_seen_time_.is_null()) | 324 if (last_prerender_seen_time_.is_null()) |
331 return false; | 325 return false; |
332 return GetTimeSinceLastPrerender() <= | 326 return GetTimeSinceLastPrerender() <= |
333 base::TimeDelta::FromSeconds(kWindowDurationSeconds); | 327 base::TimeDelta::FromSeconds(kWindowDurationSeconds); |
334 } | 328 } |
335 | 329 |
336 void PrerenderHistograms::RecordTimeUntilUsed( | 330 void PrerenderHistograms::RecordTimeUntilUsed( |
331 Origin origin, | |
337 base::TimeDelta time_until_used, | 332 base::TimeDelta time_until_used, |
338 base::TimeDelta time_to_live) const { | 333 base::TimeDelta time_to_live) const { |
339 PREFIXED_HISTOGRAM( | 334 PREFIXED_HISTOGRAM( |
340 "TimeUntilUsed", | 335 "TimeUntilUsed", origin, |
341 UMA_HISTOGRAM_CUSTOM_TIMES( | 336 UMA_HISTOGRAM_CUSTOM_TIMES( |
342 name, | 337 name, |
343 time_until_used, | 338 time_until_used, |
344 base::TimeDelta::FromMilliseconds(10), | 339 base::TimeDelta::FromMilliseconds(10), |
345 time_to_live, | 340 time_to_live, |
346 50)); | 341 50)); |
347 } | 342 } |
348 | 343 |
349 void PrerenderHistograms::RecordPerSessionCount(int count) const { | 344 void PrerenderHistograms::RecordPerSessionCount(Origin origin, |
345 int count) const { | |
350 PREFIXED_HISTOGRAM( | 346 PREFIXED_HISTOGRAM( |
351 "PrerendersPerSessionCount", | 347 "PrerendersPerSessionCount", origin, |
352 UMA_HISTOGRAM_COUNTS(name, count)); | 348 UMA_HISTOGRAM_COUNTS(name, count)); |
353 } | 349 } |
354 | 350 |
355 void PrerenderHistograms::RecordTimeBetweenPrerenderRequests( | 351 void PrerenderHistograms::RecordTimeBetweenPrerenderRequests( |
356 base::TimeDelta time) const { | 352 Origin origin, base::TimeDelta time) const { |
357 PREFIXED_HISTOGRAM( | 353 PREFIXED_HISTOGRAM( |
358 "TimeBetweenPrerenderRequests", | 354 "TimeBetweenPrerenderRequests", origin, |
359 UMA_HISTOGRAM_TIMES(name, time)); | 355 UMA_HISTOGRAM_TIMES(name, time)); |
360 } | 356 } |
361 | 357 |
362 void PrerenderHistograms::RecordFinalStatus( | 358 void PrerenderHistograms::RecordFinalStatus( |
363 Origin origin, | 359 Origin origin, |
364 uint8 experiment_id, | 360 uint8 experiment_id, |
365 PrerenderContents::MatchCompleteStatus mc_status, | 361 PrerenderContents::MatchCompleteStatus mc_status, |
366 FinalStatus final_status) const { | 362 FinalStatus final_status) const { |
367 DCHECK(final_status != FINAL_STATUS_MAX); | 363 DCHECK(final_status != FINAL_STATUS_MAX); |
368 | 364 |
(...skipping 13 matching lines...) Expand all Loading... | |
382 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); | 378 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); |
383 } | 379 } |
384 } | 380 } |
385 | 381 |
386 uint8 PrerenderHistograms::GetCurrentExperimentId() const { | 382 uint8 PrerenderHistograms::GetCurrentExperimentId() const { |
387 if (!WithinWindow()) | 383 if (!WithinWindow()) |
388 return kNoExperiment; | 384 return kNoExperiment; |
389 return last_experiment_id_; | 385 return last_experiment_id_; |
390 } | 386 } |
391 | 387 |
392 Origin PrerenderHistograms::GetCurrentOrigin() const { | |
393 if (!WithinWindow()) | |
394 return ORIGIN_LINK_REL_PRERENDER; | |
395 return last_origin_; | |
396 } | |
397 | |
398 bool PrerenderHistograms::IsOriginExperimentWash() const { | 388 bool PrerenderHistograms::IsOriginExperimentWash() const { |
399 if (!WithinWindow()) | 389 if (!WithinWindow()) |
400 return false; | 390 return false; |
401 return origin_experiment_wash_; | 391 return origin_experiment_wash_; |
402 } | 392 } |
403 | 393 |
404 void PrerenderHistograms::RecordLocalPredictorEvent( | |
405 PrerenderLocalPredictor::Event event) const { | |
406 UMA_HISTOGRAM_ENUMERATION( | |
407 ComposeHistogramName("", base::FieldTrial::MakeName( | |
408 "LocalPredictorEvent", "Prerender")), | |
409 event, | |
410 PrerenderLocalPredictor::EVENT_MAX_VALUE); | |
411 } | |
412 | |
413 void PrerenderHistograms::RecordLocalPredictorTimeUntilUsed( | |
414 base::TimeDelta time_until_used, base::TimeDelta max_age) const { | |
415 PREFIXED_HISTOGRAM( | |
416 "LocalPredictorTimeUntilUsed", | |
417 UMA_HISTOGRAM_CUSTOM_TIMES( | |
418 name, | |
419 time_until_used, | |
420 base::TimeDelta::FromMilliseconds(10), | |
421 max_age, | |
422 50)); | |
423 } | |
424 | |
425 } // namespace prerender | 394 } // namespace prerender |
OLD | NEW |