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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 // static | 135 // static |
136 void EtwSystemEventConsumer::ProcessEvent(EVENT_TRACE* event) { | 136 void EtwSystemEventConsumer::ProcessEvent(EVENT_TRACE* event) { |
137 EtwSystemEventConsumer::GetInstance()->AppendEventToBuffer(event); | 137 EtwSystemEventConsumer::GetInstance()->AppendEventToBuffer(event); |
138 } | 138 } |
139 | 139 |
140 void EtwSystemEventConsumer::AddSyncEventToBuffer() { | 140 void EtwSystemEventConsumer::AddSyncEventToBuffer() { |
141 // Sync the clocks. | 141 // Sync the clocks. |
142 base::Time walltime = base::Time::NowFromSystemTime(); | 142 base::Time walltime = base::Time::NowFromSystemTime(); |
143 base::TraceTicks now = base::TraceTicks::Now(); | 143 base::TimeTicks now = base::TimeTicks::Now(); |
144 | 144 |
145 LARGE_INTEGER walltime_in_us; | 145 LARGE_INTEGER walltime_in_us; |
146 walltime_in_us.QuadPart = walltime.ToInternalValue(); | 146 walltime_in_us.QuadPart = walltime.ToInternalValue(); |
147 LARGE_INTEGER now_in_us; | 147 LARGE_INTEGER now_in_us; |
148 now_in_us.QuadPart = now.ToInternalValue(); | 148 now_in_us.QuadPart = now.ToInternalValue(); |
149 | 149 |
150 // Add fields to the event. | 150 // Add fields to the event. |
151 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 151 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
152 value->Set("guid", new base::StringValue("ClockSync")); | 152 value->Set("guid", new base::StringValue("ClockSync")); |
153 value->Set("walltime", new base::StringValue( | 153 value->Set("walltime", new base::StringValue( |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 serializer.Serialize(*header.get()); | 223 serializer.Serialize(*header.get()); |
224 | 224 |
225 // Pass the result to the UI Thread. | 225 // Pass the result to the UI Thread. |
226 scoped_refptr<base::RefCountedString> result = | 226 scoped_refptr<base::RefCountedString> result = |
227 base::RefCountedString::TakeString(&output); | 227 base::RefCountedString::TakeString(&output); |
228 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 228 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
229 base::Bind(callback, result)); | 229 base::Bind(callback, result)); |
230 } | 230 } |
231 | 231 |
232 } // namespace content | 232 } // namespace content |
OLD | NEW |