OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Trace events are for tracking application performance. | 5 // Trace events are for tracking application performance. |
6 // | 6 // |
7 // Events are issued against categories. Whereas LOG's | 7 // Events are issued against categories. Whereas LOG's |
8 // categories are statically defined, TRACE categories are created | 8 // categories are statically defined, TRACE categories are created |
9 // implicitly with a string. For example: | 9 // implicitly with a string. For example: |
10 // TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent") | 10 // TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent") |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 int INTERNAL_TRACE_EVENT_UID(begin_event_id) = \ | 271 int INTERNAL_TRACE_EVENT_UID(begin_event_id) = \ |
272 base::debug::TraceLog::GetInstance()->AddTraceEvent( \ | 272 base::debug::TraceLog::GetInstance()->AddTraceEvent( \ |
273 base::debug::TRACE_EVENT_PHASE_BEGIN, \ | 273 base::debug::TRACE_EVENT_PHASE_BEGIN, \ |
274 INTERNAL_TRACE_EVENT_UID(catstatic), \ | 274 INTERNAL_TRACE_EVENT_UID(catstatic), \ |
275 name, arg1_name, arg1_val, arg2_name, arg2_val, -1, 0, false); \ | 275 name, arg1_name, arg1_val, arg2_name, arg2_val, -1, 0, false); \ |
276 INTERNAL_TRACE_EVENT_UID(profileScope).Initialize( \ | 276 INTERNAL_TRACE_EVENT_UID(profileScope).Initialize( \ |
277 INTERNAL_TRACE_EVENT_UID(catstatic), name, \ | 277 INTERNAL_TRACE_EVENT_UID(catstatic), name, \ |
278 INTERNAL_TRACE_EVENT_UID(begin_event_id), threshold); \ | 278 INTERNAL_TRACE_EVENT_UID(begin_event_id), threshold); \ |
279 } | 279 } |
280 | 280 |
281 class RefCountedBytes; | 281 namespace base { |
282 | 282 |
283 namespace base { | 283 class RefCountedString; |
284 | 284 |
285 namespace debug { | 285 namespace debug { |
286 | 286 |
287 // Categories allow enabling/disabling of streams of trace events | 287 // Categories allow enabling/disabling of streams of trace events |
288 struct TraceCategory { | 288 struct TraceCategory { |
289 const char* name; | 289 const char* name; |
290 volatile bool enabled; | 290 volatile bool enabled; |
291 }; | 291 }; |
292 | 292 |
293 const size_t kTraceMaxNumArgs = 2; | 293 const size_t kTraceMaxNumArgs = 2; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 private: | 432 private: |
433 unsigned long process_id_; | 433 unsigned long process_id_; |
434 unsigned long thread_id_; | 434 unsigned long thread_id_; |
435 TimeTicks timestamp_; | 435 TimeTicks timestamp_; |
436 TraceEventPhase phase_; | 436 TraceEventPhase phase_; |
437 const TraceCategory* category_; | 437 const TraceCategory* category_; |
438 const char* name_; | 438 const char* name_; |
439 const char* arg_names_[kTraceMaxNumArgs]; | 439 const char* arg_names_[kTraceMaxNumArgs]; |
440 TraceValue arg_values_[kTraceMaxNumArgs]; | 440 TraceValue arg_values_[kTraceMaxNumArgs]; |
441 scoped_refptr<RefCountedBytes> parameter_copy_storage_; | 441 scoped_refptr<base::RefCountedString> parameter_copy_storage_; |
442 }; | 442 }; |
443 | 443 |
444 | 444 |
445 class BASE_API TraceLog { | 445 class BASE_API TraceLog { |
446 public: | 446 public: |
447 static TraceLog* GetInstance(); | 447 static TraceLog* GetInstance(); |
448 | 448 |
449 // Global enable of tracing. Currently enables all categories or not. | 449 // Global enable of tracing. Currently enables all categories or not. |
450 // TODO(scheib): Replace with an Enable/DisableCategory() that | 450 // TODO(scheib): Replace with an Enable/DisableCategory() that |
451 // implicitly controls the global logging state. | 451 // implicitly controls the global logging state. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 Data* p_data_; | 589 Data* p_data_; |
590 Data data_; | 590 Data data_; |
591 }; | 591 }; |
592 | 592 |
593 } // namespace internal | 593 } // namespace internal |
594 | 594 |
595 } // namespace debug | 595 } // namespace debug |
596 } // namespace base | 596 } // namespace base |
597 | 597 |
598 #endif // BASE_DEBUG_TRACE_EVENT_H_ | 598 #endif // BASE_DEBUG_TRACE_EVENT_H_ |
OLD | NEW |