| 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/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 PREFIXED_HISTOGRAM( \ | 162 PREFIXED_HISTOGRAM( \ |
| 163 base::FieldTrial::MakeName(tag, "Prerender"), \ | 163 base::FieldTrial::MakeName(tag, "Prerender"), \ |
| 164 UMA_HISTOGRAM_CUSTOM_TIMES( \ | 164 UMA_HISTOGRAM_CUSTOM_TIMES( \ |
| 165 name, \ | 165 name, \ |
| 166 perceived_page_load_time, \ | 166 perceived_page_load_time, \ |
| 167 base::TimeDelta::FromMilliseconds(10), \ | 167 base::TimeDelta::FromMilliseconds(10), \ |
| 168 base::TimeDelta::FromSeconds(60), \ | 168 base::TimeDelta::FromSeconds(60), \ |
| 169 100)); \ | 169 100)); \ |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Summary of all histograms Perceived PLT histograms: |
| 173 // (all prefixed PerceivedPLT) |
| 174 // PerceivedPLT -- Perceived Pageloadtimes (PPLT) for all pages in the group. |
| 175 // ...Windowed -- PPLT for pages in the 30s after a prerender is created. |
| 176 // ...Matched -- A prerendered page that was swapped in. In the NoUse |
| 177 // and Control group cases, while nothing ever gets swapped in, we do keep |
| 178 // track of what would be prerendered and would be swapped in -- and those |
| 179 // cases are what is classified as Match for these groups. |
| 180 // ...MatchedComplete -- A prerendered page that was swapped in + a few |
| 181 // that were not swapped in so that the set of pages lines up more closely with |
| 182 // the control group. |
| 183 // ...FirstAfterMiss -- First page to finish loading after a prerender, which |
| 184 // is different from the page that was prerendered. |
| 185 // ...FirstAfterMissNonOverlapping -- Same as FirstAfterMiss, but only |
| 186 // triggering for the first page to finish after the prerender that also started |
| 187 // after the prerender started. |
| 188 // ...FirstAfterMissBoth -- pages meeting |
| 189 // FirstAfterMiss AND FirstAfterMissNonOverlapping |
| 190 // ...FirstAfterMissAnyOnly -- pages meeting |
| 191 // FirstAfterMiss but NOT FirstAfterMissNonOverlapping |
| 192 // ..FirstAfterMissNonOverlappingOnly -- pages meeting |
| 193 // FirstAfterMissNonOverlapping but NOT FirstAfterMiss |
| 194 |
| 172 void PrerenderHistograms::RecordPerceivedPageLoadTime( | 195 void PrerenderHistograms::RecordPerceivedPageLoadTime( |
| 173 base::TimeDelta perceived_page_load_time, bool was_prerender, | 196 base::TimeDelta perceived_page_load_time, bool was_prerender, |
| 174 bool was_complete_prerender, const GURL& url) { | 197 bool was_complete_prerender, const GURL& url) { |
| 175 if (!IsWebURL(url)) | 198 if (!IsWebURL(url)) |
| 176 return; | 199 return; |
| 177 bool within_window = WithinWindow(); | 200 bool within_window = WithinWindow(); |
| 178 bool is_google_url = IsGoogleDomain(url); | 201 bool is_google_url = IsGoogleDomain(url); |
| 179 RECORD_PLT("PerceivedPLT", perceived_page_load_time); | 202 RECORD_PLT("PerceivedPLT", perceived_page_load_time); |
| 180 if (within_window) | 203 if (within_window) |
| 181 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time); | 204 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 UMA_HISTOGRAM_COUNTS(name, count)); | 272 UMA_HISTOGRAM_COUNTS(name, count)); |
| 250 } | 273 } |
| 251 | 274 |
| 252 void PrerenderHistograms::RecordTimeBetweenPrerenderRequests( | 275 void PrerenderHistograms::RecordTimeBetweenPrerenderRequests( |
| 253 base::TimeDelta time) const { | 276 base::TimeDelta time) const { |
| 254 PREFIXED_HISTOGRAM( | 277 PREFIXED_HISTOGRAM( |
| 255 "TimeBetweenPrerenderRequests", | 278 "TimeBetweenPrerenderRequests", |
| 256 UMA_HISTOGRAM_TIMES(name, time)); | 279 UMA_HISTOGRAM_TIMES(name, time)); |
| 257 } | 280 } |
| 258 | 281 |
| 259 void PrerenderHistograms::RecordFinalStatus(Origin origin, | 282 void PrerenderHistograms::RecordFinalStatus( |
| 260 uint8 experiment_id, | 283 Origin origin, |
| 261 FinalStatus final_status) const { | 284 uint8 experiment_id, |
| 285 PrerenderContents::MatchCompleteStatus mc_status, |
| 286 FinalStatus final_status) const { |
| 262 DCHECK(final_status != FINAL_STATUS_MAX); | 287 DCHECK(final_status != FINAL_STATUS_MAX); |
| 263 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( | 288 |
| 264 base::FieldTrial::MakeName("FinalStatus", "Prerender"), | 289 // There are three cases for MatchCompleteStatus: |
| 265 origin, experiment_id, | 290 // MATCH_COMPLETE_DEFAULT: |
| 266 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); | 291 // In this case, Match & MatchComplete line up. So we record this in both |
| 292 // histograms. |
| 293 // MATCH_COMPLETE_REPLACED: The actual prerender was replaced by a dummy. |
| 294 // So we only record it in (the actual) FinalStatus, but not MatchComplete. |
| 295 // MATCH_COMPLETE_REPLACEMENT: This is a pseudo element to emulate what |
| 296 // the control group would do. Since it won't actually be swapped in, |
| 297 // it may not go into FinalStatus. Since in the control group it would be |
| 298 // swapped in though, it must go into MatchComplete. |
| 299 |
| 300 if (mc_status != PrerenderContents::MATCH_COMPLETE_REPLACEMENT) { |
| 301 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( |
| 302 base::FieldTrial::MakeName("FinalStatus", "Prerender"), |
| 303 origin, experiment_id, |
| 304 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); |
| 305 } |
| 306 if (mc_status != PrerenderContents::MATCH_COMPLETE_REPLACED) { |
| 307 PREFIXED_HISTOGRAM_ORIGIN_EXPERIMENT( |
| 308 base::FieldTrial::MakeName("FinalStatusMatchComplete", "Prerender"), |
| 309 origin, experiment_id, |
| 310 UMA_HISTOGRAM_ENUMERATION(name, final_status, FINAL_STATUS_MAX)); |
| 311 } |
| 267 } | 312 } |
| 268 | 313 |
| 269 uint8 PrerenderHistograms::GetCurrentExperimentId() const { | 314 uint8 PrerenderHistograms::GetCurrentExperimentId() const { |
| 270 if (!WithinWindow()) | 315 if (!WithinWindow()) |
| 271 return kNoExperiment; | 316 return kNoExperiment; |
| 272 return last_experiment_id_; | 317 return last_experiment_id_; |
| 273 } | 318 } |
| 274 | 319 |
| 275 Origin PrerenderHistograms::GetCurrentOrigin() const { | 320 Origin PrerenderHistograms::GetCurrentOrigin() const { |
| 276 if (!WithinWindow()) | 321 if (!WithinWindow()) |
| 277 return ORIGIN_LINK_REL_PRERENDER; | 322 return ORIGIN_LINK_REL_PRERENDER; |
| 278 return last_origin_; | 323 return last_origin_; |
| 279 } | 324 } |
| 280 | 325 |
| 281 bool PrerenderHistograms::IsOriginExperimentWash() const { | 326 bool PrerenderHistograms::IsOriginExperimentWash() const { |
| 282 if (!WithinWindow()) | 327 if (!WithinWindow()) |
| 283 return false; | 328 return false; |
| 284 return origin_experiment_wash_; | 329 return origin_experiment_wash_; |
| 285 } | 330 } |
| 286 | 331 |
| 287 } // namespace prerender | 332 } // namespace prerender |
| OLD | NEW |