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

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: Mark's 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
« no previous file with comments | « extensions/browser/extension_function.h ('k') | extensions/browser/extension_function_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index 5c6319fabaa6c9eb20b6aa1aaa8fb2385e8167fb..fd7bae96ceb8a557067d7079a91341d16c8b4a91 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,20 @@ 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,
+ // we can create a handful of buckets and record the function name so that we
+ // can find what the fastest/slowest are. See crbug.com/608561.
+ // Note: Certain functions perform actions that are inherently slow - such as
+ // anything waiting on user action. As such, we can't always assume that a
+ // long execution time equates to a poorly-performing function.
+ if (success) {
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.SucceededTotalExecutionTime",
+ timer_.Elapsed());
+ } else {
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.FailedTotalExecutionTime",
+ timer_.Elapsed());
+ }
}
void ExtensionFunction::OnRespondingLater(ResponseValue value) {
« no previous file with comments | « extensions/browser/extension_function.h ('k') | extensions/browser/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698