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

Unified Diff: extensions/browser/extension_function_dispatcher.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.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/browser/extension_function_dispatcher.cc
diff --git a/extensions/browser/extension_function_dispatcher.cc b/extensions/browser/extension_function_dispatcher.cc
index db94833e53bffd234b2edf74145e91801e6f6e6f..5f4d0df21cd8985106aa99a682b3fe972180bbb6 100644
--- a/extensions/browser/extension_function_dispatcher.cc
+++ b/extensions/browser/extension_function_dispatcher.cc
@@ -292,7 +292,16 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
tracked_objects::ScopedProfile scoped_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(function->name()),
tracked_objects::ScopedProfile::ENABLED);
+ base::ElapsedTimer timer;
function->Run()->Execute();
+ // 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.
+ // Note: Many functions execute finish asynchronously, so this time is not
+ // always a representation of total time taken. See also
+ // Extensions.Functions.TotalExecutionTime.
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.SynchronousExecutionTime",
+ timer.Elapsed());
} else {
function->OnQuotaExceeded(violation_error);
}
@@ -402,7 +411,16 @@ void ExtensionFunctionDispatcher::DispatchWithCallbackInternal(
tracked_objects::ScopedProfile scoped_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(function->name()),
tracked_objects::ScopedProfile::ENABLED);
+ base::ElapsedTimer timer;
function->Run()->Execute();
+ // 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.
+ // Note: Many functions execute finish asynchronously, so this time is not
+ // always a representation of total time taken. See also
+ // Extensions.Functions.TotalExecutionTime.
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.SynchronousExecutionTime",
+ timer.Elapsed());
} else {
function->OnQuotaExceeded(violation_error);
}
« no previous file with comments | « extensions/browser/extension_function.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698