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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/common/extensions/url_pattern.h" | 11 #include "chrome/common/extensions/url_pattern.h" |
12 #include "chrome/renderer/chrome_content_renderer_client.h" | 12 #include "chrome/renderer/chrome_content_renderer_client.h" |
13 #include "chrome/renderer/prerender/prerender_helper.h" | 13 #include "chrome/renderer/prerender/prerender_helper.h" |
14 #include "content/public/common/content_constants.h" | 14 #include "content/public/common/content_constants.h" |
15 #include "content/public/renderer/document_state.h" | 15 #include "content/public/renderer/document_state.h" |
16 #include "content/public/renderer/render_thread.h" | 16 #include "content/public/renderer/render_thread.h" |
17 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
24 | 24 |
| 25 #if defined(OS_ANDROID) |
| 26 #include "base/command_line.h" |
| 27 #include "chrome/common/chrome_switches.h" |
| 28 #endif |
| 29 |
25 using WebKit::WebDataSource; | 30 using WebKit::WebDataSource; |
26 using WebKit::WebFrame; | 31 using WebKit::WebFrame; |
27 using WebKit::WebPerformance; | 32 using WebKit::WebPerformance; |
28 using WebKit::WebString; | 33 using WebKit::WebString; |
29 using base::Time; | 34 using base::Time; |
30 using base::TimeDelta; | 35 using base::TimeDelta; |
31 using content::DocumentState; | 36 using content::DocumentState; |
32 | 37 |
33 const size_t kPLTCount = 100; | 38 const size_t kPLTCount = 100; |
34 | 39 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 case DocumentState::LINK_LOAD_CACHE_STALE_OK: | 349 case DocumentState::LINK_LOAD_CACHE_STALE_OK: |
345 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 350 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
346 "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), | 351 "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), |
347 begin_to_finish_all_loads); | 352 begin_to_finish_all_loads); |
348 break; | 353 break; |
349 default: | 354 default: |
350 break; | 355 break; |
351 } | 356 } |
352 } | 357 } |
353 | 358 |
| 359 #if defined(OS_ANDROID) |
| 360 if (document_state->was_fetched_via_proxy() && |
| 361 document_state->was_fetched_via_spdy() && |
| 362 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSpdyProxyOrigin)) { |
| 363 UMA_HISTOGRAM_ENUMERATION( |
| 364 "PLT.Abandoned_SpdyProxy", abandoned_page ? 1 : 0, 2); |
| 365 PLT_HISTOGRAM("PLT.BeginToFinishDoc_SpdyProxy", begin_to_finish_doc); |
| 366 PLT_HISTOGRAM("PLT.BeginToFinish_SpdyProxy", begin_to_finish_all_loads); |
| 367 } |
| 368 #endif |
| 369 |
354 // Histograms to determine if prefetch & prerender has an impact on PLT. | 370 // Histograms to determine if prefetch & prerender has an impact on PLT. |
355 static const bool prefetching_fieldtrial = | 371 static const bool prefetching_fieldtrial = |
356 base::FieldTrialList::TrialExists("Prefetch"); | 372 base::FieldTrialList::TrialExists("Prefetch"); |
357 if (prefetching_fieldtrial) { | 373 if (prefetching_fieldtrial) { |
358 if (document_state->was_prefetcher()) { | 374 if (document_state->was_prefetcher()) { |
359 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 375 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
360 "PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), | 376 "PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), |
361 begin_to_finish_doc); | 377 begin_to_finish_doc); |
362 PLT_HISTOGRAM(base::FieldTrial::MakeName( | 378 PLT_HISTOGRAM(base::FieldTrial::MakeName( |
363 "PLT.BeginToFinish_ContentPrefetcher", "Prefetch"), | 379 "PLT.BeginToFinish_ContentPrefetcher", "Prefetch"), |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 997 |
982 DCHECK(document_state); | 998 DCHECK(document_state); |
983 DCHECK(ds); | 999 DCHECK(ds); |
984 GURL url(ds->request().url()); | 1000 GURL url(ds->request().url()); |
985 Time start = document_state->start_load_time(); | 1001 Time start = document_state->start_load_time(); |
986 Time finish = document_state->finish_load_time(); | 1002 Time finish = document_state->finish_load_time(); |
987 // TODO(mbelshe): should we log more stats? | 1003 // TODO(mbelshe): should we log more stats? |
988 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 1004 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
989 << url.spec(); | 1005 << url.spec(); |
990 } | 1006 } |
OLD | NEW |