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

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

Issue 11419319: Histogram first paint PLT's for Cache Sensitivity Analysis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 PLT_HISTOGRAM("PLT.StartToCommit", start_to_commit); 237 PLT_HISTOGRAM("PLT.StartToCommit", start_to_commit);
238 PLT_HISTOGRAM("PLT.CommitToFinishDoc", finish_doc - commit); 238 PLT_HISTOGRAM("PLT.CommitToFinishDoc", finish_doc - commit);
239 PLT_HISTOGRAM("PLT.FinishDocToFinish", finish_all_loads - finish_doc); 239 PLT_HISTOGRAM("PLT.FinishDocToFinish", finish_all_loads - finish_doc);
240 PLT_HISTOGRAM("PLT.BeginToCommit", commit - begin); 240 PLT_HISTOGRAM("PLT.BeginToCommit", commit - begin);
241 PLT_HISTOGRAM("PLT.StartToFinish", start_to_finish_all_loads); 241 PLT_HISTOGRAM("PLT.StartToFinish", start_to_finish_all_loads);
242 if (!request.is_null()) { 242 if (!request.is_null()) {
243 PLT_HISTOGRAM("PLT.RequestToStart", start - request); 243 PLT_HISTOGRAM("PLT.RequestToStart", start - request);
244 PLT_HISTOGRAM("PLT.RequestToFinish", finish_all_loads - request); 244 PLT_HISTOGRAM("PLT.RequestToFinish", finish_all_loads - request);
245 } 245 }
246 PLT_HISTOGRAM("PLT.CommitToFinish", finish_all_loads - commit); 246 PLT_HISTOGRAM("PLT.CommitToFinish", finish_all_loads - commit);
247
248 scoped_ptr<TimeDelta> begin_to_first_paint;
rvargas (doing something else) 2012/12/04 22:55:48 How about TimeDelta foo = TimeDelta::FromInternalV
tburkard 2012/12/04 23:09:08 I thought about both of these, and I find scoped_p
James Hawkins 2012/12/04 23:11:56 I'm fine w/ scoped_ptr. NULLness (or non-) indica
249 scoped_ptr<TimeDelta> commit_to_first_paint;
247 if (!first_paint.is_null()) { 250 if (!first_paint.is_null()) {
248 // 'first_paint' can be before 'begin' for an unknown reason. 251 // 'first_paint' can be before 'begin' for an unknown reason.
249 // See bug http://crbug.com/125273 for details. 252 // See bug http://crbug.com/125273 for details.
250 if (begin <= first_paint) { 253 if (begin <= first_paint) {
251 PLT_HISTOGRAM("PLT.BeginToFirstPaint", first_paint - begin); 254 begin_to_first_paint.reset(new TimeDelta(first_paint - begin));
255 PLT_HISTOGRAM("PLT.BeginToFirstPaint", *begin_to_first_paint);
252 } 256 }
253 DCHECK(commit <= first_paint); 257 DCHECK(commit <= first_paint);
254 PLT_HISTOGRAM("PLT.CommitToFirstPaint", first_paint - commit); 258 commit_to_first_paint.reset(new TimeDelta(first_paint - commit));
259 PLT_HISTOGRAM("PLT.CommitToFirstPaint", *commit_to_first_paint);
255 } 260 }
256 if (!first_paint_after_load.is_null()) { 261 if (!first_paint_after_load.is_null()) {
257 // 'first_paint_after_load' can be before 'begin' for an unknown reason. 262 // 'first_paint_after_load' can be before 'begin' for an unknown reason.
258 // See bug http://crbug.com/125273 for details. 263 // See bug http://crbug.com/125273 for details.
259 if (begin <= first_paint_after_load) { 264 if (begin <= first_paint_after_load) {
260 PLT_HISTOGRAM("PLT.BeginToFirstPaintAfterLoad", 265 PLT_HISTOGRAM("PLT.BeginToFirstPaintAfterLoad",
261 first_paint_after_load - begin); 266 first_paint_after_load - begin);
262 } 267 }
263 DCHECK(commit <= first_paint_after_load); 268 DCHECK(commit <= first_paint_after_load);
264 PLT_HISTOGRAM("PLT.CommitToFirstPaintAfterLoad", 269 PLT_HISTOGRAM("PLT.CommitToFirstPaintAfterLoad",
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // Record histograms for cache sensitivity analysis. 807 // Record histograms for cache sensitivity analysis.
803 static const bool cache_sensitivity_histogram = 808 static const bool cache_sensitivity_histogram =
804 base::FieldTrialList::TrialExists("CacheSensitivityAnalysis"); 809 base::FieldTrialList::TrialExists("CacheSensitivityAnalysis");
805 if (cache_sensitivity_histogram) { 810 if (cache_sensitivity_histogram) {
806 PLT_HISTOGRAM(base::FieldTrial::MakeName( 811 PLT_HISTOGRAM(base::FieldTrial::MakeName(
807 "PLT.BeginToFinishDoc_CacheSensitivity", "CacheSensitivityAnalysis"), 812 "PLT.BeginToFinishDoc_CacheSensitivity", "CacheSensitivityAnalysis"),
808 begin_to_finish_doc); 813 begin_to_finish_doc);
809 PLT_HISTOGRAM(base::FieldTrial::MakeName( 814 PLT_HISTOGRAM(base::FieldTrial::MakeName(
810 "PLT.BeginToFinish_CacheSensitivity", "CacheSensitivityAnalysis"), 815 "PLT.BeginToFinish_CacheSensitivity", "CacheSensitivityAnalysis"),
811 begin_to_finish_all_loads); 816 begin_to_finish_all_loads);
817 if (begin_to_first_paint.get()) {
818 PLT_HISTOGRAM(base::FieldTrial::MakeName(
819 "PLT.BeginToFirstPaint_CacheSensitivity", "CacheSensitivityAnalysis"),
820 *begin_to_first_paint);
821 }
822 if (commit_to_first_paint.get()) {
823 PLT_HISTOGRAM(base::FieldTrial::MakeName(
824 "PLT.CommitToFirstPaint_CacheSensitivity", "CacheSensitivityAnalysis"),
825 *commit_to_first_paint);
826 }
812 } 827 }
813 828
814 // Since there are currently no guarantees that renderer histograms will be 829 // Since there are currently no guarantees that renderer histograms will be
815 // sent to the browser, we initiate a PostTask here to be sure that we send 830 // sent to the browser, we initiate a PostTask here to be sure that we send
816 // the histograms we generated. Without this call, pages that don't have an 831 // the histograms we generated. Without this call, pages that don't have an
817 // on-close-handler might generate data that is lost when the renderer is 832 // on-close-handler might generate data that is lost when the renderer is
818 // shutdown abruptly (perchance because the user closed the tab). 833 // shutdown abruptly (perchance because the user closed the tab).
819 // TODO(jar) BUG=33233: This needs to be moved to a PostDelayedTask, and it 834 // TODO(jar) BUG=33233: This needs to be moved to a PostDelayedTask, and it
820 // should post when the onload is complete, so that it doesn't interfere with 835 // should post when the onload is complete, so that it doesn't interfere with
821 // the next load. 836 // the next load.
(...skipping 27 matching lines...) Expand all
849 864
850 DCHECK(document_state); 865 DCHECK(document_state);
851 DCHECK(ds); 866 DCHECK(ds);
852 GURL url(ds->request().url()); 867 GURL url(ds->request().url());
853 Time start = document_state->start_load_time(); 868 Time start = document_state->start_load_time();
854 Time finish = document_state->finish_load_time(); 869 Time finish = document_state->finish_load_time();
855 // TODO(mbelshe): should we log more stats? 870 // TODO(mbelshe): should we log more stats?
856 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " 871 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms "
857 << url.spec(); 872 << url.spec();
858 } 873 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698