summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorrkaplow <rkaplow@chromium.org>2015-03-14 14:40:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-14 21:41:52 +0000
commitfca0f4dc562018d756a160d40aff6eda9629fdfb (patch)
tree473bd72a8627eb0fcf6abbb7566163d2dfc69250 /extensions
parent38cf7ef22865bd99901e29fdaecd754fc1f1521a (diff)
downloadchromium_src-fca0f4dc562018d756a160d40aff6eda9629fdfb.zip
chromium_src-fca0f4dc562018d756a160d40aff6eda9629fdfb.tar.gz
chromium_src-fca0f4dc562018d756a160d40aff6eda9629fdfb.tar.bz2
Add metric measuring Feature Provider Static() length in the browser process.
We are investigating the cost of ExtensionService::Init(), and want to see the effect of this static initialization, specifically in the browser process which affects startup. BUG=454789 Review URL: https://codereview.chromium.org/996013004 Cr-Commit-Position: refs/heads/master@{#320668}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/common/features/feature_provider.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/extensions/common/features/feature_provider.cc b/extensions/common/features/feature_provider.cc
index 90e7924..b7f6f48 100644
--- a/extensions/common/features/feature_provider.cc
+++ b/extensions/common/features/feature_provider.cc
@@ -7,9 +7,14 @@
#include <map>
#include "base/basictypes.h"
+#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/trace_event/trace_event.h"
+#include "content/public/common/content_switches.h"
#include "extensions/common/extensions_client.h"
+#include "extensions/common/switches.h"
namespace extensions {
@@ -27,6 +32,9 @@ class Static {
friend struct base::DefaultLazyInstanceTraits<Static>;
Static() {
+ TRACE_EVENT0("startup", "extensions::FeatureProvider::Static");
+ base::Time begin_time = base::Time::Now();
+
ExtensionsClient* client = ExtensionsClient::Get();
feature_providers_["api"] =
make_linked_ptr(client->CreateFeatureProvider("api").release());
@@ -36,6 +44,20 @@ class Static {
make_linked_ptr(client->CreateFeatureProvider("permission").release());
feature_providers_["behavior"] =
make_linked_ptr(client->CreateFeatureProvider("behavior").release());
+
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ std::string process_type =
+ command_line->GetSwitchValueASCII(::switches::kProcessType);
+
+ // Measure time only for browser process. This method gets called by the
+ // browser process on startup, as well as on renderer and extension
+ // processes throughout the execution of the browser. We are more
+ // interested in how long this takes as a startup cost, so we are
+ // just measuring the time in the browser process.
+ if (process_type == std::string()) {
+ UMA_HISTOGRAM_TIMES("Extensions.FeatureProviderStaticInitTime",
+ base::Time::Now() - begin_time);
+ }
}
typedef std::map<std::string, linked_ptr<FeatureProvider> >