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

Unified Diff: extensions/common/features/feature_provider.cc

Issue 996013004: Add metric measuring Feature Provider Static() length in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/feature_provider.cc
diff --git a/extensions/common/features/feature_provider.cc b/extensions/common/features/feature_provider.cc
index 90e792456a9f6a9151578a77b708853f8530a45b..0a75d7e7401816bb5f4f796b6586be5d8a12d18e 100644
--- a/extensions/common/features/feature_provider.cc
+++ b/extensions/common/features/feature_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+BB// Copyright 2013 The Chromium Authors. All rights reserved.
robliao 2015/03/13 19:21:19 Remove the BB
rkaplow 2015/03/13 19:42:48 Done.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -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");
not at google - send to devlin 2015/03/13 19:08:05 What does "startup" mean?
rkaplow 2015/03/13 19:19:15 It's a "category" used in the tracing tool, like a
not at google - send to devlin 2015/03/13 19:25:20 Ok, thanks. I guess it does happen on startup, tho
rkaplow 2015/03/13 19:42:48 Right. I don't think there's a big downside, I thi
+ base::Time begin_time = base::Time::Now();
+
ExtensionsClient* client = ExtensionsClient::Get();
feature_providers_["api"] =
make_linked_ptr(client->CreateFeatureProvider("api").release());
@@ -36,7 +44,17 @@ 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.
not at google - send to devlin 2015/03/13 19:08:05 Why only browser process, does UMA only work from
rkaplow 2015/03/13 19:19:15 No, it doesn't, and that's actually the problem. T
not at google - send to devlin 2015/03/13 19:25:20 Ok, thanks. Yes it needs to get read on every ever
rkaplow 2015/03/13 19:42:48 Done.
+ if (process_type == "") {
+ UMA_HISTOGRAM_TIMES("Extensions.FeatureProviderStaticInitTime",
+ base::Time::Now() - begin_time);
+ }
+ }
typedef std::map<std::string, linked_ptr<FeatureProvider> >
FeatureProviderMap;
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698