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

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: nits. 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 34e6f38a5bf0056a8cc297808eb5eef2abbd199c..0cf0e4d2de7349149ccdc99142e7970a65f343f0 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker.h
+++ b/base/trace_event/heap_profiler_allocation_context_tracker.h
@@ -23,6 +23,17 @@ namespace trace_event {
// details.
class BASE_EXPORT AllocationContextTracker {
public:
+ class ScopedTaskExecutionEvent {
+ public:
+ ScopedTaskExecutionEvent(const char* category_group,
+ const char* posted_reason);
Primiano Tucci (use gerrit) 2016/03/25 01:56:31 I think these should be called poster_task_file_na
ssid 2016/03/28 18:14:49 calling it context, can change if you prefer to be
+
+ ~ScopedTaskExecutionEvent();
+
+ private:
+ const char* category_;
+ };
+
// Globally enables capturing allocation context.
// TODO(ruuda): Should this be replaced by |EnableCapturing| in the future?
// Or at least have something that guards agains enable -> disable -> enable?
@@ -67,9 +78,16 @@ class BASE_EXPORT AllocationContextTracker {
static subtle::Atomic32 capture_enabled_;
+ void PushCurrentCategoryName(const char* category);
Primiano Tucci (use gerrit) 2016/03/25 01:56:31 I'm a bit confused by the "Category" name here. Ca
ssid 2016/03/28 18:14:49 Hm it is not exactly task name. To be specific I s
+ void PopCurrentCategoryName(const char* category);
+
// The pseudo stack where frames are |TRACE_EVENT| names.
std::vector<StackFrame> pseudo_stack_;
+ // Category can be nested when tasks are nested. So, a stack is used and the
+ // last item is taken for the current allocation.
+ std::vector<const char*> categories_;
+
DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker);
};

Powered by Google App Engine
This is Rietveld 408576698