| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/atomicops.h" | 13 #include "base/atomicops.h" |
| 14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/memory/ref_counted_memory.h" | 18 #include "base/memory/ref_counted_memory.h" |
| 19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/synchronization/condition_variable.h" | 22 #include "base/synchronization/condition_variable.h" |
| 23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
| 24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
| 25 #include "base/threading/thread_local.h" | 25 #include "base/threading/thread_local.h" |
| 26 | 26 |
| 27 // Older style trace macros with explicit id and extra data | 27 // Older style trace macros with explicit id and extra data |
| 28 // Only these macros result in publishing data to ETW as currently implemented. | 28 // Only these macros result in publishing data to ETW as currently implemented. |
| 29 // TODO(georgesak): Update/replace these with new ETW macros. | |
| 30 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ | 29 #define TRACE_EVENT_BEGIN_ETW(name, id, extra) \ |
| 31 base::trace_event::TraceLog::AddTraceEventEtw( \ | 30 base::trace_event::TraceLog::AddTraceEventEtw( \ |
| 32 TRACE_EVENT_PHASE_BEGIN, \ | 31 TRACE_EVENT_PHASE_BEGIN, \ |
| 33 name, reinterpret_cast<const void*>(id), extra) | 32 name, reinterpret_cast<const void*>(id), extra) |
| 34 | 33 |
| 35 #define TRACE_EVENT_END_ETW(name, id, extra) \ | 34 #define TRACE_EVENT_END_ETW(name, id, extra) \ |
| 36 base::trace_event::TraceLog::AddTraceEventEtw( \ | 35 base::trace_event::TraceLog::AddTraceEventEtw( \ |
| 37 TRACE_EVENT_PHASE_END, \ | 36 TRACE_EVENT_PHASE_END, \ |
| 38 name, reinterpret_cast<const void*>(id), extra) | 37 name, reinterpret_cast<const void*>(id), extra) |
| 39 | 38 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // value with zero or more of the following bits. Used in this class only. | 439 // value with zero or more of the following bits. Used in this class only. |
| 441 // The TRACE_EVENT macros should only use the value as a bool. | 440 // The TRACE_EVENT macros should only use the value as a bool. |
| 442 // These values must be in sync with macro values in TraceEvent.h in Blink. | 441 // These values must be in sync with macro values in TraceEvent.h in Blink. |
| 443 enum CategoryGroupEnabledFlags { | 442 enum CategoryGroupEnabledFlags { |
| 444 // Category group enabled for the recording mode. | 443 // Category group enabled for the recording mode. |
| 445 ENABLED_FOR_RECORDING = 1 << 0, | 444 ENABLED_FOR_RECORDING = 1 << 0, |
| 446 // Category group enabled for the monitoring mode. | 445 // Category group enabled for the monitoring mode. |
| 447 ENABLED_FOR_MONITORING = 1 << 1, | 446 ENABLED_FOR_MONITORING = 1 << 1, |
| 448 // Category group enabled by SetEventCallbackEnabled(). | 447 // Category group enabled by SetEventCallbackEnabled(). |
| 449 ENABLED_FOR_EVENT_CALLBACK = 1 << 2, | 448 ENABLED_FOR_EVENT_CALLBACK = 1 << 2, |
| 450 // Category group enabled to export events to ETW. | |
| 451 ENABLED_FOR_ETW_EXPORT = 1 << 3 | |
| 452 }; | 449 }; |
| 453 | 450 |
| 454 static TraceLog* GetInstance(); | 451 static TraceLog* GetInstance(); |
| 455 | 452 |
| 456 // Get set of known category groups. This can change as new code paths are | 453 // Get set of known category groups. This can change as new code paths are |
| 457 // reached. The known category groups are inserted into |category_groups|. | 454 // reached. The known category groups are inserted into |category_groups|. |
| 458 void GetKnownCategoryGroups(std::vector<std::string>* category_groups); | 455 void GetKnownCategoryGroups(std::vector<std::string>* category_groups); |
| 459 | 456 |
| 460 // Retrieves a copy (for thread-safety) of the current CategoryFilter. | 457 // Retrieves a copy (for thread-safety) of the current CategoryFilter. |
| 461 CategoryFilter GetCurrentCategoryFilter(); | 458 CategoryFilter GetCurrentCategoryFilter(); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 subtle::AtomicWord generation_; | 808 subtle::AtomicWord generation_; |
| 812 bool use_worker_thread_; | 809 bool use_worker_thread_; |
| 813 | 810 |
| 814 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 811 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 815 }; | 812 }; |
| 816 | 813 |
| 817 } // namespace trace_event | 814 } // namespace trace_event |
| 818 } // namespace base | 815 } // namespace base |
| 819 | 816 |
| 820 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 817 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| OLD | NEW |