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

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

Issue 1839503002: [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Increase Backtrace frames, request even more frames 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
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | base/trace_event/trace_log.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_TRACE_EVENT_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_
6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ 6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_
7 7
8 // This header file defines implementation details of how the trace macros in 8 // This header file defines implementation details of how the trace macros in
9 // trace_event_common.h collect and store trace events. Anything not 9 // trace_event_common.h collect and store trace events. Anything not
10 // implementation-specific should go in trace_event_common.h instead of here. 10 // implementation-specific should go in trace_event_common.h instead of here.
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 private: 1049 private:
1050 const char* previous_state_; 1050 const char* previous_state_;
1051 }; 1051 };
1052 1052
1053 // ScopedTaskExecutionEvent records the current task's context in the heap 1053 // ScopedTaskExecutionEvent records the current task's context in the heap
1054 // profiler. 1054 // profiler.
1055 class ScopedTaskExecutionEvent { 1055 class ScopedTaskExecutionEvent {
1056 public: 1056 public:
1057 explicit ScopedTaskExecutionEvent(const char* task_context) 1057 explicit ScopedTaskExecutionEvent(const char* task_context)
1058 : context_(task_context) { 1058 : context_(task_context) {
1059 using base::trace_event::AllocationContextTracker;
1059 if (UNLIKELY( 1060 if (UNLIKELY(
1060 base::trace_event::AllocationContextTracker::capture_enabled())) { 1061 AllocationContextTracker::capture_mode() !=
1061 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() 1062 AllocationContextTracker::CaptureMode::DISABLED)) {
1063 AllocationContextTracker::GetInstanceForCurrentThread()
1062 ->PushCurrentTaskContext(context_); 1064 ->PushCurrentTaskContext(context_);
1063 } 1065 }
1064 } 1066 }
1065 1067
1066 ~ScopedTaskExecutionEvent() { 1068 ~ScopedTaskExecutionEvent() {
1069 using base::trace_event::AllocationContextTracker;
1067 if (UNLIKELY( 1070 if (UNLIKELY(
1068 base::trace_event::AllocationContextTracker::capture_enabled())) { 1071 AllocationContextTracker::capture_mode() !=
1069 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() 1072 AllocationContextTracker::CaptureMode::DISABLED)) {
1073 AllocationContextTracker::GetInstanceForCurrentThread()
1070 ->PopCurrentTaskContext(context_); 1074 ->PopCurrentTaskContext(context_);
1071 } 1075 }
1072 } 1076 }
1073 1077
1074 private: 1078 private:
1075 const char* context_; 1079 const char* context_;
1076 }; 1080 };
1077 1081
1078 } // namespace trace_event_internal 1082 } // namespace trace_event_internal
1079 1083
(...skipping 23 matching lines...) Expand all
1103 const char* name_; 1107 const char* name_;
1104 IDType id_; 1108 IDType id_;
1105 1109
1106 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1110 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1107 }; 1111 };
1108 1112
1109 } // namespace trace_event 1113 } // namespace trace_event
1110 } // namespace base 1114 } // namespace base
1111 1115
1112 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ 1116 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | base/trace_event/trace_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698