| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file contains the Windows-specific exporting to ETW. | |
| 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ | |
| 7 #define BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ | |
| 8 | |
| 9 #include "base/base_export.h" | |
| 10 #include "base/trace_event/trace_event_impl.h" | |
| 11 | |
| 12 // Fwd. | |
| 13 template <typename Type> | |
| 14 struct StaticMemorySingletonTraits; | |
| 15 | |
| 16 namespace base { | |
| 17 namespace trace_event { | |
| 18 | |
| 19 class BASE_EXPORT TraceEventETWExport { | |
| 20 public: | |
| 21 ~TraceEventETWExport(); | |
| 22 | |
| 23 // Retrieves the singleton. | |
| 24 // Note that this may return NULL post-AtExit processing. | |
| 25 static TraceEventETWExport* GetInstance(); | |
| 26 | |
| 27 // Enables/disables exporting of events to ETW. If disabled, | |
| 28 // AddEvent and AddCustomEvent will simply return when called. | |
| 29 static void EnableETWExport(); | |
| 30 static void DisableETWExport(); | |
| 31 | |
| 32 static bool isETWExportEnabled() { | |
| 33 return (GetInstance() && GetInstance()->ETWExportEnabled_); | |
| 34 } | |
| 35 | |
| 36 // Exports an event to ETW. This is mainly used in | |
| 37 // TraceLog::AddTraceEventWithThreadIdAndTimestamp to export internal events. | |
| 38 static void AddEvent( | |
| 39 char phase, | |
| 40 const unsigned char* category_group_enabled, | |
| 41 const char* name, | |
| 42 unsigned long long id, | |
| 43 int num_args, | |
| 44 const char** arg_names, | |
| 45 const unsigned char* arg_types, | |
| 46 const unsigned long long* arg_values, | |
| 47 const scoped_refptr<ConvertableToTraceFormat>* convertable_values); | |
| 48 | |
| 49 // Exports an event to ETW. This should be used when exporting an event only | |
| 50 // to ETW. Supports three arguments to be passed to ETW. | |
| 51 // TODO(georgesak): Allow different providers. | |
| 52 static void AddCustomEvent(const char* name, | |
| 53 char const* phase, | |
| 54 const char* arg_name_1, | |
| 55 const char* arg_value_1, | |
| 56 const char* arg_name_2, | |
| 57 const char* arg_value_2, | |
| 58 const char* arg_name_3, | |
| 59 const char* arg_value_3); | |
| 60 | |
| 61 void Resurrect(); | |
| 62 | |
| 63 private: | |
| 64 bool ETWExportEnabled_; | |
| 65 // Ensure only the provider can construct us. | |
| 66 friend struct StaticMemorySingletonTraits<TraceEventETWExport>; | |
| 67 TraceEventETWExport(); | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(TraceEventETWExport); | |
| 70 }; | |
| 71 | |
| 72 } // namespace trace_event | |
| 73 } // namespace base | |
| 74 | |
| 75 #endif // BASE_TRACE_EVENT_TRACE_EVENT_ETW_EXPORT_WIN_H_ | |
| OLD | NEW |