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

Side by Side Diff: ui/gl/angle_platform_impl.cc

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: REBASE after it passed CQ but did not commit to tree Created 5 years, 6 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/events/latency_info.cc ('k') | ui/gl/gpu_timing.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/gl/angle_platform_impl.h" 5 #include "ui/gl/angle_platform_impl.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 ANGLEPlatformImpl::ANGLEPlatformImpl() { 13 ANGLEPlatformImpl::ANGLEPlatformImpl() {
14 } 14 }
15 15
16 ANGLEPlatformImpl::~ANGLEPlatformImpl() { 16 ANGLEPlatformImpl::~ANGLEPlatformImpl() {
17 } 17 }
18 18
19 double ANGLEPlatformImpl::currentTime() { 19 double ANGLEPlatformImpl::currentTime() {
20 return base::Time::Now().ToDoubleT(); 20 return base::Time::Now().ToDoubleT();
21 } 21 }
22 22
23 double ANGLEPlatformImpl::monotonicallyIncreasingTime() { 23 double ANGLEPlatformImpl::monotonicallyIncreasingTime() {
24 return base::TimeTicks::Now().ToInternalValue() / 24 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF();
25 static_cast<double>(base::Time::kMicrosecondsPerSecond);
26 } 25 }
27 26
28 const unsigned char* ANGLEPlatformImpl::getTraceCategoryEnabledFlag( 27 const unsigned char* ANGLEPlatformImpl::getTraceCategoryEnabledFlag(
29 const char* category_group) { 28 const char* category_group) {
30 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); 29 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
31 } 30 }
32 31
33 angle::Platform::TraceEventHandle ANGLEPlatformImpl::addTraceEvent( 32 angle::Platform::TraceEventHandle ANGLEPlatformImpl::addTraceEvent(
34 char phase, 33 char phase,
35 const unsigned char* category_group_enabled, 34 const unsigned char* category_group_enabled,
36 const char* name, 35 const char* name,
37 unsigned long long id, 36 unsigned long long id,
38 double timestamp, 37 double timestamp,
39 int num_args, 38 int num_args,
40 const char** arg_names, 39 const char** arg_names,
41 const unsigned char* arg_types, 40 const unsigned char* arg_types,
42 const unsigned long long* arg_values, 41 const unsigned long long* arg_values,
43 unsigned char flags) { 42 unsigned char flags) {
44 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( 43 base::TraceTicks timestamp_tt =
45 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); 44 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp);
46 base::trace_event::TraceEventHandle handle = 45 base::trace_event::TraceEventHandle handle =
47 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( 46 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
48 phase, category_group_enabled, name, id, 47 phase, category_group_enabled, name, id,
49 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, 48 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names,
50 arg_types, arg_values, nullptr, flags); 49 arg_types, arg_values, nullptr, flags);
51 angle::Platform::TraceEventHandle result; 50 angle::Platform::TraceEventHandle result;
52 memcpy(&result, &handle, sizeof(result)); 51 memcpy(&result, &handle, sizeof(result));
53 return result; 52 return result;
54 } 53 }
55 54
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // For sparse histograms, we can use the macro, as it does not incorporate a 92 // For sparse histograms, we can use the macro, as it does not incorporate a
94 // static. 93 // static.
95 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); 94 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample);
96 } 95 }
97 96
98 void ANGLEPlatformImpl::histogramBoolean(const char* name, bool sample) { 97 void ANGLEPlatformImpl::histogramBoolean(const char* name, bool sample) {
99 histogramEnumeration(name, sample ? 1 : 0, 2); 98 histogramEnumeration(name, sample ? 1 : 0, 2);
100 } 99 }
101 100
102 } // namespace gfx 101 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/events/latency_info.cc ('k') | ui/gl/gpu_timing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698