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

Side by Side Diff: content/browser/tracing/etw_system_event_consumer_win.h

Issue 171143002: Implements Windows system tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tracing
Patch Set: nits Created 6 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_
6 #define CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_
7
8 #include "base/bind.h"
9 #include "base/memory/ref_counted_memory.h"
10 #include "base/threading/thread.h"
11 #include "base/values.h"
12 #include "base/win/event_trace_consumer.h"
13 #include "base/win/event_trace_controller.h"
14
15 template <typename Type>
16 struct DefaultSingletonTraits;
17
18 namespace content {
19
20 class EtwSystemEventConsumer :
21 public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> {
22 public:
23 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)>
24 OutputCallback;
25
26 bool StartSystemTracing();
27 bool StopSystemTracing(const OutputCallback& callback);
28
29 // Retrieve the ETW consumer instance.
30 static EtwSystemEventConsumer* GetInstance();
31
32 // Static override of EtwTraceConsumerBase::ProcessEvent.
nduca 2014/02/21 05:22:10 use friends so this is private?
etienneb 2014/02/24 14:59:33 Done.
33 // @param event the raw ETW event to process.
34 static void ProcessEvent(EVENT_TRACE* event);
35
36 private:
37 // This allows constructor and destructor to be private and usable only
38 // by the Singleton class.
39 friend struct DefaultSingletonTraits<EtwSystemEventConsumer>;
40
41 // Constructor.
42 EtwSystemEventConsumer();
43 virtual ~EtwSystemEventConsumer();
44
45 void AppendEventToBuffer(EVENT_TRACE* event);
46
47 // Request the ETW trace controller to activate the kernel tracing.
48 // returns true on success, false if the kernel tracing isn't activated.
49 bool StartKernelSessionTracing();
50
51 // Request the ETW trace controller to deactivate the kernel tracing.
52 // @param callback the callback to call with the consumed events.
53 // returns true on success, false if an error occurred.
54 bool StopKernelSessionTracing();
55
56 void OnStopSystemTracingDone(
57 const OutputCallback& callback,
58 const scoped_refptr<base::RefCountedString>& result);
59
60 void TraceAndConsumeOnThread();
61 void FlushOnThread(const OutputCallback& callback);
62
63 scoped_ptr<base::ListValue> events_;
64 base::Thread thread_;
65 TRACEHANDLE session_handle_;
66 base::win::EtwTraceProperties properties_;
67
68 DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer);
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698