| 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 DecodeType { kSoftware, kGpu }; |
| 61 enum TaskType { kInRaster, kOutOfRaster }; |
| 61 | 62 |
| 62 ScopedImageDecodeTask(const void* imagePtr, Type type) | 63 ScopedImageDecodeTask(const void* image_ptr, |
| 63 : type_(type), start_time_(base::TimeTicks::Now()) { | 64 DecodeType decode_type, |
| 64 TRACE_EVENT_BEGIN1(internal::kCategory, internal::kImageDecodeTask, | 65 TaskType task_type); |
| 65 internal::kPixelRefId, | 66 ~ScopedImageDecodeTask(); |
| 66 reinterpret_cast<uint64_t>(imagePtr)); | |
| 67 } | |
| 68 ~ScopedImageDecodeTask() { | |
| 69 TRACE_EVENT_END0(internal::kCategory, internal::kImageDecodeTask); | |
| 70 base::TimeDelta duration = base::TimeTicks::Now() - start_time_; | |
| 71 switch (type_) { | |
| 72 case SOFTWARE: | |
| 73 UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Software", | |
| 74 duration.InMicroseconds()); | |
| 75 break; | |
| 76 case GPU: | |
| 77 UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Gpu", | |
| 78 duration.InMicroseconds()); | |
| 79 break; | |
| 80 } | |
| 81 } | |
| 82 | 67 |
| 83 private: | 68 private: |
| 84 const Type type_; | 69 const DecodeType decode_type_; |
| 70 const TaskType task_type_; |
| 85 const base::TimeTicks start_time_; | 71 const base::TimeTicks start_time_; |
| 86 DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask); | 72 DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask); |
| 87 }; | 73 }; |
| 88 | 74 |
| 89 class CC_BASE_EXPORT ScopedLayerTreeTask { | 75 class CC_BASE_EXPORT ScopedLayerTreeTask { |
| 90 public: | 76 public: |
| 91 ScopedLayerTreeTask(const char* event_name, | 77 ScopedLayerTreeTask(const char* event_name, |
| 92 int layer_id, | 78 int layer_id, |
| 93 int layer_tree_host_id) | 79 int layer_tree_host_id) |
| 94 : event_name_(event_name) { | 80 : event_name_(event_name) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 TRACE_EVENT_INSTANT2( | 168 TRACE_EVENT_INSTANT2( |
| 183 internal::kCategoryFrame, internal::kNeedsBeginFrameChanged, | 169 internal::kCategoryFrame, internal::kNeedsBeginFrameChanged, |
| 184 TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, | 170 TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, |
| 185 internal::kData, NeedsBeginFrameData(new_value)); | 171 internal::kData, NeedsBeginFrameData(new_value)); |
| 186 } | 172 } |
| 187 | 173 |
| 188 } // namespace devtools_instrumentation | 174 } // namespace devtools_instrumentation |
| 189 } // namespace cc | 175 } // namespace cc |
| 190 | 176 |
| 191 #endif // CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ | 177 #endif // CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ |
| OLD | NEW |