| Index: base/debug/trace_event_win.h
|
| ===================================================================
|
| --- base/debug/trace_event_win.h (revision 84291)
|
| +++ base/debug/trace_event_win.h (working copy)
|
| @@ -10,9 +10,29 @@
|
| #include <string>
|
|
|
| #include "base/base_api.h"
|
| -#include "base/debug/trace_event.h"
|
| #include "base/win/event_trace_provider.h"
|
|
|
| +#define TRACE_EVENT_BEGIN(name, id, extra) \
|
| + base::debug::TraceLog::Trace( \
|
| + name, \
|
| + base::debug::TraceLog::EVENT_BEGIN, \
|
| + reinterpret_cast<const void*>(id), \
|
| + extra);
|
| +
|
| +#define TRACE_EVENT_END(name, id, extra) \
|
| + base::debug::TraceLog::Trace( \
|
| + name, \
|
| + base::debug::TraceLog::EVENT_END, \
|
| + reinterpret_cast<const void*>(id), \
|
| + extra);
|
| +
|
| +#define TRACE_EVENT_INSTANT(name, id, extra) \
|
| + base::debug::TraceLog::Trace( \
|
| + name, \
|
| + base::debug::TraceLog::EVENT_INSTANT, \
|
| + reinterpret_cast<const void*>(id), \
|
| + extra);
|
| +
|
| // Fwd.
|
| template <typename Type>
|
| struct StaticMemorySingletonTraits;
|
| @@ -22,8 +42,14 @@
|
|
|
| // This EtwTraceProvider subclass implements ETW logging
|
| // for the macros above on Windows.
|
| -class BASE_API TraceEventETWProvider : public base::win::EtwTraceProvider {
|
| +class BASE_API TraceLog : public base::win::EtwTraceProvider {
|
| public:
|
| + enum EventType {
|
| + EVENT_BEGIN,
|
| + EVENT_END,
|
| + EVENT_INSTANT
|
| + };
|
| +
|
| // Start logging trace events.
|
| // This is a noop in this implementation.
|
| static bool StartTracing();
|
| @@ -37,14 +63,14 @@
|
| // be used for length.
|
| static void Trace(const char* name,
|
| size_t name_len,
|
| - TraceEventPhase type,
|
| + EventType type,
|
| const void* id,
|
| const char* extra,
|
| size_t extra_len);
|
|
|
| // Allows passing extra as a std::string for convenience.
|
| static void Trace(const char* name,
|
| - TraceEventPhase type,
|
| + EventType type,
|
| const void* id,
|
| const std::string& extra) {
|
| return Trace(name, -1, type, id, extra.c_str(), extra.length());
|
| @@ -53,7 +79,7 @@
|
| // Allows passing extra as a const char* to avoid constructing temporary
|
| // std::string instances where not needed.
|
| static void Trace(const char* name,
|
| - TraceEventPhase type,
|
| + EventType type,
|
| const void* id,
|
| const char* extra) {
|
| return Trace(name, -1, type, id, extra, -1);
|
| @@ -61,7 +87,7 @@
|
|
|
| // Retrieves the singleton.
|
| // Note that this may return NULL post-AtExit processing.
|
| - static TraceEventETWProvider* GetInstance();
|
| + static TraceLog* GetInstance();
|
|
|
| // Returns true iff tracing is turned on.
|
| bool IsTracing() {
|
| @@ -75,7 +101,7 @@
|
| // string will be used.
|
| void TraceEvent(const char* name,
|
| size_t name_len,
|
| - TraceEventPhase type,
|
| + EventType type,
|
| const void* id,
|
| const char* extra,
|
| size_t extra_len);
|
| @@ -86,10 +112,10 @@
|
|
|
| private:
|
| // Ensure only the provider can construct us.
|
| - friend struct StaticMemorySingletonTraits<TraceEventETWProvider>;
|
| - TraceEventETWProvider();
|
| + friend struct StaticMemorySingletonTraits<TraceLog>;
|
| + TraceLog();
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(TraceEventETWProvider);
|
| + DISALLOW_COPY_AND_ASSIGN(TraceLog);
|
| };
|
|
|
| // The ETW trace provider GUID.
|
|
|