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

Side by Side Diff: base/debug/trace_event_win.cc

Issue 23934003: Have all trace points emit to ETW. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 unified diff | Download patch
« base/debug/trace_event_impl.cc ('K') | « base/debug/trace_event_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/debug/trace_event_win.h" 4 #include "base/debug/trace_event_win.h"
5 5
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include <initguid.h> // NOLINT 8 #include <initguid.h> // NOLINT
9 9
10 namespace base { 10 namespace base {
(...skipping 25 matching lines...) Expand all
36 StaticMemorySingletonTraits<TraceEventETWProvider> >::get(); 36 StaticMemorySingletonTraits<TraceEventETWProvider> >::get();
37 } 37 }
38 38
39 bool TraceEventETWProvider::StartTracing() { 39 bool TraceEventETWProvider::StartTracing() {
40 return true; 40 return true;
41 } 41 }
42 42
43 void TraceEventETWProvider::TraceEvent(const char* name, 43 void TraceEventETWProvider::TraceEvent(const char* name,
44 size_t name_len, 44 size_t name_len,
45 char type, 45 char type,
46 const void* id, 46 unsigned long long id,
47 const char* extra, 47 const char* extra,
48 size_t extra_len) { 48 size_t extra_len) {
49 // Make sure we don't touch NULL. 49 // Make sure we don't touch NULL.
50 if (name == NULL) 50 if (name == NULL)
51 name = ""; 51 name = "";
52 if (extra == NULL) 52 if (extra == NULL)
53 extra = ""; 53 extra = "";
54 54
55 EtwEventType etw_type = 0; 55 EtwEventType etw_type = 0;
56 switch (type) { 56 switch (type) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 event.SetField(4, sizeof(backtrace[0]) * depth, backtrace); 90 event.SetField(4, sizeof(backtrace[0]) * depth, backtrace);
91 } 91 }
92 92
93 // Trace the event. 93 // Trace the event.
94 Log(event.get()); 94 Log(event.get());
95 } 95 }
96 96
97 void TraceEventETWProvider::Trace(const char* name, 97 void TraceEventETWProvider::Trace(const char* name,
98 size_t name_len, 98 size_t name_len,
99 char type, 99 char type,
100 const void* id, 100 unsigned long long id,
chrisha 2013/09/04 13:32:09 Why are we changing the type of this?
fdoray 2013/09/05 20:10:31 I wanted to avoid an extra type conversion: |id| c
101 const char* extra, 101 const char* extra,
102 size_t extra_len) { 102 size_t extra_len) {
103 TraceEventETWProvider* provider = TraceEventETWProvider::GetInstance(); 103 TraceEventETWProvider* provider = TraceEventETWProvider::GetInstance();
104 if (provider && provider->IsTracing()) { 104 if (provider && provider->IsTracing()) {
105 // Compute the name & extra lengths if not supplied already. 105 // Compute the name & extra lengths if not supplied already.
106 if (name_len == -1) 106 if (name_len == -1)
107 name_len = (name == NULL) ? 0 : strlen(name); 107 name_len = (name == NULL) ? 0 : strlen(name);
108 if (extra_len == -1) 108 if (extra_len == -1)
109 extra_len = (extra == NULL) ? 0 : strlen(extra); 109 extra_len = (extra == NULL) ? 0 : strlen(extra);
110 110
111 provider->TraceEvent(name, name_len, type, id, extra, extra_len); 111 provider->TraceEvent(name, name_len, type, id, extra, extra_len);
chrisha 2013/09/04 13:32:09 TraceEvent takes a const void * too, no? There's a
112 } 112 }
113 } 113 }
114 114
115 void TraceEventETWProvider::Resurrect() { 115 void TraceEventETWProvider::Resurrect() {
116 StaticMemorySingletonTraits<TraceEventETWProvider>::Resurrect(); 116 StaticMemorySingletonTraits<TraceEventETWProvider>::Resurrect();
117 } 117 }
118 118
119 } // namespace debug 119 } // namespace debug
120 } // namespace base 120 } // namespace base
OLDNEW
« base/debug/trace_event_impl.cc ('K') | « base/debug/trace_event_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698