| 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_DEBUG_BENCHMARK_INSTRUMENTATION_H_ | 5 #ifndef CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_ |
| 6 #define CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_ | 6 #define CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_ |
| 7 | 7 |
| 8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/debug/rendering_stats.h" | 9 #include "cc/debug/rendering_stats.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 namespace benchmark_instrumentation { | 12 namespace benchmark_instrumentation { |
| 13 | 13 |
| 14 // Please do not change the trace events in this file without updating | 14 // Please do not change the trace events in this file without updating |
| 15 // tools/perf/measurements/rendering_stats.py accordingly. | 15 // tools/perf/measurements/rendering_stats.py accordingly. |
| 16 // The benchmarks search for events and their arguments by name. | 16 // The benchmarks search for events and their arguments by name. |
| 17 | 17 |
| 18 namespace internal { | 18 namespace internal { |
| 19 const char kCategory[] = "cc,benchmark"; | 19 const char kCategory[] = "cc,benchmark"; |
| 20 const char kBeginFrameId[] = "begin_frame_id"; | 20 const char kBeginFrameId[] = "begin_frame_id"; |
| 21 } // namespace internal | 21 } // namespace internal |
| 22 | 22 |
| 23 // TODO(khushalsagar): Fix these names for the telemetry benchmarks. | |
| 24 // See crbug/567993. | |
| 25 const char kSendBeginFrame[] = "ThreadProxy::ScheduledActionSendBeginMainFrame"; | 23 const char kSendBeginFrame[] = "ThreadProxy::ScheduledActionSendBeginMainFrame"; |
| 26 const char kDoBeginFrame[] = "ThreadProxy::BeginMainFrame"; | 24 const char kDoBeginFrame[] = "ThreadProxy::BeginMainFrame"; |
| 27 | 25 |
| 28 class ScopedBeginFrameTask { | 26 class ScopedBeginFrameTask { |
| 29 public: | 27 public: |
| 30 ScopedBeginFrameTask(const char* event_name, unsigned int begin_frame_id) | 28 ScopedBeginFrameTask(const char* event_name, unsigned int begin_frame_id) |
| 31 : event_name_(event_name) { | 29 : event_name_(event_name) { |
| 32 TRACE_EVENT_BEGIN1(internal::kCategory, | 30 TRACE_EVENT_BEGIN1(internal::kCategory, |
| 33 event_name_, | 31 event_name_, |
| 34 internal::kBeginFrameId, | 32 internal::kBeginFrameId, |
| 35 begin_frame_id); | 33 begin_frame_id); |
| 36 } | 34 } |
| 37 ~ScopedBeginFrameTask() { | 35 ~ScopedBeginFrameTask() { |
| 38 TRACE_EVENT_END0(internal::kCategory, event_name_); | 36 TRACE_EVENT_END0(internal::kCategory, event_name_); |
| 39 } | 37 } |
| 40 | 38 |
| 41 private: | 39 private: |
| 42 const char* event_name_; | 40 const char* event_name_; |
| 43 | 41 |
| 44 DISALLOW_COPY_AND_ASSIGN(ScopedBeginFrameTask); | 42 DISALLOW_COPY_AND_ASSIGN(ScopedBeginFrameTask); |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 void IssueImplThreadRenderingStatsEvent(const RenderingStats& stats); | 45 void IssueImplThreadRenderingStatsEvent(const RenderingStats& stats); |
| 48 void CC_EXPORT IssueDisplayRenderingStatsEvent(); | 46 void CC_EXPORT IssueDisplayRenderingStatsEvent(); |
| 49 | 47 |
| 50 } // namespace benchmark_instrumentation | 48 } // namespace benchmark_instrumentation |
| 51 } // namespace cc | 49 } // namespace cc |
| 52 | 50 |
| 53 #endif // CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_ | 51 #endif // CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_ |
| OLD | NEW |