| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 | 4 |
| 5 #include "content/browser/tracing/etw_system_event_consumer_win.h" | 5 #include "content/browser/tracing/etw_system_event_consumer_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/base64.h" | 9 #include "base/base64.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 10 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 11 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 13 #include "base/trace_event/trace_event_impl.h" | 15 #include "base/trace_event/trace_event_impl.h" |
| 14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 15 | 17 |
| 16 namespace content { | 18 namespace content { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 85 |
| 84 // Stop the consumer thread. | 86 // Stop the consumer thread. |
| 85 thread_.Stop(); | 87 thread_.Stop(); |
| 86 | 88 |
| 87 // Pass the serialized events. | 89 // Pass the serialized events. |
| 88 callback.Run(GetTracingAgentName(), GetTraceEventLabel(), result); | 90 callback.Run(GetTracingAgentName(), GetTraceEventLabel(), result); |
| 89 } | 91 } |
| 90 | 92 |
| 91 bool EtwSystemEventConsumer::StartKernelSessionTracing() { | 93 bool EtwSystemEventConsumer::StartKernelSessionTracing() { |
| 92 // Enabled flags (tracing facilities). | 94 // Enabled flags (tracing facilities). |
| 93 uint32 enabled_flags = EVENT_TRACE_FLAG_IMAGE_LOAD | | 95 uint32_t enabled_flags = EVENT_TRACE_FLAG_IMAGE_LOAD | |
| 94 EVENT_TRACE_FLAG_PROCESS | | 96 EVENT_TRACE_FLAG_PROCESS | EVENT_TRACE_FLAG_THREAD | |
| 95 EVENT_TRACE_FLAG_THREAD | | 97 EVENT_TRACE_FLAG_CSWITCH; |
| 96 EVENT_TRACE_FLAG_CSWITCH; | |
| 97 | 98 |
| 98 EVENT_TRACE_PROPERTIES& p = *properties_.get(); | 99 EVENT_TRACE_PROPERTIES& p = *properties_.get(); |
| 99 p.LogFileMode = EVENT_TRACE_REAL_TIME_MODE; | 100 p.LogFileMode = EVENT_TRACE_REAL_TIME_MODE; |
| 100 p.FlushTimer = kEtwBufferFlushTimeoutInSeconds; | 101 p.FlushTimer = kEtwBufferFlushTimeoutInSeconds; |
| 101 p.BufferSize = kEtwBufferSizeInKBytes; | 102 p.BufferSize = kEtwBufferSizeInKBytes; |
| 102 p.LogFileNameOffset = 0; | 103 p.LogFileNameOffset = 0; |
| 103 p.EnableFlags = enabled_flags; | 104 p.EnableFlags = enabled_flags; |
| 104 p.Wnode.ClientContext = 1; // QPC timer accuracy. | 105 p.Wnode.ClientContext = 1; // QPC timer accuracy. |
| 105 | 106 |
| 106 HRESULT hr = base::win::EtwTraceController::Start( | 107 HRESULT hr = base::win::EtwTraceController::Start( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 base::RefCountedString::TakeString(&output); | 238 base::RefCountedString::TakeString(&output); |
| 238 BrowserThread::PostTask( | 239 BrowserThread::PostTask( |
| 239 BrowserThread::UI, FROM_HERE, | 240 BrowserThread::UI, FROM_HERE, |
| 240 base::Bind(&EtwSystemEventConsumer::OnStopSystemTracingDone, | 241 base::Bind(&EtwSystemEventConsumer::OnStopSystemTracingDone, |
| 241 base::Unretained(this), | 242 base::Unretained(this), |
| 242 callback, | 243 callback, |
| 243 result)); | 244 result)); |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace content | 247 } // namespace content |
| OLD | NEW |