| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the Windows-specific declarations for trace_event.h. | 5 // This file contains the Windows-specific declarations for trace_event.h. |
| 6 #ifndef BASE_TRACE_EVENT_WIN_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_WIN_H_ |
| 7 #define BASE_TRACE_EVENT_WIN_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_WIN_H_ |
| 8 #pragma once | 8 #pragma once |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include "base/event_trace_provider_win.h" | 11 #include "base/event_trace_provider_win.h" |
| 12 | 12 |
| 13 #define TRACE_EVENT_BEGIN(name, id, extra) \ | 13 #define TRACE_EVENT_BEGIN(name, id, extra) \ |
| 14 base::TraceLog::Trace(name, \ | 14 base::TraceLog::Trace(name, \ |
| 15 base::TraceLog::EVENT_BEGIN, \ | 15 base::TraceLog::EVENT_BEGIN, \ |
| 16 reinterpret_cast<const void*>(id), \ | 16 reinterpret_cast<const void*>(id), \ |
| 17 extra); | 17 extra); |
| 18 | 18 |
| 19 #define TRACE_EVENT_END(name, id, extra) \ | 19 #define TRACE_EVENT_END(name, id, extra) \ |
| 20 base::TraceLog::Trace(name, \ | 20 base::TraceLog::Trace(name, \ |
| 21 base::TraceLog::EVENT_END, \ | 21 base::TraceLog::EVENT_END, \ |
| 22 reinterpret_cast<const void*>(id), \ | 22 reinterpret_cast<const void*>(id), \ |
| 23 extra); | 23 extra); |
| 24 | 24 |
| 25 #define TRACE_EVENT_INSTANT(name, id, extra) \ | 25 #define TRACE_EVENT_INSTANT(name, id, extra) \ |
| 26 base::TraceLog::Trace(name, \ | 26 base::TraceLog::Trace(name, \ |
| 27 base::TraceLog::EVENT_INSTANT, \ | 27 base::TraceLog::EVENT_INSTANT, \ |
| 28 reinterpret_cast<const void*>(id), \ | 28 reinterpret_cast<const void*>(id), \ |
| 29 extra); | 29 extra); |
| 30 | 30 |
| 31 // Fwd. | 31 // Fwd. |
| 32 template <typename Type> | 32 template <typename Type> |
| 33 struct StaticMemorySingletonTraits; | 33 struct StaticMemorySingletonTraits; |
| 34 | 34 |
| 35 namespace base { | 35 namespace base { |
| 36 namespace debug { |
| 36 | 37 |
| 37 // This EtwTraceProvider subclass implements ETW logging | 38 // This EtwTraceProvider subclass implements ETW logging |
| 38 // for the macros above on Windows. | 39 // for the macros above on Windows. |
| 39 class TraceLog : public EtwTraceProvider { | 40 class TraceLog : public EtwTraceProvider { |
| 40 public: | 41 public: |
| 41 enum EventType { | 42 enum EventType { |
| 42 EVENT_BEGIN, | 43 EVENT_BEGIN, |
| 43 EVENT_END, | 44 EVENT_END, |
| 44 EVENT_INSTANT | 45 EVENT_INSTANT |
| 45 }; | 46 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return enable_level() >= TRACE_LEVEL_INFORMATION; | 89 return enable_level() >= TRACE_LEVEL_INFORMATION; |
| 89 } | 90 } |
| 90 | 91 |
| 91 // Emit a trace of type |type| containing |name|, |id|, and |extra|. | 92 // Emit a trace of type |type| containing |name|, |id|, and |extra|. |
| 92 // Note: |name| and |extra| must be NULL, or a zero-terminated string of | 93 // Note: |name| and |extra| must be NULL, or a zero-terminated string of |
| 93 // length |name_len| or |extra_len| respectively. | 94 // length |name_len| or |extra_len| respectively. |
| 94 // Note: if name_len or extra_len are -1, the length of the corresponding | 95 // Note: if name_len or extra_len are -1, the length of the corresponding |
| 95 // string will be used. | 96 // string will be used. |
| 96 void TraceEvent(const char* name, | 97 void TraceEvent(const char* name, |
| 97 size_t name_len, | 98 size_t name_len, |
| 98 base::TraceLog::EventType type, | 99 EventType type, |
| 99 const void* id, | 100 const void* id, |
| 100 const char* extra, | 101 const char* extra, |
| 101 size_t extra_len); | 102 size_t extra_len); |
| 102 | 103 |
| 103 // Exposed for unittesting only, allows resurrecting our | 104 // Exposed for unittesting only, allows resurrecting our |
| 104 // singleton instance post-AtExit processing. | 105 // singleton instance post-AtExit processing. |
| 105 static void Resurrect(); | 106 static void Resurrect(); |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 // Ensure only the provider can construct us. | 109 // Ensure only the provider can construct us. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 134 // The event format consists of: | 135 // The event format consists of: |
| 135 // The "name" string as a zero-terminated ASCII string. | 136 // The "name" string as a zero-terminated ASCII string. |
| 136 // The id pointer in the machine bitness. | 137 // The id pointer in the machine bitness. |
| 137 // The "extra" string as a zero-terminated ASCII string. | 138 // The "extra" string as a zero-terminated ASCII string. |
| 138 // Optionally the stack trace, consisting of a DWORD "depth", followed | 139 // Optionally the stack trace, consisting of a DWORD "depth", followed |
| 139 // by an array of void* (machine bitness) of length "depth". | 140 // by an array of void* (machine bitness) of length "depth". |
| 140 | 141 |
| 141 // Forward decl. | 142 // Forward decl. |
| 142 struct TraceLogSingletonTraits; | 143 struct TraceLogSingletonTraits; |
| 143 | 144 |
| 145 } // nemspace debug |
| 144 } // namespace base | 146 } // namespace base |
| 145 | 147 |
| 146 #endif // BASE_TRACE_EVENT_WIN_H_ | 148 #endif // BASE_DEBUG_TRACE_EVENT_WIN_H_ |
| OLD | NEW |