OLD | NEW |
---|---|
(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 namespace content { | |
16 | |
17 class EtwSystemEventConsumer : | |
18 public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> { | |
19 public: | |
20 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> | |
21 OutputCallback; | |
22 | |
23 // Constructor. | |
24 EtwSystemEventConsumer(); | |
nduca
2014/02/20 07:04:54
if its a singleton the constructor should be priva
etienneb
2014/02/20 19:08:03
Done.
| |
25 | |
nduca
2014/02/20 07:04:54
you need a private virtual destructor, even if its
etienneb
2014/02/20 19:08:03
Done.
| |
26 // Request the ETW trace controller to activate the kernel tracing. | |
27 // returns true on success, false if the kernel tracing isn't activated. | |
28 bool StartKernelSessionTracing(); | |
29 | |
30 // Request the ETW trace controller to deactivate the kernel tracing. | |
31 // returns true on success, false if an error occurred. | |
32 bool StopKernelSessionTracing(); | |
33 | |
34 // Send a request to the ETWConsumerThread to consume the kernel events. | |
35 void RequestStartTraceConsuming(); | |
nduca
2014/02/20 07:04:54
my request to keep this internal to the file remai
etienneb
2014/02/20 19:08:03
Done.
| |
36 | |
37 // Send a request to the ETWConsumerThread to stop consuming the kernel | |
38 // events. | |
39 // @param callback the callback to call with the consuming result. | |
40 void RequestStopTraceConsuming(const OutputCallback& callback); | |
41 | |
42 // Retrieve the ETW consumer instance. | |
nduca
2014/02/20 07:04:54
forgive me if i asked this once but can't we use t
etienneb
2014/02/20 19:08:03
Done.
| |
43 static EtwSystemEventConsumer* Get(); | |
44 | |
45 // Static override of EtwTraceConsumerBase::ProcessEvent. | |
46 // @param event the raw ETW event to process. | |
47 static void ProcessEvent(EVENT_TRACE* event); | |
48 | |
49 private: | |
50 void AppendEventToBuffer(EVENT_TRACE* event); | |
51 | |
52 void TraceAndConsumeOnThread(); | |
53 void StopAndFlushOnThread(const OutputCallback& callback); | |
54 | |
55 scoped_ptr<base::ListValue> events_; | |
56 base::Thread thread_; | |
57 TRACEHANDLE session_handle_; | |
58 base::win::EtwTraceProperties properties_; | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_ | |
OLD | NEW |