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

Unified Diff: base/trace_event/heap_profiler_allocation_context_tracker.h

Issue 1784133002: [tracing] Adding task information to heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix macros again and the builds. Created 4 years, 9 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 5d32c64952266475fcb440476febf208f618a39f..28e2cc9ca934b5c0bddf77c9f99727cbd094252e 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker.h
+++ b/base/trace_event/heap_profiler_allocation_context_tracker.h
@@ -58,6 +58,11 @@ class BASE_EXPORT AllocationContextTracker {
// Pops a frame from the thread-local pseudo stack.
void PopPseudoStackFrame(StackFrame frame);
+ // Push and pop current task's context. A stack is used to support nested
+ // tasks and the top of the stack will be used in allocation context.
+ void PushCurrentTaskContext(const char* context);
Primiano Tucci (use gerrit) 2016/03/31 15:37:16 I aware about the fact that I am a real pain on na
ssid 2016/03/31 16:02:49 Yes but I feel this will be reused for some other
Primiano Tucci (use gerrit) 2016/03/31 16:10:59 Ahh ok, if you have upcoming use cases in mind it'
ssid 2016/04/01 04:34:54 I changed the comment and function name. wdyt?
Primiano Tucci (use gerrit) 2016/04/01 08:36:16 Much better, thanks.
+ void PopCurrentTaskContext(const char* context);
+
// Returns a snapshot of the current thread-local context.
AllocationContext GetContextSnapshot();
@@ -74,6 +79,10 @@ class BASE_EXPORT AllocationContextTracker {
// The thread name is used as the first entry in the pseudo stack.
const char* thread_name_;
+ // Stack of tasks' contexts. Context serves as a different dimension than
+ // pseudo stack to study the heap.
Primiano Tucci (use gerrit) 2016/03/31 15:37:16 s/to study the heap/to cluster allocations/
ssid 2016/04/01 04:34:54 Done.
+ std::vector<const char*> task_contexts_;
+
DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker);
};

Powered by Google App Engine
This is Rietveld 408576698