Commit 30114511 authored by kalman's avatar kalman Committed by Commit bot

Replace the ExtensionHost load UMAs (Extensions.BackgroundPageLoadTime and

friends) to measure the time from the URL starting to load to it loading.
Extensions.BackgroundPageLoadTime2 replaces Extensions.BackgroundPageLoadTime
etc.

Previously it measured from ExtensionHost construction to it loading, which is
wrong because URL loading can be deferred in a queue, or callers just might not
try to load it until later.

Also do a bit of UMA cleanup: delete some of the Extension page load UMA that
isn't used anymore, and add back the Extensions.PopupLoadTime2 load UMA which
was forgotten about at some point.

R=yoz@chromium.org, isherman@chromium.org
BUG=453073

Review URL: https://codereview.chromium.org/902963002

Cr-Commit-Position: refs/heads/master@{#315149}
parent 4cf59ffa
......@@ -12,7 +12,7 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_context.h"
......@@ -152,9 +152,10 @@ ExtensionHost::ExtensionHost(const Extension* extension,
ExtensionHost::~ExtensionHost() {
if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE &&
extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) {
UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime",
since_created_.Elapsed());
extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_) &&
load_start_.get()) {
UMA_HISTOGRAM_LONG_TIMES("Extensions.EventPageActiveTime2",
load_start_->Elapsed());
}
content::NotificationService::current()->Notify(
extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED,
......@@ -179,7 +180,7 @@ bool ExtensionHost::IsRenderViewLive() const {
}
void ExtensionHost::CreateRenderViewSoon() {
if ((render_process_host() && render_process_host()->HasConnection())) {
if (render_process_host() && render_process_host()->HasConnection()) {
// If the process is already started, go ahead and initialize the RenderView
// synchronously. The process creation is the real meaty part that we want
// to defer.
......@@ -238,6 +239,7 @@ const GURL& ExtensionHost::GetURL() const {
}
void ExtensionHost::LoadInitialURL() {
load_start_.reset(new base::ElapsedTimer());
host_contents_->GetController().LoadURL(
initial_url_, content::Referrer(), ui::PAGE_TRANSITION_LINK,
std::string());
......@@ -306,23 +308,18 @@ void ExtensionHost::DidStopLoading(content::RenderViewHost* render_view_host) {
did_stop_loading_ = true;
OnDidStopLoading();
if (notify) {
CHECK(load_start_.get());
if (extension_host_type_ == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
if (extension_ && BackgroundInfo::HasLazyBackgroundPage(extension_)) {
UMA_HISTOGRAM_TIMES("Extensions.EventPageLoadTime",
since_created_.Elapsed());
UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.EventPageLoadTime2",
load_start_->Elapsed());
} else {
UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime",
since_created_.Elapsed());
UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.BackgroundPageLoadTime2",
load_start_->Elapsed());
}
} else if (extension_host_type_ == VIEW_TYPE_EXTENSION_DIALOG) {
UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime",
since_created_.Elapsed());
} else if (extension_host_type_ == VIEW_TYPE_EXTENSION_POPUP) {
UMA_HISTOGRAM_TIMES("Extensions.PopupLoadTime",
since_created_.Elapsed());
} else if (extension_host_type_ == VIEW_TYPE_EXTENSION_INFOBAR) {
UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime",
since_created_.Elapsed());
UMA_HISTOGRAM_MEDIUM_TIMES("Extensions.PopupLoadTime2",
load_start_->Elapsed());
}
// Send the notification last, because it might result in this being
......
......@@ -197,8 +197,8 @@ class ExtensionHost : public content::WebContentsDelegate,
// The type of view being hosted.
ViewType extension_host_type_;
// Used to measure how long it's been since the host was created.
base::ElapsedTimer since_created_;
// Measures how long since the initial URL started loading.
scoped_ptr<base::ElapsedTimer> load_start_;
ObserverList<ExtensionHostObserver> observer_list_;
......
......@@ -7963,10 +7963,21 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram>
<histogram name="Extensions.BackgroundPageLoadTime" units="milliseconds">
<obsolete>
Replaced by Extensions.BackgroundPageLoadTime2.
</obsolete>
<owner>kalman@chromium.org</owner>
<summary>The time for an extension's background page to load.</summary>
</histogram>
<histogram name="Extensions.BackgroundPageLoadTime2" units="milliseconds">
<owner>kalman@chromium.org</owner>
<summary>
The time taken for an extension's persistent background page to load its
initial URL.
</summary>
</histogram>
<histogram name="Extensions.BackgroundPageType"
units="ExtensionBackgroundPageType">
<owner>kalman@chromium.org</owner>
......@@ -8070,6 +8081,9 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram>
<histogram name="Extensions.DialogLoadTime" units="milliseconds">
<obsolete>
There is no such thing as an extension dialog.
</obsolete>
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>The time for a dialog-hosted extension to load.</summary>
</histogram>
......@@ -8197,20 +8211,41 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram>
<histogram name="Extensions.EventPageActiveTime" units="milliseconds">
<obsolete>
Replaced by Extensions.EventPageActiveTime2.
</obsolete>
<owner>kalman@chromium.org</owner>
<summary>The time an extension's event page has spent loaded.</summary>
</histogram>
<histogram name="Extensions.EventPageActiveTime2" units="milliseconds">
<owner>kalman@chromium.org</owner>
<summary>
The time between an extension's event page loading its first URL and the
event page later shutting down.
</summary>
</histogram>
<histogram name="Extensions.EventPageIdleTime" units="milliseconds">
<owner>kalman@chromium.org</owner>
<summary>The time an extension's event page has spent unloaded.</summary>
</histogram>
<histogram name="Extensions.EventPageLoadTime" units="milliseconds">
<obsolete>
Replaced by Extensions.EventPageLoadTime2.
</obsolete>
<owner>kalman@chromium.org</owner>
<summary>The time for an extension's event page to load.</summary>
</histogram>
<histogram name="Extensions.EventPageLoadTime2" units="milliseconds">
<owner>kalman@chromium.org</owner>
<summary>
The time taken for an extension's event page to load its initial URL.
</summary>
</histogram>
<histogram name="Extensions.ExtensionCacheCount">
<owner>dpolukhin@chromium.org</owner>
<summary>
......@@ -9008,6 +9043,23 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="Extensions.PopupLoadTime" units="milliseconds">
<obsolete>
Replaced by Extensions.PopupLoadTime2.
</obsolete>
<owner>kalman@chromium.org</owner>
<summary>The time for an Extension's popup to load.</summary>
</histogram>
<histogram name="Extensions.PopupLoadTime2" units="milliseconds">
<owner>kalman@chromium.org</owner>
<summary>
The time taken for an extension popup to load its initial URL. This may not
include the time taken for an extension process to start, if the extension
already has a background page running.
</summary>
</histogram>
<histogram name="Extensions.ProcessManagerStartupHostsTime"
units="milliseconds">
<owner>yoz@chromium.org</owner>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment