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
3 // found in the LICENSE file.
5 #ifndef CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_
6 #define CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/debug/rendering_stats.h"
12 namespace benchmark_instrumentation
{
14 // Please do not change the trace events in this file without updating
15 // tools/perf/measurements/rendering_stats.py accordingly.
16 // The benchmarks search for events and their arguments by name.
19 const char kCategory
[] = "cc,benchmark";
20 const char kBeginFrameId
[] = "begin_frame_id";
21 } // namespace internal
23 const char kSendBeginFrame
[] = "ThreadProxy::ScheduledActionSendBeginMainFrame";
24 const char kDoBeginFrame
[] = "ThreadProxy::BeginMainFrame";
26 class ScopedBeginFrameTask
{
28 ScopedBeginFrameTask(const char* event_name
, unsigned int begin_frame_id
)
29 : event_name_(event_name
) {
30 TRACE_EVENT_BEGIN1(internal::kCategory
,
32 internal::kBeginFrameId
,
35 ~ScopedBeginFrameTask() {
36 TRACE_EVENT_END0(internal::kCategory
, event_name_
);
40 const char* event_name_
;
42 DISALLOW_COPY_AND_ASSIGN(ScopedBeginFrameTask
);
45 void IssueImplThreadRenderingStatsEvent(const RenderingStats
& stats
);
46 void CC_EXPORT
IssueDisplayRenderingStatsEvent();
48 } // namespace benchmark_instrumentation
51 #endif // CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_