Index: base/trace_event/trace_event_impl.cc |
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc |
index 72b46f92914c8d73d51068324f6c2a757371b5d1..4c8c2a9cb96ff0134a2df5fc9cd5321299e8f5dd 100644 |
--- a/base/trace_event/trace_event_impl.cc |
+++ b/base/trace_event/trace_event_impl.cc |
@@ -35,6 +35,7 @@ |
#include "base/trace_event/trace_event_synthetic_delay.h" |
#if defined(OS_WIN) |
+#include "base/trace_event/trace_event_etw_export_win.h" |
#include "base/trace_event/trace_event_win.h" |
#endif |
@@ -1290,6 +1291,11 @@ void TraceLog::UpdateCategoryGroupEnabledFlag(size_t category_index) { |
if (event_callback_ && |
event_callback_category_filter_.IsCategoryGroupEnabled(category_group)) |
enabled_flag |= ENABLED_FOR_EVENT_CALLBACK; |
+#if defined(OS_WIN) |
+ if (base::trace_event::TraceEventETWExport::isETWExportEnabled()) |
+ enabled_flag |= ENABLED_FOR_ETW_EXPORT; |
+#endif |
+ |
g_category_group_enabled[category_index] = enabled_flag; |
} |
@@ -1971,6 +1977,15 @@ TraceEventHandle TraceLog::AddTraceEventWithThreadIdAndTimestamp( |
} |
} |
+#if defined(OS_WIN) |
+ // This is done sooner rather than later, to avoid creating the event and |
+ // acquiring the lock, which is not needed for ETW as it's already threadsafe. |
+ if (*category_group_enabled & ENABLED_FOR_ETW_EXPORT) |
+ TraceEventETWExport::AddEvent(phase, category_group_enabled, name, id, |
+ num_args, arg_names, arg_types, arg_values, |
+ convertable_values); |
+#endif // OS_WIN |
+ |
std::string console_message; |
if (*category_group_enabled & |
(ENABLED_FOR_RECORDING | ENABLED_FOR_MONITORING)) { |