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

Side by Side Diff: chrome/renderer/page_load_histograms.cc

Issue 2314163003: Removing and deprecating PLT DataReductionProxy UMA (Closed)
Patch Set: DEPS change Created 4 years, 3 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 | « chrome/renderer/DEPS ('k') | components/data_reduction_proxy/content/browser/BUILD.gn » ('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 (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/renderer/page_load_histograms.h" 5 #include "chrome/renderer/page_load_histograms.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/metrics/persistent_histogram_allocator.h" 16 #include "base/metrics/persistent_histogram_allocator.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/renderer/searchbox/search_bouncer.h" 24 #include "chrome/renderer/searchbox/search_bouncer.h"
25 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me ssages.h"
26 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
27 #include "content/public/common/content_constants.h" 25 #include "content/public/common/content_constants.h"
28 #include "content/public/renderer/document_state.h" 26 #include "content/public/renderer/document_state.h"
29 #include "content/public/renderer/render_frame.h" 27 #include "content/public/renderer/render_frame.h"
30 #include "content/public/renderer/render_thread.h" 28 #include "content/public/renderer/render_thread.h"
31 #include "content/public/renderer/render_view.h" 29 #include "content/public/renderer/render_view.h"
32 #include "extensions/common/url_pattern.h" 30 #include "extensions/common/url_pattern.h"
33 #include "net/base/url_util.h" 31 #include "net/base/url_util.h"
34 #include "net/http/http_response_headers.h" 32 #include "net/http/http_response_headers.h"
35 #include "third_party/WebKit/public/platform/URLConversion.h" 33 #include "third_party/WebKit/public/platform/URLConversion.h"
36 #include "third_party/WebKit/public/platform/WebURLRequest.h" 34 #include "third_party/WebKit/public/platform/WebURLRequest.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 std::string name_with_experiment_id = base::StringPrintf( \ 111 std::string name_with_experiment_id = base::StringPrintf( \
114 "%s_FromGWS_Experiment%d", \ 112 "%s_FromGWS_Experiment%d", \
115 name, websearch_chrome_joint_experiment_id); \ 113 name, websearch_chrome_joint_experiment_id); \
116 PltHistogramWithNoMacroCaching(name_with_experiment_id, sample); \ 114 PltHistogramWithNoMacroCaching(name_with_experiment_id, sample); \
117 } \ 115 } \
118 } \ 116 } \
119 PltHistogramWithGwsPreview(name, sample, is_preview, \ 117 PltHistogramWithGwsPreview(name, sample, is_preview, \
120 websearch_chrome_joint_experiment_id); \ 118 websearch_chrome_joint_experiment_id); \
121 } 119 }
122 120
123 // In addition to PLT_HISTOGRAM, add the *_DataReductionProxy variant
124 // conditionally. This macro runs only in one thread.
125 #define PLT_HISTOGRAM_DRP( \
126 name, sample, data_reduction_proxy_was_used, scheme_type) \
127 do { \
128 static base::HistogramBase* counter(NULL); \
129 static base::HistogramBase* drp_counter(NULL); \
130 static base::HistogramBase* https_drp_counter(NULL); \
131 if (!counter) { \
132 DCHECK(drp_counter == NULL); \
133 DCHECK(https_drp_counter == NULL); \
134 counter = base::Histogram::FactoryTimeGet( \
135 name, kPLTMin(), kPLTMax(), kPLTCount, \
136 base::Histogram::kUmaTargetedHistogramFlag); \
137 } \
138 counter->AddTime(sample); \
139 if (!data_reduction_proxy_was_used) break; \
140 if (scheme_type & URLPattern::SCHEME_HTTPS) { \
141 if (!https_drp_counter) { \
142 https_drp_counter = base::Histogram::FactoryTimeGet( \
143 std::string(name) + "_HTTPS_DataReductionProxy", \
144 kPLTMin(), kPLTMax(), kPLTCount, \
145 base::Histogram::kUmaTargetedHistogramFlag); \
146 } \
147 https_drp_counter->AddTime(sample); \
148 } else { \
149 if (!drp_counter) { \
150 drp_counter = base::Histogram::FactoryTimeGet( \
151 std::string(name) + "_DataReductionProxy", \
152 kPLTMin(), kPLTMax(), kPLTCount, \
153 base::Histogram::kUmaTargetedHistogramFlag); \
154 } \
155 drp_counter->AddTime(sample); \
156 } \
157 } while (0)
158
159 // Returns the scheme type of the given URL if its type is one for which we 121 // Returns the scheme type of the given URL if its type is one for which we
160 // dump page load histograms. Otherwise returns NULL. 122 // dump page load histograms. Otherwise returns NULL.
161 URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) { 123 URLPattern::SchemeMasks GetSupportedSchemeType(const GURL& url) {
162 if (url.SchemeIs("http")) 124 if (url.SchemeIs("http"))
163 return URLPattern::SCHEME_HTTP; 125 return URLPattern::SCHEME_HTTP;
164 else if (url.SchemeIs("https")) 126 else if (url.SchemeIs("https"))
165 return URLPattern::SCHEME_HTTPS; 127 return URLPattern::SCHEME_HTTPS;
166 return static_cast<URLPattern::SchemeMasks>(0); 128 return static_cast<URLPattern::SchemeMasks>(0);
167 } 129 }
168 130
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 int experiment_id; 183 int experiment_id;
222 if (!base::StringToInt(value, &experiment_id)) 184 if (!base::StringToInt(value, &experiment_id))
223 return kNoExperiment; 185 return kNoExperiment;
224 if (0 < experiment_id && experiment_id <= kMaxExperimentID) 186 if (0 < experiment_id && experiment_id <= kMaxExperimentID)
225 return experiment_id; 187 return experiment_id;
226 return kNoExperiment; 188 return kNoExperiment;
227 } 189 }
228 190
229 void DumpHistograms(const WebPerformance& performance, 191 void DumpHistograms(const WebPerformance& performance,
230 DocumentState* document_state, 192 DocumentState* document_state,
231 bool data_reduction_proxy_was_used,
232 bool lofi_active_for_page, // LoFi was used, unless part of
233 // the control group.
234 bool came_from_websearch, 193 bool came_from_websearch,
235 int websearch_chrome_joint_experiment_id, 194 int websearch_chrome_joint_experiment_id,
236 bool is_preview, 195 bool is_preview,
237 URLPattern::SchemeMasks scheme_type) { 196 URLPattern::SchemeMasks scheme_type) {
238 // This function records new histograms based on the Navigation Timing 197 // This function records new histograms based on the Navigation Timing
239 // records. As such, the histograms should not depend on the deprecated timing 198 // records. As such, the histograms should not depend on the deprecated timing
240 // information collected in DocumentState. However, here for some reason we 199 // information collected in DocumentState. However, here for some reason we
241 // check if document_state->request_time() is null. TODO(ppi): find out why 200 // check if document_state->request_time() is null. TODO(ppi): find out why
242 // and remove DocumentState from the parameter list. 201 // and remove DocumentState from the parameter list.
243 Time request = document_state->request_time(); 202 Time request = document_state->request_time();
244 203
245 Time navigation_start = Time::FromDoubleT(performance.navigationStart()); 204 Time navigation_start = Time::FromDoubleT(performance.navigationStart());
246 Time domain_lookup_start = Time::FromDoubleT(performance.domainLookupStart());
247 Time domain_lookup_end = Time::FromDoubleT(performance.domainLookupEnd());
248 Time connect_start = Time::FromDoubleT(performance.connectStart());
249 Time connect_end = Time::FromDoubleT(performance.connectEnd());
250 Time request_start = Time::FromDoubleT(performance.requestStart()); 205 Time request_start = Time::FromDoubleT(performance.requestStart());
251 Time response_start = Time::FromDoubleT(performance.responseStart()); 206 Time response_start = Time::FromDoubleT(performance.responseStart());
252 Time dom_loading = Time::FromDoubleT(performance.domLoading());
253 Time dom_interactive = Time::FromDoubleT(performance.domInteractive());
254 Time dom_content_loaded_start = 207 Time dom_content_loaded_start =
255 Time::FromDoubleT(performance.domContentLoadedEventStart()); 208 Time::FromDoubleT(performance.domContentLoadedEventStart());
256 Time dom_content_loaded_end =
257 Time::FromDoubleT(performance.domContentLoadedEventEnd());
258 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); 209 Time load_event_start = Time::FromDoubleT(performance.loadEventStart());
259 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); 210 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd());
260 Time begin = (request.is_null() ? navigation_start : request_start); 211 Time begin = (request.is_null() ? navigation_start : request_start);
261 Time first_paint = document_state->first_paint_time();
262 212
263 DCHECK(!navigation_start.is_null()); 213 DCHECK(!navigation_start.is_null());
264 214
265 // It is possible for a document to have navigation_start time, but no 215 // It is possible for a document to have navigation_start time, but no
266 // request_start. An example is doing a window.open, which synchronously 216 // request_start. An example is doing a window.open, which synchronously
267 // loads "about:blank", then using document.write add a meta http-equiv 217 // loads "about:blank", then using document.write add a meta http-equiv
268 // refresh tag, which causes a navigation. In such case, we will arrive at 218 // refresh tag, which causes a navigation. In such case, we will arrive at
269 // this function with no request/response timing data and identical load 219 // this function with no request/response timing data and identical load
270 // start/end values. Avoid logging this case, as it doesn't add any 220 // start/end values. Avoid logging this case, as it doesn't add any
271 // meaningful information to the histogram. 221 // meaningful information to the histogram.
272 if (request_start.is_null()) 222 if (request_start.is_null())
273 return; 223 return;
274 224
275 // TODO(dominich): Investigate conditions under which |load_event_start| and 225 // TODO(dominich): Investigate conditions under which |load_event_start| and
276 // |load_event_end| may be NULL as in the non-PT_ case below. Examples in 226 // |load_event_end| may be NULL as in the non-PT_ case below. Examples in
277 // http://crbug.com/112006. 227 // http://crbug.com/112006.
278 // DCHECK(!load_event_start.is_null()); 228 // DCHECK(!load_event_start.is_null());
279 // DCHECK(!load_event_end.is_null()); 229 // DCHECK(!load_event_end.is_null());
280 230
281 if (document_state->web_timing_histograms_recorded()) 231 if (document_state->web_timing_histograms_recorded())
282 return; 232 return;
283 document_state->set_web_timing_histograms_recorded(true); 233 document_state->set_web_timing_histograms_recorded(true);
284 234
285 PLT_HISTOGRAM_DRP("PLT.NT_DomainLookup",
Bryan McQuade 2016/09/07 18:24:32 IIUC PLT_HISTOGRAM_DRP logged both a DRP histogram
RyanSturm 2016/09/07 18:36:16 I removed these because I thought DRP were the own
Bryan McQuade 2016/09/07 19:08:15 Ah, in that case, let's go ahead and remove them a
286 domain_lookup_end - domain_lookup_start,
287 data_reduction_proxy_was_used,
288 scheme_type);
289 PLT_HISTOGRAM_DRP("PLT.NT_Connect",
290 connect_end - connect_start,
291 data_reduction_proxy_was_used,
292 scheme_type);
293
294 if (!dom_interactive.is_null() && !dom_loading.is_null()) {
295 PLT_HISTOGRAM_DRP("PLT.NT_DomLoading",
296 dom_interactive - dom_loading,
297 data_reduction_proxy_was_used,
298 scheme_type);
299 }
300 if (!dom_content_loaded_start.is_null() && !dom_interactive.is_null()) {
301 PLT_HISTOGRAM_DRP("PLT.NT_DomInteractive",
302 dom_content_loaded_start - dom_interactive,
303 data_reduction_proxy_was_used,
304 scheme_type);
305 }
306 if (!dom_content_loaded_start.is_null() &&
307 !dom_content_loaded_end.is_null() ) {
308 PLT_HISTOGRAM_DRP("PLT.NT_DomContentLoaded",
309 dom_content_loaded_end - dom_content_loaded_start,
310 data_reduction_proxy_was_used,
311 scheme_type);
312 }
313
314 // TODO(simonjam): There is no way to distinguish between abandonment and 235 // TODO(simonjam): There is no way to distinguish between abandonment and
315 // intentional Javascript navigation before the load event fires. 236 // intentional Javascript navigation before the load event fires.
316 // TODO(dominich): Load type breakdown 237 // TODO(dominich): Load type breakdown
317 if (!load_event_start.is_null()) { 238 if (!load_event_start.is_null()) {
318 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinishDoc", 239 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinishDoc",
319 load_event_start - begin, 240 load_event_start - begin,
320 came_from_websearch, 241 came_from_websearch,
321 websearch_chrome_joint_experiment_id, 242 websearch_chrome_joint_experiment_id,
322 is_preview); 243 is_preview);
323 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinishDoc", 244 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinishDoc",
324 load_event_start - response_start, 245 load_event_start - response_start,
325 came_from_websearch, 246 came_from_websearch,
326 websearch_chrome_joint_experiment_id, 247 websearch_chrome_joint_experiment_id,
327 is_preview); 248 is_preview);
328 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinishDoc", 249 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinishDoc",
329 load_event_start - navigation_start, 250 load_event_start - navigation_start,
330 came_from_websearch, 251 came_from_websearch,
331 websearch_chrome_joint_experiment_id, 252 websearch_chrome_joint_experiment_id,
332 is_preview); 253 is_preview);
333 if (data_reduction_proxy_was_used) {
334 if (scheme_type & URLPattern::SCHEME_HTTPS) {
335 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_HTTPS_DataReductionProxy",
336 load_event_start - begin);
337 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_HTTPS_DataReductionProxy",
338 load_event_start - response_start);
339 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_HTTPS_DataReductionProxy",
340 load_event_start - navigation_start);
341 } else {
342 PLT_HISTOGRAM("PLT.PT_BeginToFinishDoc_DataReductionProxy",
343 load_event_start - begin);
344 PLT_HISTOGRAM("PLT.PT_CommitToFinishDoc_DataReductionProxy",
345 load_event_start - response_start);
346 PLT_HISTOGRAM("PLT.PT_RequestToFinishDoc_DataReductionProxy",
347 load_event_start - navigation_start);
348 }
349 }
350 } 254 }
351 if (!load_event_end.is_null()) { 255 if (!load_event_end.is_null()) {
352 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinish", 256 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToFinish",
353 load_event_end - begin, 257 load_event_end - begin,
354 came_from_websearch, 258 came_from_websearch,
355 websearch_chrome_joint_experiment_id, 259 websearch_chrome_joint_experiment_id,
356 is_preview); 260 is_preview);
357 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinish", 261 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_CommitToFinish",
358 load_event_end - response_start, 262 load_event_end - response_start,
359 came_from_websearch, 263 came_from_websearch,
360 websearch_chrome_joint_experiment_id, 264 websearch_chrome_joint_experiment_id,
361 is_preview); 265 is_preview);
362 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinish", 266 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToFinish",
363 load_event_end - navigation_start, 267 load_event_end - navigation_start,
364 came_from_websearch, 268 came_from_websearch,
365 websearch_chrome_joint_experiment_id, 269 websearch_chrome_joint_experiment_id,
366 is_preview); 270 is_preview);
367 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish", 271 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToFinish",
368 load_event_end - request_start, 272 load_event_end - request_start,
369 came_from_websearch, 273 came_from_websearch,
370 websearch_chrome_joint_experiment_id, 274 websearch_chrome_joint_experiment_id,
371 is_preview); 275 is_preview);
372 if (data_reduction_proxy_was_used) {
373 // TODO(megjablon): Move these repetitive cases into an anonymous
374 // function.
375 bool in_lofi_enabled_group =
376 data_reduction_proxy::params::IsIncludedInLoFiEnabledFieldTrial();
377 bool in_lofi_control_group =
378 data_reduction_proxy::params::IsIncludedInLoFiControlFieldTrial();
379 if (scheme_type & URLPattern::SCHEME_HTTPS) {
380 PLT_HISTOGRAM("PLT.PT_BeginToFinish_HTTPS_DataReductionProxy",
381 load_event_end - begin);
382 PLT_HISTOGRAM("PLT.PT_CommitToFinish_HTTPS_DataReductionProxy",
383 load_event_end - response_start);
384 PLT_HISTOGRAM("PLT.PT_RequestToFinish_HTTPS_DataReductionProxy",
385 load_event_end - navigation_start);
386 PLT_HISTOGRAM("PLT.PT_StartToFinish_HTTPS_DataReductionProxy",
387 load_event_end - request_start);
388 if (lofi_active_for_page && in_lofi_enabled_group) {
389 PLT_HISTOGRAM(
390 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
391 load_event_end - begin);
392 PLT_HISTOGRAM(
393 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
394 load_event_end - response_start);
395 PLT_HISTOGRAM(
396 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
397 load_event_end - navigation_start);
398 PLT_HISTOGRAM(
399 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOn",
400 load_event_end - request_start);
401 if (!first_paint.is_null()) {
402 PLT_HISTOGRAM(
403 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOn",
404 first_paint - begin);
405 }
406 } else if (lofi_active_for_page && in_lofi_control_group) {
407 PLT_HISTOGRAM(
408 "PLT.PT_BeginToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
409 load_event_end - begin);
410 PLT_HISTOGRAM(
411 "PLT.PT_CommitToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
412 load_event_end - response_start);
413 PLT_HISTOGRAM(
414 "PLT.PT_RequestToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
415 load_event_end - navigation_start);
416 PLT_HISTOGRAM(
417 "PLT.PT_StartToFinish_HTTPS_DataReductionProxy_AutoLoFiOff",
418 load_event_end - request_start);
419 if (!first_paint.is_null()) {
420 PLT_HISTOGRAM(
421 "PLT.BeginToFirstPaint_HTTPS_DataReductionProxy_AutoLoFiOff",
422 first_paint - begin);
423 }
424 }
425 } else {
426 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy",
427 load_event_end - begin);
428 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy",
429 load_event_end - response_start);
430 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy",
431 load_event_end - navigation_start);
432 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy",
433 load_event_end - request_start);
434 if (lofi_active_for_page && in_lofi_enabled_group) {
435 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOn",
436 load_event_end - begin);
437 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOn",
438 load_event_end - response_start);
439 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOn",
440 load_event_end - navigation_start);
441 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOn",
442 load_event_end - request_start);
443 if (!first_paint.is_null()) {
444 PLT_HISTOGRAM("PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOn",
445 first_paint - begin);
446 }
447 } else if (lofi_active_for_page && in_lofi_control_group) {
448 PLT_HISTOGRAM("PLT.PT_BeginToFinish_DataReductionProxy_AutoLoFiOff",
449 load_event_end - begin);
450 PLT_HISTOGRAM("PLT.PT_CommitToFinish_DataReductionProxy_AutoLoFiOff",
451 load_event_end - response_start);
452 PLT_HISTOGRAM("PLT.PT_RequestToFinish_DataReductionProxy_AutoLoFiOff",
453 load_event_end - navigation_start);
454 PLT_HISTOGRAM("PLT.PT_StartToFinish_DataReductionProxy_AutoLoFiOff",
455 load_event_end - request_start);
456 if (!first_paint.is_null()) {
457 PLT_HISTOGRAM(
458 "PLT.BeginToFirstPaint_DataReductionProxy_AutoLoFiOff",
459 first_paint - begin);
460 }
461 }
462 }
463 }
464 } 276 }
465 if (!load_event_start.is_null() && !load_event_end.is_null()) { 277 if (!load_event_start.is_null() && !load_event_end.is_null()) {
466 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish", 278 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish",
467 load_event_end - load_event_start); 279 load_event_end - load_event_start);
468 PLT_HISTOGRAM_DRP("PLT.NT_LoadEvent",
Bryan McQuade 2016/09/07 18:24:32 same here
RyanSturm 2016/09/07 18:36:16 See other reply.
469 load_event_end - load_event_start,
470 data_reduction_proxy_was_used,
471 scheme_type);
472
473 if (data_reduction_proxy_was_used) {
474 if (scheme_type & URLPattern::SCHEME_HTTPS) {
475 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_HTTPS_DataReductionProxy",
476 load_event_end - load_event_start);
477 } else {
478 PLT_HISTOGRAM("PLT.PT_FinishDocToFinish_DataReductionProxy",
479 load_event_end - load_event_start);
480 }
481 }
482 } 280 }
483 if (!dom_content_loaded_start.is_null()) { 281 if (!dom_content_loaded_start.is_null()) {
484 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded", 282 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToDomContentLoaded",
485 dom_content_loaded_start - navigation_start, 283 dom_content_loaded_start - navigation_start,
486 came_from_websearch, 284 came_from_websearch,
487 websearch_chrome_joint_experiment_id, 285 websearch_chrome_joint_experiment_id,
488 is_preview); 286 is_preview);
489 if (data_reduction_proxy_was_used) {
490 bool in_lofi_enabled_group =
491 data_reduction_proxy::params::IsIncludedInLoFiEnabledFieldTrial();
492 bool in_lofi_control_group =
493 data_reduction_proxy::params::IsIncludedInLoFiControlFieldTrial();
494 if (scheme_type & URLPattern::SCHEME_HTTPS) {
495 PLT_HISTOGRAM(
496 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy",
497 dom_content_loaded_start - navigation_start);
498 if (lofi_active_for_page && in_lofi_enabled_group) {
499 PLT_HISTOGRAM(
500 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
501 "AutoLoFiOn",
502 dom_content_loaded_start - navigation_start);
503 } else if (lofi_active_for_page && in_lofi_control_group) {
504 PLT_HISTOGRAM(
505 "PLT.PT_RequestToDomContentLoaded_HTTPS_DataReductionProxy_"
506 "AutoLoFiOff",
507 dom_content_loaded_start - navigation_start);
508 }
509 } else {
510 PLT_HISTOGRAM("PLT.PT_RequestToDomContentLoaded_DataReductionProxy",
511 dom_content_loaded_start - navigation_start);
512 if (lofi_active_for_page && in_lofi_enabled_group) {
513 PLT_HISTOGRAM(
514 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOn",
515 dom_content_loaded_start - navigation_start);
516 } else if (lofi_active_for_page && in_lofi_control_group) {
517 PLT_HISTOGRAM(
518 "PLT.PT_RequestToDomContentLoaded_DataReductionProxy_AutoLoFiOff",
519 dom_content_loaded_start - navigation_start);
520 }
521 }
522 }
523 } 287 }
524 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit", 288 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_BeginToCommit",
525 response_start - begin, 289 response_start - begin,
526 came_from_websearch, 290 came_from_websearch,
527 websearch_chrome_joint_experiment_id, 291 websearch_chrome_joint_experiment_id,
528 is_preview); 292 is_preview);
529 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart", 293 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToStart",
530 request_start - navigation_start, 294 request_start - navigation_start,
531 came_from_websearch, 295 came_from_websearch,
532 websearch_chrome_joint_experiment_id, 296 websearch_chrome_joint_experiment_id,
533 is_preview); 297 is_preview);
534 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToCommit", 298 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_StartToCommit",
535 response_start - request_start, 299 response_start - request_start,
536 came_from_websearch, 300 came_from_websearch,
537 websearch_chrome_joint_experiment_id, 301 websearch_chrome_joint_experiment_id,
538 is_preview); 302 is_preview);
539 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToCommit", 303 PLT_HISTOGRAM_WITH_GWS_VARIANT("PLT.PT_RequestToCommit",
540 response_start - navigation_start, 304 response_start - navigation_start,
541 came_from_websearch, 305 came_from_websearch,
542 websearch_chrome_joint_experiment_id, 306 websearch_chrome_joint_experiment_id,
543 is_preview); 307 is_preview);
544 if (data_reduction_proxy_was_used) {
545 if (scheme_type & URLPattern::SCHEME_HTTPS) {
546 PLT_HISTOGRAM("PLT.PT_BeginToCommit_HTTPS_DataReductionProxy",
547 response_start - begin);
548 PLT_HISTOGRAM("PLT.PT_RequestToStart_HTTPS_DataReductionProxy",
549 request_start - navigation_start);
550 PLT_HISTOGRAM("PLT.PT_StartToCommit_HTTPS_DataReductionProxy",
551 response_start - request_start);
552 PLT_HISTOGRAM("PLT.PT_RequestToCommit_HTTPS_DataReductionProxy",
553 response_start - navigation_start);
554 } else {
555 PLT_HISTOGRAM("PLT.PT_BeginToCommit_DataReductionProxy",
556 response_start - begin);
557 PLT_HISTOGRAM("PLT.PT_RequestToStart_DataReductionProxy",
558 request_start - navigation_start);
559 PLT_HISTOGRAM("PLT.PT_StartToCommit_DataReductionProxy",
560 response_start - request_start);
561 PLT_HISTOGRAM("PLT.PT_RequestToCommit_DataReductionProxy",
562 response_start - navigation_start);
563 }
564 }
565 } 308 }
566 309
567 bool WasWebRequestUsedBySomeExtensions() { 310 bool WasWebRequestUsedBySomeExtensions() {
568 #if defined(ENABLE_EXTENSIONS) 311 #if defined(ENABLE_EXTENSIONS)
569 return ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher() 312 return ChromeExtensionsRendererClient::GetInstance()->extension_dispatcher()
570 ->WasWebRequestUsedBySomeExtensions(); 313 ->WasWebRequestUsedBySomeExtensions();
571 #else 314 #else
572 return false; 315 return false;
573 #endif 316 #endif
574 } 317 }
575 318
576 // These histograms are based on the timing information collected in 319 // These histograms are based on the timing information collected in
577 // DocumentState. They should be transitioned to equivalents based on the 320 // DocumentState. They should be transitioned to equivalents based on the
578 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not 321 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not
579 // needed. Please do not add new metrics based on DocumentState. 322 // needed. Please do not add new metrics based on DocumentState.
580 void DumpDeprecatedHistograms(const WebPerformance& performance, 323 void DumpDeprecatedHistograms(const WebPerformance& performance,
581 DocumentState* document_state, 324 DocumentState* document_state,
582 bool data_reduction_proxy_was_used,
583 bool came_from_websearch, 325 bool came_from_websearch,
584 int websearch_chrome_joint_experiment_id, 326 int websearch_chrome_joint_experiment_id,
585 bool is_preview, 327 bool is_preview,
586 URLPattern::SchemeMasks scheme_type) { 328 URLPattern::SchemeMasks scheme_type) {
587 // If we've already dumped, do nothing. 329 // If we've already dumped, do nothing.
588 // This simple bool works because we only dump for the main frame. 330 // This simple bool works because we only dump for the main frame.
589 if (document_state->load_histograms_recorded()) 331 if (document_state->load_histograms_recorded())
590 return; 332 return;
591 333
592 // Abort if any of these is missing. 334 // Abort if any of these is missing.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 case DocumentState::LINK_LOAD_CACHE_ONLY: 487 case DocumentState::LINK_LOAD_CACHE_ONLY:
746 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadCacheOnly", 488 PLT_HISTOGRAM("PLT.BeginToFinishDoc_LinkLoadCacheOnly",
747 begin_to_finish_doc); 489 begin_to_finish_doc);
748 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly", 490 PLT_HISTOGRAM("PLT.BeginToFinish_LinkLoadCacheOnly",
749 begin_to_finish_all_loads); 491 begin_to_finish_all_loads);
750 break; 492 break;
751 default: 493 default:
752 break; 494 break;
753 } 495 }
754 496
755 if (data_reduction_proxy_was_used) {
756 PLT_HISTOGRAM("PLT.BeginToFinishDoc_SpdyProxy", begin_to_finish_doc);
757 PLT_HISTOGRAM("PLT.BeginToFinish_SpdyProxy", begin_to_finish_all_loads);
758 }
759
760 if (document_state->was_prefetcher()) { 497 if (document_state->was_prefetcher()) {
761 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcher", 498 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcher",
762 begin_to_finish_doc); 499 begin_to_finish_doc);
763 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcher", 500 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcher",
764 begin_to_finish_all_loads); 501 begin_to_finish_all_loads);
765 } 502 }
766 if (document_state->was_referred_by_prefetcher()) { 503 if (document_state->was_referred_by_prefetcher()) {
767 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcherReferrer", 504 PLT_HISTOGRAM("PLT.BeginToFinishDoc_ContentPrefetcherReferrer",
768 begin_to_finish_doc); 505 begin_to_finish_doc);
769 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcherReferrer", 506 PLT_HISTOGRAM("PLT.BeginToFinish_ContentPrefetcherReferrer",
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 564
828 // Don't dump stats for the NTP, as PageLoadHistograms should only be recorded 565 // Don't dump stats for the NTP, as PageLoadHistograms should only be recorded
829 // for pages visited due to an explicit user navigation. 566 // for pages visited due to an explicit user navigation.
830 if (SearchBouncer::GetInstance()->IsNewTabPage(frame->document().url())) { 567 if (SearchBouncer::GetInstance()->IsNewTabPage(frame->document().url())) {
831 return; 568 return;
832 } 569 }
833 570
834 DocumentState* document_state = 571 DocumentState* document_state =
835 DocumentState::FromDataSource(frame->dataSource()); 572 DocumentState::FromDataSource(frame->dataSource());
836 573
837 bool data_reduction_proxy_was_used = false;
838 if (!document_state->proxy_server().IsEmpty()) {
839 bool handled =
840 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy(
Bryan McQuade 2016/09/07 18:24:32 i just want to confirm that this IPC message is no
RyanSturm 2016/09/07 18:36:16 Yup. It's only used here, and I've deleted it in t
841 document_state->proxy_server(), &data_reduction_proxy_was_used));
842 // If the IPC call is not handled, then |data_reduction_proxy_was_used|
843 // should remain |false|.
844 DCHECK(handled || !data_reduction_proxy_was_used);
845 }
846
847 bool came_from_websearch = IsFromGoogleSearchResult( 574 bool came_from_websearch = IsFromGoogleSearchResult(
848 frame->document().url(), 575 frame->document().url(),
849 blink::WebStringToGURL(frame->document().referrer())); 576 blink::WebStringToGURL(frame->document().referrer()));
850 int websearch_chrome_joint_experiment_id = kNoExperiment; 577 int websearch_chrome_joint_experiment_id = kNoExperiment;
851 bool is_preview = false; 578 bool is_preview = false;
852 if (came_from_websearch) { 579 if (came_from_websearch) {
853 websearch_chrome_joint_experiment_id = GetQueryStringBasedExperiment( 580 websearch_chrome_joint_experiment_id = GetQueryStringBasedExperiment(
854 blink::WebStringToGURL(frame->document().referrer())); 581 blink::WebStringToGURL(frame->document().referrer()));
855 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); 582 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview");
856 } 583 }
857 584
858 content::RenderFrame* render_frame =
859 content::RenderFrame::FromWebFrame(frame);
860
861 // Metrics based on the timing information recorded for the Navigation Timing 585 // Metrics based on the timing information recorded for the Navigation Timing
862 // API - http://www.w3.org/TR/navigation-timing/. 586 // API - http://www.w3.org/TR/navigation-timing/.
863 DumpHistograms( 587 DumpHistograms(frame->performance(), document_state, came_from_websearch,
864 frame->performance(), document_state, data_reduction_proxy_was_used, 588 websearch_chrome_joint_experiment_id, is_preview, scheme_type);
865 render_frame && render_frame->IsUsingLoFi(), came_from_websearch,
866 websearch_chrome_joint_experiment_id, is_preview, scheme_type);
867 589
868 // Old metrics based on the timing information stored in DocumentState. These 590 // Old metrics based on the timing information stored in DocumentState. These
869 // are deprecated and should go away. 591 // are deprecated and should go away.
870 DumpDeprecatedHistograms(frame->performance(), document_state, 592 DumpDeprecatedHistograms(
871 data_reduction_proxy_was_used, 593 frame->performance(), document_state, came_from_websearch,
872 came_from_websearch, 594 websearch_chrome_joint_experiment_id, is_preview, scheme_type);
873 websearch_chrome_joint_experiment_id,
874 is_preview,
875 scheme_type);
876 595
877 // Log the PLT to the info log. 596 // Log the PLT to the info log.
878 LogPageLoadTime(document_state, frame->dataSource()); 597 LogPageLoadTime(document_state, frame->dataSource());
879 598
880 // If persistent histograms are not enabled, initiate a PostTask here to be 599 // If persistent histograms are not enabled, initiate a PostTask here to be
881 // sure that we send the histograms generated. Without this call, pages 600 // sure that we send the histograms generated. Without this call, pages
882 // that don't have an on-close-handler might generate data that is lost if 601 // that don't have an on-close-handler might generate data that is lost if
883 // the renderer is shutdown abruptly (e.g. the user closed the tab). 602 // the renderer is shutdown abruptly (e.g. the user closed the tab).
884 // TODO(bcwhite): Remove completely when persistence is on-by-default. 603 // TODO(bcwhite): Remove completely when persistence is on-by-default.
885 if (!base::GlobalHistogramAllocator::Get()) { 604 if (!base::GlobalHistogramAllocator::Get()) {
(...skipping 26 matching lines...) Expand all
912 Time start = document_state->start_load_time(); 631 Time start = document_state->start_load_time();
913 Time finish = document_state->finish_load_time(); 632 Time finish = document_state->finish_load_time();
914 // TODO(mbelshe): should we log more stats? 633 // TODO(mbelshe): should we log more stats?
915 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " 634 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms "
916 << url.spec(); 635 << url.spec();
917 } 636 }
918 637
919 void PageLoadHistograms::OnDestruct() { 638 void PageLoadHistograms::OnDestruct() {
920 delete this; 639 delete this;
921 } 640 }
OLDNEW
« no previous file with comments | « chrome/renderer/DEPS ('k') | components/data_reduction_proxy/content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698