diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 15:24:08 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 15:24:08 +0000 |
commit | e7e4f3c020f42dbee2d8dc74e6124d09871e358d (patch) | |
tree | 84959419ff153d777449ea30c0c75531312aa8c2 | |
parent | d04e047860d1b2141af2d4712181b047dee55e67 (diff) | |
download | chromium_src-e7e4f3c020f42dbee2d8dc74e6124d09871e358d.zip chromium_src-e7e4f3c020f42dbee2d8dc74e6124d09871e358d.tar.gz chromium_src-e7e4f3c020f42dbee2d8dc74e6124d09871e358d.tar.bz2 |
- Add a new time marker for loadtimes, the time of the first layout
- Add new histograms for request -> first layout and start load -> first layout
- Remove per navigation type histograms. They weren't being used and the logic was
getting too complex.
Review URL: http://codereview.chromium.org/88015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14100 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/loadtimes_extension_bindings.cc | 3 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 110 | ||||
-rw-r--r-- | webkit/glue/webdatasource.h | 3 | ||||
-rw-r--r-- | webkit/glue/webdatasource_impl.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webdatasource_impl.h | 6 | ||||
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.cc | 7 |
6 files changed, 50 insertions, 83 deletions
diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc index 15342a9..49f2b25 100644 --- a/chrome/renderer/loadtimes_extension_bindings.cc +++ b/chrome/renderer/loadtimes_extension_bindings.cc @@ -74,6 +74,9 @@ class LoadTimesExtensionWrapper : public v8::Extension { v8::String::New("finishLoadTime"), v8::Number::New(data_source->GetFinishLoadTime().ToDoubleT())); load_times->Set( + v8::String::New("firstLayoutTime"), + v8::Number::New(data_source->GetFirstLayoutTime().ToDoubleT())); + load_times->Set( v8::String::New("navigationType"), v8::String::New( GetNavigationType(data_source->GetNavigationType()))); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 71dc812..f208182 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2971,115 +2971,59 @@ void RenderView::OnExtensionResponse(int callback_id, pending_extension_callbacks_.Remove(callback_id); } -// Dump all load time histograms. We create 2 sets time based histograms, -// one that is specific to the navigation type and one that aggregates all -// navigation types +// Dump all load time histograms. // -// Each set contains 5 histograms measuring various times. +// There are 7 histograms measuring various times. // The time points we keep are // request: time document was requested by user // start: time load of document started // finishDoc: main document loaded, before onload() // finish: after onload() and all resources are loaded -// finish_document_load_time and finish_load_time. +// firstLayout: first layout performed // The times that we histogram are // requestToStart, // startToFinishDoc, // finishDocToFinish, // startToFinish, // requestToFinish, +// requestToFirstLayout +// startToFirstLayout // +// It's possible for the request time not to be set, if a client +// redirect had been done (the user never requested the page) +// Also, it's possible to load a page without ever laying it out +// so firstLayout can be 0. void RenderView::DumpLoadHistograms() const { WebFrame* main_frame = webview()->GetMainFrame(); WebDataSource* ds = main_frame->GetDataSource(); - WebNavigationType nav_type = ds->GetNavigationType(); Time request_time = ds->GetRequestTime(); Time start_load_time = ds->GetStartLoadTime(); Time finish_document_load_time = ds->GetFinishDocumentLoadTime(); Time finish_load_time = ds->GetFinishLoadTime(); + Time first_layout_time = ds->GetFirstLayoutTime(); TimeDelta request_to_start = start_load_time - request_time; TimeDelta start_to_finish_doc = finish_document_load_time - start_load_time; - TimeDelta finish_doc_to_finish = finish_load_time - finish_document_load_time; + TimeDelta finish_doc_to_finish = + finish_load_time - finish_document_load_time; TimeDelta start_to_finish = finish_load_time - start_load_time; TimeDelta request_to_finish = finish_load_time - start_load_time; - - UMA_HISTOGRAM_TIMES("Renderer.All.RequestToStart", request_to_start); + TimeDelta request_to_first_layout = first_layout_time - request_time; + TimeDelta start_to_first_layout = first_layout_time - start_load_time; + + // Client side redirects will have no request time + if (request_time.ToInternalValue() != 0) { + UMA_HISTOGRAM_TIMES("Renderer.All.RequestToStart", request_to_start); + UMA_HISTOGRAM_TIMES("Renderer.All.RequestToFinish", request_to_finish); + if (request_to_first_layout.ToInternalValue() >= 0) { + UMA_HISTOGRAM_TIMES( + "Renderer.All.RequestToFirstLayout", request_to_first_layout); + } + } UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); - UMA_HISTOGRAM_TIMES("Renderer.All.RequestToFinish", request_to_finish); - switch (nav_type) { - case WebNavigationTypeLinkClicked: - UMA_HISTOGRAM_TIMES( - "Renderer.LinkClicked.RequestToStart", request_to_start); - UMA_HISTOGRAM_TIMES( - "Renderer.LinkClicked.StartToFinishDoc", start_to_finish_doc); - UMA_HISTOGRAM_TIMES( - "Renderer.LinkClicked.FinishDocToFinish", finish_doc_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.LinkClicked.RequestToFinish", request_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.LinkClicked.StartToFinish", start_to_finish); - break; - case WebNavigationTypeFormSubmitted: - UMA_HISTOGRAM_TIMES( - "Renderer.FormSubmitted.RequestToStart", request_to_start); - UMA_HISTOGRAM_TIMES( - "Renderer.FormSubmitted.StartToFinishDoc", start_to_finish_doc); - UMA_HISTOGRAM_TIMES( - "Renderer.FormSubmitted.FinishDocToFinish", finish_doc_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.FormSubmitted.RequestToFinish", request_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.FormSubmitted.StartToFinish", start_to_finish); - break; - case WebNavigationTypeBackForward: - UMA_HISTOGRAM_TIMES( - "Renderer.BackForward.RequestToStart", request_to_start); - UMA_HISTOGRAM_TIMES( - "Renderer.BackForward.StartToFinishDoc", start_to_finish_doc); - UMA_HISTOGRAM_TIMES( - "Renderer.BackForward.FinishDocToFinish", finish_doc_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.BackForward.RequestToFinish", request_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.BackForward.StartToFinish", start_to_finish); - break; - case WebNavigationTypeReload: - UMA_HISTOGRAM_TIMES( - "Renderer.Reload.RequestToStart", request_to_start); - UMA_HISTOGRAM_TIMES( - "Renderer.Reload.StartToFinishDoc", start_to_finish_doc); - UMA_HISTOGRAM_TIMES( - "Renderer.Reload.FinishDocToFinish", finish_doc_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.Reload.RequestToFinish", request_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.Reload.StartToFinish", start_to_finish); - break; - case WebNavigationTypeFormResubmitted: - UMA_HISTOGRAM_TIMES( - "Renderer.FormResubmitted.RequestToStart", request_to_start); - UMA_HISTOGRAM_TIMES( - "Renderer.FormResubmitted.StartToFinishDoc", start_to_finish_doc); - UMA_HISTOGRAM_TIMES( - "Renderer.FormResubmitted.FinishDocToFinish", finish_doc_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.FormResubmitted.RequestToFinish", request_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.FormResubmitted.StartToFinish", start_to_finish); - break; - case WebNavigationTypeOther: - UMA_HISTOGRAM_TIMES( - "Renderer.Other.RequestToStart", request_to_start); - UMA_HISTOGRAM_TIMES( - "Renderer.Other.StartToFinishDoc", start_to_finish_doc); - UMA_HISTOGRAM_TIMES( - "Renderer.Other.FinishDocToFinish", finish_doc_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.Other.RequestToFinish", request_to_finish); - UMA_HISTOGRAM_TIMES( - "Renderer.Other.StartToFinish", start_to_finish); - break; + if (start_to_first_layout.ToInternalValue() >= 0) { + UMA_HISTOGRAM_TIMES( + "Renderer.All.StartToFirstLayout", start_to_first_layout); } } diff --git a/webkit/glue/webdatasource.h b/webkit/glue/webdatasource.h index 8ca7b1c..b0545925 100644 --- a/webkit/glue/webdatasource.h +++ b/webkit/glue/webdatasource.h @@ -114,6 +114,9 @@ class WebDataSource { // notification. virtual base::Time GetFinishLoadTime() const = 0; + // Returns the first time a layout was performed + virtual base::Time GetFirstLayoutTime() const = 0; + // Returns the reason the document was loaded. virtual WebNavigationType GetNavigationType() const = 0; }; diff --git a/webkit/glue/webdatasource_impl.cc b/webkit/glue/webdatasource_impl.cc index 13c15cc..fb1f1c2 100644 --- a/webkit/glue/webdatasource_impl.cc +++ b/webkit/glue/webdatasource_impl.cc @@ -122,6 +122,10 @@ base::Time WebDataSourceImpl::GetFinishLoadTime() const { return finish_load_time_; } +base::Time WebDataSourceImpl::GetFirstLayoutTime() const { + return first_layout_time_; +} + WebNavigationType WebDataSourceImpl::GetNavigationType() const { return NavigationTypeToWebNavigationType(triggeringAction().type()); } diff --git a/webkit/glue/webdatasource_impl.h b/webkit/glue/webdatasource_impl.h index b18482b..d4bef9c 100644 --- a/webkit/glue/webdatasource_impl.h +++ b/webkit/glue/webdatasource_impl.h @@ -42,6 +42,7 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { virtual base::Time GetStartLoadTime() const; virtual base::Time GetFinishDocumentLoadTime() const; virtual base::Time GetFinishLoadTime() const; + virtual base::Time GetFirstLayoutTime() const; virtual WebNavigationType GetNavigationType() const; static WebNavigationType NavigationTypeToWebNavigationType( @@ -102,6 +103,10 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { finish_load_time_ = finish_load_time; } + void set_first_layout_time(base::Time first_layout_time) { + first_layout_time_ = first_layout_time; + } + private: WebDataSourceImpl(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); @@ -129,6 +134,7 @@ class WebDataSourceImpl : public WebCore::DocumentLoader, public WebDataSource { base::Time start_load_time_; base::Time finish_document_load_time_; base::Time finish_load_time_; + base::Time first_layout_time_; DISALLOW_COPY_AND_ASSIGN(WebDataSourceImpl); }; diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index e6e2c29..e9bc9dc 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -853,6 +853,13 @@ void WebFrameLoaderClient::dispatchDidFinishLoad() { void WebFrameLoaderClient::dispatchDidFirstLayout() { // FIXME: called when webkit finished layout of page. // All resources have not necessarily finished loading. + DocumentLoader* document_loader = + webframe_->frame()->loader()->documentLoader(); + WebDataSourceImpl* ds = + WebDataSourceImpl::FromLoader(document_loader); + if (ds->GetFirstLayoutTime().ToInternalValue() == 0) { + ds->set_first_layout_time(base::Time::Now()); + } } void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() { |