OLD | NEW |
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 | 5 |
6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void CopyFrom(const TraceEvent& other); | 94 void CopyFrom(const TraceEvent& other); |
95 | 95 |
96 void Initialize( | 96 void Initialize( |
97 int thread_id, | 97 int thread_id, |
98 TimeTicks timestamp, | 98 TimeTicks timestamp, |
99 ThreadTicks thread_timestamp, | 99 ThreadTicks thread_timestamp, |
100 char phase, | 100 char phase, |
101 const unsigned char* category_group_enabled, | 101 const unsigned char* category_group_enabled, |
102 const char* name, | 102 const char* name, |
103 unsigned long long id, | 103 unsigned long long id, |
104 unsigned long long context_id, | |
105 unsigned long long bind_id, | 104 unsigned long long bind_id, |
106 int num_args, | 105 int num_args, |
107 const char** arg_names, | 106 const char** arg_names, |
108 const unsigned char* arg_types, | 107 const unsigned char* arg_types, |
109 const unsigned long long* arg_values, | 108 const unsigned long long* arg_values, |
110 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 109 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
111 unsigned int flags); | 110 unsigned int flags); |
112 | 111 |
113 void Reset(); | 112 void Reset(); |
114 | 113 |
(...skipping 11 matching lines...) Expand all Loading... |
126 TraceValue value, | 125 TraceValue value, |
127 std::string* out); | 126 std::string* out); |
128 | 127 |
129 TimeTicks timestamp() const { return timestamp_; } | 128 TimeTicks timestamp() const { return timestamp_; } |
130 ThreadTicks thread_timestamp() const { return thread_timestamp_; } | 129 ThreadTicks thread_timestamp() const { return thread_timestamp_; } |
131 char phase() const { return phase_; } | 130 char phase() const { return phase_; } |
132 int thread_id() const { return thread_id_; } | 131 int thread_id() const { return thread_id_; } |
133 TimeDelta duration() const { return duration_; } | 132 TimeDelta duration() const { return duration_; } |
134 TimeDelta thread_duration() const { return thread_duration_; } | 133 TimeDelta thread_duration() const { return thread_duration_; } |
135 unsigned long long id() const { return id_; } | 134 unsigned long long id() const { return id_; } |
136 unsigned long long context_id() const { return context_id_; } | |
137 unsigned int flags() const { return flags_; } | 135 unsigned int flags() const { return flags_; } |
138 | 136 |
139 // Exposed for unittesting: | 137 // Exposed for unittesting: |
140 | 138 |
141 const base::RefCountedString* parameter_copy_storage() const { | 139 const base::RefCountedString* parameter_copy_storage() const { |
142 return parameter_copy_storage_.get(); | 140 return parameter_copy_storage_.get(); |
143 } | 141 } |
144 | 142 |
145 const unsigned char* category_group_enabled() const { | 143 const unsigned char* category_group_enabled() const { |
146 return category_group_enabled_; | 144 return category_group_enabled_; |
147 } | 145 } |
148 | 146 |
149 const char* name() const { return name_; } | 147 const char* name() const { return name_; } |
150 | 148 |
151 #if defined(OS_ANDROID) | 149 #if defined(OS_ANDROID) |
152 void SendToATrace(); | 150 void SendToATrace(); |
153 #endif | 151 #endif |
154 | 152 |
155 private: | 153 private: |
156 // Note: these are ordered by size (largest first) for optimal packing. | 154 // Note: these are ordered by size (largest first) for optimal packing. |
157 TimeTicks timestamp_; | 155 TimeTicks timestamp_; |
158 ThreadTicks thread_timestamp_; | 156 ThreadTicks thread_timestamp_; |
159 TimeDelta duration_; | 157 TimeDelta duration_; |
160 TimeDelta thread_duration_; | 158 TimeDelta thread_duration_; |
161 // id_ can be used to store phase-specific data. | 159 // id_ can be used to store phase-specific data. |
162 unsigned long long id_; | 160 unsigned long long id_; |
163 // context_id_ is used to store context information. | |
164 unsigned long long context_id_; | |
165 TraceValue arg_values_[kTraceMaxNumArgs]; | 161 TraceValue arg_values_[kTraceMaxNumArgs]; |
166 const char* arg_names_[kTraceMaxNumArgs]; | 162 const char* arg_names_[kTraceMaxNumArgs]; |
167 scoped_refptr<ConvertableToTraceFormat> convertable_values_[kTraceMaxNumArgs]; | 163 scoped_refptr<ConvertableToTraceFormat> convertable_values_[kTraceMaxNumArgs]; |
168 const unsigned char* category_group_enabled_; | 164 const unsigned char* category_group_enabled_; |
169 const char* name_; | 165 const char* name_; |
170 scoped_refptr<base::RefCountedString> parameter_copy_storage_; | 166 scoped_refptr<base::RefCountedString> parameter_copy_storage_; |
171 // Depending on TRACE_EVENT_FLAG_HAS_PROCESS_ID the event will have either: | 167 // Depending on TRACE_EVENT_FLAG_HAS_PROCESS_ID the event will have either: |
172 // tid: thread_id_, pid: current_process_id (default case). | 168 // tid: thread_id_, pid: current_process_id (default case). |
173 // tid: -1, pid: process_id_ (when flags_ & TRACE_EVENT_FLAG_HAS_PROCESS_ID). | 169 // tid: -1, pid: process_id_ (when flags_ & TRACE_EVENT_FLAG_HAS_PROCESS_ID). |
174 union { | 170 union { |
175 int thread_id_; | 171 int thread_id_; |
176 int process_id_; | 172 int process_id_; |
177 }; | 173 }; |
178 unsigned int flags_; | 174 unsigned int flags_; |
179 unsigned long long bind_id_; | 175 unsigned long long bind_id_; |
180 unsigned char arg_types_[kTraceMaxNumArgs]; | 176 unsigned char arg_types_[kTraceMaxNumArgs]; |
181 char phase_; | 177 char phase_; |
182 | 178 |
183 DISALLOW_COPY_AND_ASSIGN(TraceEvent); | 179 DISALLOW_COPY_AND_ASSIGN(TraceEvent); |
184 }; | 180 }; |
185 | 181 |
186 } // namespace trace_event | 182 } // namespace trace_event |
187 } // namespace base | 183 } // namespace base |
188 | 184 |
189 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 185 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
OLD | NEW |