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

Side by Side Diff: base/trace_event/heap_profiler_allocation_context_tracker.h

Issue 2777343003: [memory-infra] Add api to enable heap profiling in MemoryDumpManager
Patch Set: nits. Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/trace_event/heap_profiler_allocation_context_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_ 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_
6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_ 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/debug/stack_trace.h" 12 #include "base/debug/stack_trace.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/trace_event/heap_profiler_allocation_context.h" 14 #include "base/trace_event/heap_profiler_allocation_context.h"
15 15
16 namespace base { 16 namespace base {
17 namespace trace_event { 17 namespace trace_event {
18 18
19 // The allocation context tracker keeps track of thread-local context for heap 19 // The allocation context tracker keeps track of thread-local context for heap
20 // profiling. It includes a pseudo stack of trace events. On every allocation 20 // profiling. It includes a pseudo stack of trace events. On every allocation
21 // the tracker provides a snapshot of its context in the form of an 21 // the tracker provides a snapshot of its context in the form of an
22 // |AllocationContext| that is to be stored together with the allocation 22 // |AllocationContext| that is to be stored together with the allocation
23 // details. 23 // details.
24 class BASE_EXPORT AllocationContextTracker { 24 class BASE_EXPORT AllocationContextTracker {
25 public: 25 public:
26 enum class CaptureMode: int32_t { 26 enum class CaptureMode : int32_t {
27 DISABLED, // Don't capture anything 27 DISABLED, // Don't capture anything
28 PSEUDO_STACK, // GetContextSnapshot() returns pseudo stack trace 28 PSEUDO_STACK, // GetContextSnapshot() returns pseudo stack trace
29 NATIVE_STACK // GetContextSnapshot() returns native (real) stack trace 29 NATIVE_STACK, // GetContextSnapshot() returns native (real) stack trace
30 BACKGROUND, // GetContextSnapshot() returns thread names and task contexts.
30 }; 31 };
31 32
32 // Stack frame constructed from trace events in codebase. 33 // Stack frame constructed from trace events in codebase.
33 struct BASE_EXPORT PseudoStackFrame { 34 struct BASE_EXPORT PseudoStackFrame {
34 const char* trace_event_category; 35 const char* trace_event_category;
35 const char* trace_event_name; 36 const char* trace_event_name;
36 37
37 bool operator==(const PseudoStackFrame& other) const { 38 bool operator==(const PseudoStackFrame& other) const {
38 return trace_event_category == other.trace_event_category && 39 return trace_event_category == other.trace_event_category &&
39 trace_event_name == other.trace_event_name; 40 trace_event_name == other.trace_event_name;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 113
113 uint32_t ignore_scope_depth_; 114 uint32_t ignore_scope_depth_;
114 115
115 DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker); 116 DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker);
116 }; 117 };
117 118
118 } // namespace trace_event 119 } // namespace trace_event
119 } // namespace base 120 } // namespace base
120 121
121 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_ 122 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/heap_profiler_allocation_context_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698