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 "base/command_line.h" |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
10 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/extensions/url_pattern.h" | 13 #include "chrome/common/extensions/url_pattern.h" |
12 #include "chrome/renderer/chrome_content_renderer_client.h" | 14 #include "chrome/renderer/chrome_content_renderer_client.h" |
13 #include "chrome/renderer/prerender/prerender_helper.h" | 15 #include "chrome/renderer/prerender/prerender_helper.h" |
14 #include "content/public/common/content_constants.h" | 16 #include "content/public/common/content_constants.h" |
15 #include "content/public/renderer/document_state.h" | 17 #include "content/public/renderer/document_state.h" |
16 #include "content/public/renderer/render_thread.h" | 18 #include "content/public/renderer/render_thread.h" |
17 #include "content/public/renderer/render_view.h" | 19 #include "content/public/renderer/render_view.h" |
18 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 case DocumentState::LINK_LOAD_CACHE_STALE_OK: | 346 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
345 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 347 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
346 "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), | 348 "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), |
347 begin_to_finish_all_loads); | 349 begin_to_finish_all_loads); |
348 break; | 350 break; |
349 default: | 351 default: |
350 break; | 352 break; |
351 } | 353 } |
352 } | 354 } |
353 | 355 |
| 356 if (document_state->was_fetched_via_proxy() && |
| 357 document_state->was_fetched_via_spdy() && |
| 358 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSpdyProxyOrigin)) { |
| 359 UMA_HISTOGRAM_ENUMERATION( |
| 360 "PLT.Abandoned_SpdyProxy", abandoned_page ? 1 : 0, 2); |
| 361 PLT_HISTOGRAM("PLT.BeginToFinishDoc_SpdyProxy", begin_to_finish_doc); |
| 362 PLT_HISTOGRAM("PLT.BeginToFinish_SpdyProxy", begin_to_finish_all_loads); |
| 363 } |
| 364 |
354 // Histograms to determine if prefetch & prerender has an impact on PLT. | 365 // Histograms to determine if prefetch & prerender has an impact on PLT. |
355 static const bool prefetching_fieldtrial = | 366 static const bool prefetching_fieldtrial = |
356 base::FieldTrialList::TrialExists("Prefetch"); | 367 base::FieldTrialList::TrialExists("Prefetch"); |
357 if (prefetching_fieldtrial) { | 368 if (prefetching_fieldtrial) { |
358 if (document_state->was_prefetcher()) { | 369 if (document_state->was_prefetcher()) { |
359 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 370 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
360 "PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), | 371 "PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), |
361 begin_to_finish_doc); | 372 begin_to_finish_doc); |
362 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 373 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
363 "PLT.BeginToFinish_ContentPrefetcher", "Prefetch"), | 374 "PLT.BeginToFinish_ContentPrefetcher", "Prefetch"), |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 992 |
982 DCHECK(document_state); | 993 DCHECK(document_state); |
983 DCHECK(ds); | 994 DCHECK(ds); |
984 GURL url(ds->request().url()); | 995 GURL url(ds->request().url()); |
985 Time start = document_state->start_load_time(); | 996 Time start = document_state->start_load_time(); |
986 Time finish = document_state->finish_load_time(); | 997 Time finish = document_state->finish_load_time(); |
987 // TODO(mbelshe): should we log more stats? | 998 // TODO(mbelshe): should we log more stats? |
988 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 999 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
989 << url.spec(); | 1000 << url.spec(); |
990 } | 1001 } |
OLD | NEW |