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

Unified Diff: extensions/browser/extension_function.cc

Issue 1939413002: [Extensions] Add coarse metrics for extension function performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index 5c6319fabaa6c9eb20b6aa1aaa8fb2385e8167fb..0c2af6b2a7834a40587d10f29612c2fd09096de7 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
+#include "base/metrics/histogram_macros.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -406,6 +407,15 @@ void ExtensionFunction::SendResponseImpl(bool success) {
results_.reset(new base::ListValue());
response_callback_.Run(type, *results_, GetError(), histogram_value());
+
+ // TODO(devlin): Once we have a baseline metric for how long functions take,
lazyboy 2016/05/03 01:00:01 Addition to the notes, I think referring to the bu
Devlin 2016/05/03 17:03:36 Done.
+ // we can create a handful of buckets and record the function name so that we
+ // can find what the fastest/slowest are.
+ // Note: Certain functions perform actions that are inherantly slow - such as
lazyboy 2016/05/03 01:00:01 nit: inherently
Devlin 2016/05/03 17:03:36 whoops, done.
+ // anything waiting on user action. As such, we can't always assume that a
+ // long execution time equates to a poorly-performing function.
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.TotalExecutionTime",
lazyboy 2016/05/03 01:00:01 Should we also categorize based on |success|? I'd
Devlin 2016/05/03 17:03:36 Sounds reasonable. Done.
+ timer_.Elapsed());
}
void ExtensionFunction::OnRespondingLater(ResponseValue value) {

Powered by Google App Engine
This is Rietveld 408576698