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

Unified Diff: extensions/renderer/binding_generating_native_handler.cc

Issue 2395803003: [Extensions] Add metrics for execution time of binding.js (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/binding_generating_native_handler.cc
diff --git a/extensions/renderer/binding_generating_native_handler.cc b/extensions/renderer/binding_generating_native_handler.cc
index 8912017e7f17445468d86e097290444ad57461f2..5aa161be73fbcd927e06793c73d620caf993b221 100644
--- a/extensions/renderer/binding_generating_native_handler.cc
+++ b/extensions/renderer/binding_generating_native_handler.cc
@@ -5,6 +5,8 @@
#include "extensions/renderer/binding_generating_native_handler.h"
#include "base/macros.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/timer/elapsed_timer.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/v8_helpers.h"
@@ -19,6 +21,7 @@ BindingGeneratingNativeHandler::BindingGeneratingNativeHandler(
: context_(context), api_name_(api_name), bind_to_(bind_to) {}
v8::Local<v8::Object> BindingGeneratingNativeHandler::NewInstance() {
+ base::ElapsedTimer timer;
// This long sequence of commands effectively runs the JavaScript code,
// such that result[bind_to] is the compiled schema for |api_name|:
//
@@ -105,6 +108,13 @@ v8::Local<v8::Object> BindingGeneratingNativeHandler::NewInstance() {
NOTREACHED();
return v8::Local<v8::Object>();
}
+
+ // Log UMA with microsecond accuracy*; maxes at 10 seconds.
+ // *Obviously, limited by our TimeTicks implementation, but as close as
+ // possible.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.ApiBindingObjectGenerationTime",
+ timer.Elapsed().InMicroseconds(),
+ 1, 10000000, 100);
// return result;
return scope.Escape(object);
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698