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_tracing_agent_win.h" | 5 #include "content/browser/tracing/etw_tracing_agent_win.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 value->Set("tick", new base::StringValue( | 174 value->Set("tick", new base::StringValue( |
175 base::StringPrintf("%08X%08X", | 175 base::StringPrintf("%08X%08X", |
176 now_in_us.HighPart, | 176 now_in_us.HighPart, |
177 now_in_us.LowPart))); | 177 now_in_us.LowPart))); |
178 | 178 |
179 // Append it to the events buffer. | 179 // Append it to the events buffer. |
180 events_->Append(value.release()); | 180 events_->Append(value.release()); |
181 } | 181 } |
182 | 182 |
183 void EtwTracingAgent::AppendEventToBuffer(EVENT_TRACE* event) { | 183 void EtwTracingAgent::AppendEventToBuffer(EVENT_TRACE* event) { |
184 using base::FundamentalValue; | 184 using base::Value; |
185 | 185 |
186 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 186 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
187 | 187 |
188 // Add header fields to the event. | 188 // Add header fields to the event. |
189 LARGE_INTEGER ts_us; | 189 LARGE_INTEGER ts_us; |
190 ts_us.QuadPart = event->Header.TimeStamp.QuadPart / 10; | 190 ts_us.QuadPart = event->Header.TimeStamp.QuadPart / 10; |
191 value->Set("ts", new base::StringValue( | 191 value->Set("ts", new base::StringValue( |
192 base::StringPrintf("%08X%08X", ts_us.HighPart, ts_us.LowPart))); | 192 base::StringPrintf("%08X%08X", ts_us.HighPart, ts_us.LowPart))); |
193 | 193 |
194 value->Set("guid", new base::StringValue(GuidToString(event->Header.Guid))); | 194 value->Set("guid", new base::StringValue(GuidToString(event->Header.Guid))); |
195 | 195 |
196 value->Set("op", new FundamentalValue(event->Header.Class.Type)); | 196 value->Set("op", new Value(event->Header.Class.Type)); |
197 value->Set("ver", new FundamentalValue(event->Header.Class.Version)); | 197 value->Set("ver", new Value(event->Header.Class.Version)); |
198 value->Set("pid", | 198 value->Set("pid", new Value(static_cast<int>(event->Header.ProcessId))); |
199 new FundamentalValue(static_cast<int>(event->Header.ProcessId))); | 199 value->Set("tid", new Value(static_cast<int>(event->Header.ThreadId))); |
200 value->Set("tid", | 200 value->Set("cpu", new Value(event->BufferContext.ProcessorNumber)); |
201 new FundamentalValue(static_cast<int>(event->Header.ThreadId))); | |
202 value->Set("cpu", new FundamentalValue(event->BufferContext.ProcessorNumber)); | |
203 | 201 |
204 // Base64 encode the payload bytes. | 202 // Base64 encode the payload bytes. |
205 base::StringPiece buffer(static_cast<const char*>(event->MofData), | 203 base::StringPiece buffer(static_cast<const char*>(event->MofData), |
206 event->MofLength); | 204 event->MofLength); |
207 std::string payload; | 205 std::string payload; |
208 base::Base64Encode(buffer, &payload); | 206 base::Base64Encode(buffer, &payload); |
209 value->Set("payload", new base::StringValue(payload)); | 207 value->Set("payload", new base::StringValue(payload)); |
210 | 208 |
211 // Append it to the events buffer. | 209 // Append it to the events buffer. |
212 events_->Append(value.release()); | 210 events_->Append(value.release()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 base::RefCountedString::TakeString(&output); | 243 base::RefCountedString::TakeString(&output); |
246 BrowserThread::PostTask( | 244 BrowserThread::PostTask( |
247 BrowserThread::UI, FROM_HERE, | 245 BrowserThread::UI, FROM_HERE, |
248 base::Bind(&EtwTracingAgent::OnStopSystemTracingDone, | 246 base::Bind(&EtwTracingAgent::OnStopSystemTracingDone, |
249 base::Unretained(this), | 247 base::Unretained(this), |
250 callback, | 248 callback, |
251 result)); | 249 result)); |
252 } | 250 } |
253 | 251 |
254 } // namespace content | 252 } // namespace content |
OLD | NEW |