Chromium Code Reviews| 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; |