OLD | NEW |
---|---|
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 #ifndef CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ | 5 #ifndef CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ |
6 #define CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ | 6 #define CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 ~ScopedLayerTask() { TRACE_EVENT_END0(internal::kCategory, event_name_); } | 50 ~ScopedLayerTask() { TRACE_EVENT_END0(internal::kCategory, event_name_); } |
51 | 51 |
52 private: | 52 private: |
53 const char* event_name_; | 53 const char* event_name_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(ScopedLayerTask); | 55 DISALLOW_COPY_AND_ASSIGN(ScopedLayerTask); |
56 }; | 56 }; |
57 | 57 |
58 class CC_BASE_EXPORT ScopedImageDecodeTask { | 58 class CC_BASE_EXPORT ScopedImageDecodeTask { |
59 public: | 59 public: |
60 enum Type { SOFTWARE, GPU }; | 60 enum Type { SOFTWARE, GPU }; |
vmpstr
2017/05/30 20:15:12
Can you change this to be consistent with the nami
Khushal
2017/05/31 18:21:20
Done.
| |
61 enum DecodeTaskType { kInRaster, kCheckerImaging, kJSDecode }; | |
61 | 62 |
62 ScopedImageDecodeTask(const void* imagePtr, Type type) | 63 ScopedImageDecodeTask(const void* imagePtr, |
vmpstr
2017/05/30 20:15:12
image_ptr while here
Khushal
2017/05/31 18:21:20
Done.
| |
63 : type_(type), start_time_(base::TimeTicks::Now()) { | 64 Type type, |
65 DecodeTaskType task_type) | |
66 : type_(type), | |
67 task_type_(task_type), | |
68 start_time_(base::TimeTicks::Now()) { | |
64 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kImageDecodeTask, | 69 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kImageDecodeTask, |
65 internal::kPixelRefId, | 70 internal::kPixelRefId, |
66 reinterpret_cast<uint64_t>(imagePtr)); | 71 reinterpret_cast<uint64_t>(imagePtr)); |
67 } | 72 } |
68 ~ScopedImageDecodeTask() { | 73 ~ScopedImageDecodeTask() { |
69 TRACE_EVENT_END0(internal::kCategory, internal::kImageDecodeTask); | 74 TRACE_EVENT_END0(internal::kCategory, internal::kImageDecodeTask); |
70 base::TimeDelta duration = base::TimeTicks::Now() - start_time_; | 75 base::TimeDelta duration = base::TimeTicks::Now() - start_time_; |
71 switch (type_) { | 76 switch (task_type_) { |
72 case SOFTWARE: | 77 case kInRaster: |
73 UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Software", | 78 switch (type_) { |
74 duration.InMicroseconds()); | 79 case SOFTWARE: |
80 UMA_HISTOGRAM_COUNTS_1M( | |
81 "Renderer4.ImageDecodeTaskDurationUs.Software", | |
82 duration.InMicroseconds()); | |
83 break; | |
84 case GPU: | |
85 UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Gpu", | |
86 duration.InMicroseconds()); | |
87 break; | |
88 } | |
75 break; | 89 break; |
76 case GPU: | 90 case kCheckerImaging: |
77 UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Gpu", | 91 switch (type_) { |
78 duration.InMicroseconds()); | 92 case SOFTWARE: |
93 UMA_HISTOGRAM_COUNTS_1M( | |
94 "Renderer4.ImageDecodeTaskDurationUs.CheckerImaging.Software", | |
95 duration.InMicroseconds()); | |
96 break; | |
97 case GPU: | |
98 UMA_HISTOGRAM_COUNTS_1M( | |
99 "Renderer4.ImageDecodeTaskDurationUs.CheckerImaging.Gpu", | |
100 duration.InMicroseconds()); | |
101 break; | |
102 } | |
103 break; | |
104 case kJSDecode: | |
105 switch (type_) { | |
106 case SOFTWARE: | |
107 UMA_HISTOGRAM_COUNTS_1M( | |
108 "Renderer4.ImageDecodeTaskDurationUs.JSDecode.Software", | |
109 duration.InMicroseconds()); | |
110 break; | |
111 case GPU: | |
112 UMA_HISTOGRAM_COUNTS_1M( | |
113 "Renderer4.ImageDecodeTaskDurationUs.JSDecode.Gpu", | |
114 duration.InMicroseconds()); | |
115 break; | |
116 } | |
79 break; | 117 break; |
80 } | 118 } |
81 } | 119 } |
82 | 120 |
83 private: | 121 private: |
84 const Type type_; | 122 const Type type_; |
123 const DecodeTaskType task_type_; | |
85 const base::TimeTicks start_time_; | 124 const base::TimeTicks start_time_; |
86 DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask); | 125 DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask); |
87 }; | 126 }; |
88 | 127 |
89 class CC_BASE_EXPORT ScopedLayerTreeTask { | 128 class CC_BASE_EXPORT ScopedLayerTreeTask { |
90 public: | 129 public: |
91 ScopedLayerTreeTask(const char* event_name, | 130 ScopedLayerTreeTask(const char* event_name, |
92 int layer_id, | 131 int layer_id, |
93 int layer_tree_host_id) | 132 int layer_tree_host_id) |
94 : event_name_(event_name) { | 133 : event_name_(event_name) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 TRACE_EVENT_INSTANT2( | 221 TRACE_EVENT_INSTANT2( |
183 internal::kCategoryFrame, internal::kNeedsBeginFrameChanged, | 222 internal::kCategoryFrame, internal::kNeedsBeginFrameChanged, |
184 TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, | 223 TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, |
185 internal::kData, NeedsBeginFrameData(new_value)); | 224 internal::kData, NeedsBeginFrameData(new_value)); |
186 } | 225 } |
187 | 226 |
188 } // namespace devtools_instrumentation | 227 } // namespace devtools_instrumentation |
189 } // namespace cc | 228 } // namespace cc |
190 | 229 |
191 #endif // CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ | 230 #endif // CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ |
OLD | NEW |