Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Unified Diff: base/trace_event/trace_event_etw_export_win.cc

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_event_argument.cc ('k') | base/trace_event/trace_event_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_etw_export_win.cc
diff --git a/base/trace_event/trace_event_etw_export_win.cc b/base/trace_event/trace_event_etw_export_win.cc
index 1cb3b8c85fca13ccb6c8789a44acb9f056f801da..d199bf5c8b2e4f6f359335b55e045d393adcb0b5 100644
--- a/base/trace_event/trace_event_etw_export_win.cc
+++ b/base/trace_event/trace_event_etw_export_win.cc
@@ -12,7 +12,7 @@
#include "base/trace_event/trace_event_impl.h"
// The GetProcAddress technique is borrowed from
-// https://github.com/randomascii/main/tree/master/xperf/ETWProviders
+// https://github.com/google/UIforETW/tree/master/ETWProviders
//
// EVNTAPI is used in evntprov.h which is included by chrome_events_win.h.
// We define EVNTAPI without the DECLSPEC_IMPORT specifier so that we can
@@ -51,6 +51,7 @@ ULONG EVNTAPI EventRegister(LPCGUID ProviderId,
if (EventRegisterProc)
return EventRegisterProc(ProviderId, EnableCallback, CallbackContext,
RegHandle);
+ *RegHandle = 0;
return 0;
}
@@ -132,7 +133,9 @@ void TraceEventETWExport::AddEvent(
!EventEnabledChromeEvent())
return;
- std::string phase_string;
+ const char* phase_string = nullptr;
+ // Space to store the phase identifier and null-terminator, when needed.
+ char phase_buffer[2];
switch (phase) {
case TRACE_EVENT_PHASE_BEGIN:
phase_string = "Begin";
@@ -195,14 +198,20 @@ void TraceEventETWExport::AddEvent(
phase_string = "Phase Delete Object";
break;
default:
- phase_string.push_back(phase);
+ phase_buffer[0] = phase;
+ phase_buffer[1] = 0;
+ phase_string = phase_buffer;
break;
}
std::string arg_values_string[3];
for (int i = 0; i < num_args; i++) {
if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) {
- convertable_values[i]->AppendAsTraceFormat(arg_values_string + i);
+ // Temporarily do nothing here. This function consumes 1/3 to 1/2 of
+ // *total* process CPU time when ETW tracing, and many of the strings
+ // created exceed WPA's 4094 byte limit and are shown as:
+ // "Unable to parse data". See crbug.com/488257
+ //convertable_values[i]->AppendAsTraceFormat(arg_values_string + i);
} else {
TraceEvent::TraceValue trace_event;
trace_event.as_uint = arg_values[i];
@@ -212,7 +221,7 @@ void TraceEventETWExport::AddEvent(
}
EventWriteChromeEvent(
- name, phase_string.c_str(), num_args > 0 ? arg_names[0] : "",
+ name, phase_string, num_args > 0 ? arg_names[0] : "",
arg_values_string[0].c_str(), num_args > 1 ? arg_names[1] : "",
arg_values_string[1].c_str(), num_args > 2 ? arg_names[2] : "",
arg_values_string[2].c_str());
« no previous file with comments | « base/trace_event/trace_event_argument.cc ('k') | base/trace_event/trace_event_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698