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

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

Issue 1064163002: Add ANGLE platform tracing methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/gl/angle_platform_impl.h ('k') | ui/gl/gl_implementation_win.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 10
10 namespace gfx { 11 namespace gfx {
11 12
12 ANGLEPlatformImpl::ANGLEPlatformImpl() { 13 ANGLEPlatformImpl::ANGLEPlatformImpl() {
13 } 14 }
14 15
15 ANGLEPlatformImpl::~ANGLEPlatformImpl() { 16 ANGLEPlatformImpl::~ANGLEPlatformImpl() {
16 } 17 }
17 18
19 double ANGLEPlatformImpl::monotonicallyIncreasingTime() {
20 return base::TimeTicks::Now().ToInternalValue() /
21 static_cast<double>(base::Time::kMicrosecondsPerSecond);
22 }
23
24 const unsigned char* ANGLEPlatformImpl::getTraceCategoryEnabledFlag(
25 const char* category_group) {
26 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
27 }
28
29 angle::Platform::TraceEventHandle ANGLEPlatformImpl::addTraceEvent(
30 char phase,
31 const unsigned char* category_group_enabled,
32 const char* name,
33 unsigned long long id,
34 double timestamp,
35 int num_args,
36 const char** arg_names,
37 const unsigned char* arg_types,
38 const unsigned long long* arg_values,
39 unsigned char flags) {
40 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue(
41 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond));
42 base::trace_event::TraceEventHandle handle =
43 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
44 phase, category_group_enabled, name, id,
45 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names,
46 arg_types, arg_values, nullptr, flags);
47 angle::Platform::TraceEventHandle result;
48 memcpy(&result, &handle, sizeof(result));
49 return result;
50 }
51
52 void ANGLEPlatformImpl::updateTraceEventDuration(
53 const unsigned char* category_group_enabled,
54 const char* name,
55 TraceEventHandle handle) {
56 base::trace_event::TraceEventHandle trace_event_handle;
57 memcpy(&trace_event_handle, &handle, sizeof(handle));
58 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled, name,
59 trace_event_handle);
60 }
61
18 void ANGLEPlatformImpl::histogramCustomCounts(const char* name, 62 void ANGLEPlatformImpl::histogramCustomCounts(const char* name,
19 int sample, 63 int sample,
20 int min, 64 int min,
21 int max, 65 int max,
22 int bucket_count) { 66 int bucket_count) {
23 // Copied from histogram macro, but without the static variable caching 67 // Copied from histogram macro, but without the static variable caching
24 // the histogram because name is dynamic. 68 // the histogram because name is dynamic.
25 base::HistogramBase* counter = base::Histogram::FactoryGet( 69 base::HistogramBase* counter = base::Histogram::FactoryGet(
26 name, min, max, bucket_count, 70 name, min, max, bucket_count,
27 base::HistogramBase::kUmaTargetedHistogramFlag); 71 base::HistogramBase::kUmaTargetedHistogramFlag);
(...skipping 13 matching lines...) Expand all
41 counter->Add(sample); 85 counter->Add(sample);
42 } 86 }
43 87
44 void ANGLEPlatformImpl::histogramSparse(const char* name, int sample) { 88 void ANGLEPlatformImpl::histogramSparse(const char* name, int sample) {
45 // For sparse histograms, we can use the macro, as it does not incorporate a 89 // For sparse histograms, we can use the macro, as it does not incorporate a
46 // static. 90 // static.
47 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); 91 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample);
48 } 92 }
49 93
50 } // namespace gfx 94 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/angle_platform_impl.h ('k') | ui/gl/gl_implementation_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698