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

Unified Diff: base/trace_event/heap_profiler_allocation_context_tracker.h

Issue 1900223003: [tracing] Ignore tracing allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make heap_profiler.h and rebase 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: base/trace_event/heap_profiler_allocation_context_tracker.h
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.h b/base/trace_event/heap_profiler_allocation_context_tracker.h
index e5c8c187739b99afaa0f75995b1a534dd14a2e4d..632a4eface8740a9415337c41c6d9874fb107367 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker.h
+++ b/base/trace_event/heap_profiler_allocation_context_tracker.h
@@ -52,6 +52,15 @@ class BASE_EXPORT AllocationContextTracker {
// if capture is enabled.
static void SetCurrentThreadName(const char* name);
+ // Starts and ends a new ignore scope between which the allocations are
+ // ignored in the heap profiler. A dummy context that short circuits to
+ // "tracing_overhead" is returned for these allocations.
+ void begin_ignore_scope() { ignore_scope_depth_++; }
+ void end_ignore_scope() {
+ if (ignore_scope_depth_)
+ ignore_scope_depth_--;
+ }
+
// Pushes a frame onto the thread-local pseudo stack.
void PushPseudoStackFrame(const char* trace_event_name);
@@ -83,6 +92,8 @@ class BASE_EXPORT AllocationContextTracker {
// pseudo stack to cluster allocations.
std::vector<const char*> task_contexts_;
+ uint32_t ignore_scope_depth_;
+
DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker);
};

Powered by Google App Engine
This is Rietveld 408576698