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

Side by Side 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: nits. 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 unified diff | Download patch
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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Returns the thread-local instance, creating one if necessary. Returns 46 // Returns the thread-local instance, creating one if necessary. Returns
47 // always a valid instance, unless it is called re-entrantly, in which case 47 // always a valid instance, unless it is called re-entrantly, in which case
48 // returns nullptr in the nested calls. 48 // returns nullptr in the nested calls.
49 static AllocationContextTracker* GetInstanceForCurrentThread(); 49 static AllocationContextTracker* GetInstanceForCurrentThread();
50 50
51 // Set the thread name in the AllocationContextTracker of the current thread 51 // Set the thread name in the AllocationContextTracker of the current thread
52 // if capture is enabled. 52 // if capture is enabled.
53 static void SetCurrentThreadName(const char* name); 53 static void SetCurrentThreadName(const char* name);
54 54
55 void start_ignore_scope() { ignore_scope_count_++; }
Primiano Tucci (use gerrit) 2016/04/20 16:34:57 add a comment plz. One for both is ok.
ssid 2016/04/21 01:07:46 Sorry uploaded older patch here.
56 void end_ignore_scope() {
Primiano Tucci (use gerrit) 2016/04/20 16:34:57 s/start/begin/ s/start/end/
ssid 2016/04/21 01:07:46 I think you meant begin and end here.
57 DCHECK(ignore_scope_count_);
58 ignore_scope_count_--;
59 }
60
55 // Pushes a frame onto the thread-local pseudo stack. 61 // Pushes a frame onto the thread-local pseudo stack.
56 void PushPseudoStackFrame(StackFrame frame); 62 void PushPseudoStackFrame(StackFrame frame);
57 63
58 // Pops a frame from the thread-local pseudo stack. 64 // Pops a frame from the thread-local pseudo stack.
59 void PopPseudoStackFrame(StackFrame frame); 65 void PopPseudoStackFrame(StackFrame frame);
60 66
61 // Push and pop current task's context. A stack is used to support nested 67 // Push and pop current task's context. A stack is used to support nested
62 // tasks and the top of the stack will be used in allocation context. 68 // tasks and the top of the stack will be used in allocation context.
63 void PushCurrentTaskContext(const char* context); 69 void PushCurrentTaskContext(const char* context);
64 void PopCurrentTaskContext(const char* context); 70 void PopCurrentTaskContext(const char* context);
(...skipping 11 matching lines...) Expand all
76 // The pseudo stack where frames are |TRACE_EVENT| names. 82 // The pseudo stack where frames are |TRACE_EVENT| names.
77 std::vector<StackFrame> pseudo_stack_; 83 std::vector<StackFrame> pseudo_stack_;
78 84
79 // The thread name is used as the first entry in the pseudo stack. 85 // The thread name is used as the first entry in the pseudo stack.
80 const char* thread_name_; 86 const char* thread_name_;
81 87
82 // Stack of tasks' contexts. Context serves as a different dimension than 88 // Stack of tasks' contexts. Context serves as a different dimension than
83 // pseudo stack to cluster allocations. 89 // pseudo stack to cluster allocations.
84 std::vector<const char*> task_contexts_; 90 std::vector<const char*> task_contexts_;
85 91
92 uint32_t ignore_scope_count_;
Primiano Tucci (use gerrit) 2016/04/20 16:34:57 s/count/depth/
Dmitry Skiba 2016/04/20 16:59:15 Also, size_t is better here.
ssid 2016/04/21 01:07:46 Done.
ssid 2016/04/21 01:07:46 Done.
93
86 DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker); 94 DISALLOW_COPY_AND_ASSIGN(AllocationContextTracker);
87 }; 95 };
88 96
89 } // namespace trace_event 97 } // namespace trace_event
90 } // namespace base 98 } // namespace base
91 99
92 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_ 100 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_CONTEXT_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698