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

Unified Diff: src/debug/debug.cc

Issue 1478613004: [debugger] track debugger feature usage via histogram. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « src/debug/debug.h ('k') | src/profiler/cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 3830d8eed863c3092529de7f64016e80296a98ca..798a2f4e43cbbf1906674ed12703da791ab734b6 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -43,6 +43,7 @@ Debug::Debug(Isolate* isolate)
break_on_exception_(false),
break_on_uncaught_exception_(false),
debug_info_list_(NULL),
+ feature_tracker_(isolate),
isolate_(isolate) {
ThreadInit();
}
@@ -316,6 +317,15 @@ Handle<Object> BreakLocation::BreakPointObjects() const {
}
+void DebugFeatureTracker::Track(DebugFeatureTracker::Feature feature) {
+ uint32_t mask = 1 << feature;
+ // Only count one sample per feature and isolate.
+ if (bitfield_ & mask) return;
+ isolate_->counters()->debug_feature_usage()->AddSample(feature);
+ bitfield_ |= mask;
+}
+
+
// Threading support.
void Debug::ThreadInit() {
thread_local_.break_count_ = 0;
@@ -396,6 +406,9 @@ bool Debug::Load() {
debug_context_ = Handle<Context>::cast(
isolate_->global_handles()->Create(*context));
+
+ feature_tracker()->Track(DebugFeatureTracker::kActive);
+
return true;
}
@@ -625,6 +638,8 @@ bool Debug::SetBreakPoint(Handle<JSFunction> function,
*source_position = location.statement_position();
location.SetBreakPoint(break_point_object);
+ feature_tracker()->Track(DebugFeatureTracker::kBreakPoint);
+
// At least one active break point now.
return debug_info->GetBreakPointCount() > 0;
}
@@ -666,6 +681,8 @@ bool Debug::SetBreakPointForScript(Handle<Script> script,
debug_info, ALL_BREAK_LOCATIONS, position, alignment);
location.SetBreakPoint(break_point_object);
+ feature_tracker()->Track(DebugFeatureTracker::kBreakPoint);
+
position = (alignment == STATEMENT_ALIGNED) ? location.statement_position()
: location.position();
@@ -874,6 +891,8 @@ void Debug::PrepareStep(StepAction step_action,
JavaScriptFrameIterator frames_it(isolate_, id);
JavaScriptFrame* frame = frames_it.frame();
+ feature_tracker()->Track(DebugFeatureTracker::kStepping);
+
// First of all ensure there is one-shot break points in the top handler
// if any.
FloodHandlerWithOneShot();
« no previous file with comments | « src/debug/debug.h ('k') | src/profiler/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698