Index: base/debug/trace_event_win.h |
diff --git a/base/debug/trace_event_win.h b/base/debug/trace_event_win.h |
index 2a900bb4314f055b67a24bfea4bcdc766a569424..725a8216e1c767f9cec0c5c54b0465f0554bb9dc 100644 |
--- a/base/debug/trace_event_win.h |
+++ b/base/debug/trace_event_win.h |
@@ -10,6 +10,7 @@ |
#include "base/base_export.h" |
#include "base/debug/trace_event.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/win/event_trace_provider.h" |
// Fwd. |
@@ -58,6 +59,27 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider { |
return Trace(name, -1, type, id, extra, -1); |
} |
+ // Emit a trace. The event is defined by |category_group|, |name| and |type|. |
chrisha
2013/09/09 16:41:12
Emit a trace event.
fdoray
2013/09/09 19:38:59
Done.
|
+ // |id| helps to identify related events. |
+ // |thread_name| is the name of the thread that produced the event. |
+ // |num_args| indicates the number of custom arguments to add to the trace. |
+ // It must be <= |kTraceMaxNumArgs|. The names of the arguments are specified |
+ // in |arg_names|. |arg_types| indicates how to interpret the value of |
+ // each argument. Finally, the value of an argument is obtained from |
+ // |convertable_values| if its type is TRACE_VALUE_TYPE_CONVERTABLE, |
+ // from |arg_values| otherwise. |
+ static void TraceWithArgs( |
+ const char* category_group, |
+ const char* name, |
+ char type, |
+ unsigned long long id, |
+ const std::string& thread_name, |
+ int num_args, |
+ const char** arg_names, |
+ const unsigned char* arg_types, |
+ const unsigned long long* arg_values, |
+ scoped_ptr<ConvertableToTraceFormat> convertable_values[]); |
+ |
// Retrieves the singleton. |
// Note that this may return NULL post-AtExit processing. |
static TraceEventETWProvider* GetInstance(); |
@@ -67,18 +89,6 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider { |
return enable_level() >= TRACE_LEVEL_INFORMATION; |
} |
- // Emit a trace of type |type| containing |name|, |id|, and |extra|. |
- // Note: |name| and |extra| must be NULL, or a zero-terminated string of |
- // length |name_len| or |extra_len| respectively. |
- // Note: if name_len or extra_len are -1, the length of the corresponding |
- // string will be used. |
- void TraceEvent(const char* name, |
- size_t name_len, |
- char type, |
- const void* id, |
- const char* extra, |
- size_t extra_len); |
- |
// Exposed for unittesting only, allows resurrecting our |
// singleton instance post-AtExit processing. |
static void Resurrect(); |
@@ -88,6 +98,36 @@ class BASE_EXPORT TraceEventETWProvider : public base::win::EtwTraceProvider { |
friend struct StaticMemorySingletonTraits<TraceEventETWProvider>; |
TraceEventETWProvider(); |
+ // Emit a trace. |
chrisha
2013/09/09 16:41:12
Emit a trace event.
fdoray
2013/09/09 19:38:59
Done.
|
+ // It's possible to add up to |kTraceMaxNumArgs| custom arguments to |
+ // the trace. |arg_values| and |arg_names| are arrays of |num_args| strings |
+ // that indicate the names and values of the custom arguments. |
+ // The payload of the produced trace follows this format: |
+ // - Name (string) |
+ // - Id (unsigned long long) |
+ // - Category (string) |
+ // - Thread name (string) |
+ // - Name of parameter 1, or '\0' (string) |
+ // - Value of parameter 1, or '\0' (string) |
+ // - Name of parameter 2, or '\0' (string) |
+ // - Value of parameter 2, or '\0' (string) |
+ // If stack capture is enabled for the trace session: |
+ // - Stack size (DWORD) |
+ // - Stack pointers (stack size * void*) |
+ // Strings are null-terminated and have a variable size. |
+ // |
+ // Note: |name| and |category_group| must be NULL, or a zero-terminated |
+ // string. The length of |name| must be specified by |name_len|. |
chrisha
2013/09/09 16:41:12
Why do we need to specify a name_len and not a cat
fdoray
2013/09/09 19:38:59
Done.
I initially kept the |name_len| parameter f
|
+ void TraceEvent(const char* category_group, |
+ const char* name, |
+ size_t name_len, |
+ char type, |
+ unsigned long long id, |
+ const std::string& thread_name, |
+ int num_args, |
+ const char** arg_names, |
+ std::string* arg_values); |
+ |
DISALLOW_COPY_AND_ASSIGN(TraceEventETWProvider); |
}; |