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

Side by Side Diff: ui/events/latency_info.cc

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 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
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "ui/events/latency_info.h" 9 #include "ui/events/latency_info.h"
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 it->second.event_time, 194 it->second.event_time,
195 it->second.event_count); 195 it->second.event_count);
196 } 196 }
197 } 197 }
198 } 198 }
199 199
200 void LatencyInfo::AddLatencyNumber(LatencyComponentType component, 200 void LatencyInfo::AddLatencyNumber(LatencyComponentType component,
201 int64 id, 201 int64 id,
202 int64 component_sequence_number) { 202 int64 component_sequence_number) {
203 AddLatencyNumberWithTimestamp(component, id, component_sequence_number, 203 AddLatencyNumberWithTimestamp(component, id, component_sequence_number,
204 base::TimeTicks::HighResNow(), 1); 204 base::TimeTicks::Now(), 1);
205 } 205 }
206 206
207 void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component, 207 void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component,
208 int64 id, 208 int64 id,
209 int64 component_sequence_number, 209 int64 component_sequence_number,
210 base::TimeTicks time, 210 base::TimeTicks time,
211 uint32 event_count) { 211 uint32 event_count) {
212 212
213 static const unsigned char* benchmark_enabled = 213 static const unsigned char* benchmark_enabled =
214 TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED("benchmark"); 214 TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED("benchmark");
(...skipping 16 matching lines...) Expand all
231 &component) || 231 &component) ||
232 FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 232 FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT,
233 0, 233 0,
234 &component)) { 234 &component)) {
235 // The timestamp stored in ORIGINAL/UI_COMPONENT is using clock 235 // The timestamp stored in ORIGINAL/UI_COMPONENT is using clock
236 // CLOCK_MONOTONIC while TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0 236 // CLOCK_MONOTONIC while TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0
237 // expects timestamp using CLOCK_MONOTONIC or CLOCK_SYSTEM_TRACE (on 237 // expects timestamp using CLOCK_MONOTONIC or CLOCK_SYSTEM_TRACE (on
238 // CrOS). So we need to adjust the diff between in CLOCK_MONOTONIC and 238 // CrOS). So we need to adjust the diff between in CLOCK_MONOTONIC and
239 // CLOCK_SYSTEM_TRACE. Note that the diff is drifting overtime so we 239 // CLOCK_SYSTEM_TRACE. Note that the diff is drifting overtime so we
240 // can't use a static value. 240 // can't use a static value.
241 int64 diff = base::TimeTicks::HighResNow().ToInternalValue() - 241 int64 diff = base::TimeTicks::Now().ToInternalValue() -
242 base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); 242 base::TimeTicks::NowFromSystemTraceTime().ToInternalValue();
243 ts = component.event_time.ToInternalValue() - diff; 243 ts = component.event_time.ToInternalValue() - diff;
244 } else { 244 } else {
245 ts = base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); 245 ts = base::TimeTicks::NowFromSystemTraceTime().ToInternalValue();
246 } 246 }
247 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0( 247 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(
248 "benchmark", 248 "benchmark",
249 "InputLatency", 249 "InputLatency",
250 TRACE_ID_DONT_MANGLE(trace_id), 250 TRACE_ID_DONT_MANGLE(trace_id),
251 ts); 251 ts);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 321 }
322 322
323 void LatencyInfo::TraceEventType(const char* event_type) { 323 void LatencyInfo::TraceEventType(const char* event_type) {
324 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark", 324 TRACE_EVENT_ASYNC_STEP_INTO0("benchmark",
325 "InputLatency", 325 "InputLatency",
326 TRACE_ID_DONT_MANGLE(trace_id), 326 TRACE_ID_DONT_MANGLE(trace_id),
327 event_type); 327 event_type);
328 } 328 }
329 329
330 } // namespace ui 330 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698