| 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/renderer/page_load_histograms.h" | 5 #include "chrome/renderer/page_load_histograms.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 Time dom_loading = Time::FromDoubleT(performance.domLoading()); | 245 Time dom_loading = Time::FromDoubleT(performance.domLoading()); |
| 246 Time dom_interactive = Time::FromDoubleT(performance.domInteractive()); | 246 Time dom_interactive = Time::FromDoubleT(performance.domInteractive()); |
| 247 Time dom_content_loaded_start = | 247 Time dom_content_loaded_start = |
| 248 Time::FromDoubleT(performance.domContentLoadedEventStart()); | 248 Time::FromDoubleT(performance.domContentLoadedEventStart()); |
| 249 Time dom_content_loaded_end = | 249 Time dom_content_loaded_end = |
| 250 Time::FromDoubleT(performance.domContentLoadedEventEnd()); | 250 Time::FromDoubleT(performance.domContentLoadedEventEnd()); |
| 251 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); | 251 Time load_event_start = Time::FromDoubleT(performance.loadEventStart()); |
| 252 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); | 252 Time load_event_end = Time::FromDoubleT(performance.loadEventEnd()); |
| 253 Time begin = (request.is_null() ? navigation_start : request_start); | 253 Time begin = (request.is_null() ? navigation_start : request_start); |
| 254 Time first_paint = document_state->first_paint_time(); | 254 Time first_paint = document_state->first_paint_time(); |
| 255 Time first_non_blank_text = |
| 256 Time::FromDoubleT(performance.firstNonBlankText()); |
| 257 Time first_custom_font_text = |
| 258 Time::FromDoubleT(performance.firstCustomFontText()); |
| 255 | 259 |
| 256 DCHECK(!navigation_start.is_null()); | 260 DCHECK(!navigation_start.is_null()); |
| 257 | 261 |
| 258 // It is possible for a document to have navigation_start time, but no | 262 // It is possible for a document to have navigation_start time, but no |
| 259 // request_start. An example is doing a window.open, which synchronously | 263 // request_start. An example is doing a window.open, which synchronously |
| 260 // loads "about:blank", then using document.write add a meta http-equiv | 264 // loads "about:blank", then using document.write add a meta http-equiv |
| 261 // refresh tag, which causes a navigation. In such case, we will arrive at | 265 // refresh tag, which causes a navigation. In such case, we will arrive at |
| 262 // this function with no request/response timing data and identical load | 266 // this function with no request/response timing data and identical load |
| 263 // start/end values. Avoid logging this case, as it doesn't add any | 267 // start/end values. Avoid logging this case, as it doesn't add any |
| 264 // meaningful information to the histogram. | 268 // meaningful information to the histogram. |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 PLT_HISTOGRAM("PLT.PT_BeginToCommit_HTTPS_DataReductionProxy", | 594 PLT_HISTOGRAM("PLT.PT_BeginToCommit_HTTPS_DataReductionProxy", |
| 591 response_start - begin); | 595 response_start - begin); |
| 592 PLT_HISTOGRAM("PLT.PT_RequestToStart_HTTPS_DataReductionProxy", | 596 PLT_HISTOGRAM("PLT.PT_RequestToStart_HTTPS_DataReductionProxy", |
| 593 request_start - navigation_start); | 597 request_start - navigation_start); |
| 594 PLT_HISTOGRAM("PLT.PT_StartToCommit_HTTPS_DataReductionProxy", | 598 PLT_HISTOGRAM("PLT.PT_StartToCommit_HTTPS_DataReductionProxy", |
| 595 response_start - request_start); | 599 response_start - request_start); |
| 596 PLT_HISTOGRAM("PLT.PT_RequestToCommit_HTTPS_DataReductionProxy", | 600 PLT_HISTOGRAM("PLT.PT_RequestToCommit_HTTPS_DataReductionProxy", |
| 597 response_start - navigation_start); | 601 response_start - navigation_start); |
| 598 } | 602 } |
| 599 } | 603 } |
| 604 if (!first_non_blank_text.is_null()) |
| 605 PLT_HISTOGRAM("PLT.BeginToFirstNonBlankText", first_non_blank_text - begin); |
| 606 if (!first_custom_font_text.is_null()) { |
| 607 PLT_HISTOGRAM("PLT.BeginToFirstCustomFontText", |
| 608 first_custom_font_text - begin); |
| 609 } |
| 600 } | 610 } |
| 601 | 611 |
| 602 // These histograms are based on the timing information collected in | 612 // These histograms are based on the timing information collected in |
| 603 // DocumentState. They should be transitioned to equivalents based on the | 613 // DocumentState. They should be transitioned to equivalents based on the |
| 604 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not | 614 // Navigation Timing records (see DumpPerformanceTiming()) or dropped if not |
| 605 // needed. Please do not add new metrics based on DocumentState. | 615 // needed. Please do not add new metrics based on DocumentState. |
| 606 void DumpDeprecatedHistograms(const WebPerformance& performance, | 616 void DumpDeprecatedHistograms(const WebPerformance& performance, |
| 607 DocumentState* document_state, | 617 DocumentState* document_state, |
| 608 bool data_reduction_proxy_was_used, | 618 bool data_reduction_proxy_was_used, |
| 609 bool came_from_websearch, | 619 bool came_from_websearch, |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 | 1030 |
| 1021 DCHECK(document_state); | 1031 DCHECK(document_state); |
| 1022 DCHECK(ds); | 1032 DCHECK(ds); |
| 1023 GURL url(ds->request().url()); | 1033 GURL url(ds->request().url()); |
| 1024 Time start = document_state->start_load_time(); | 1034 Time start = document_state->start_load_time(); |
| 1025 Time finish = document_state->finish_load_time(); | 1035 Time finish = document_state->finish_load_time(); |
| 1026 // TODO(mbelshe): should we log more stats? | 1036 // TODO(mbelshe): should we log more stats? |
| 1027 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 1037 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 1028 << url.spec(); | 1038 << url.spec(); |
| 1029 } | 1039 } |
| OLD | NEW |