Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / debug / benchmark_instrumentation.h
blob59d6751f4fdb101d972b406e4f5e53f1c77d9f61
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/debug/rendering_stats.h"
10 namespace cc {
11 namespace benchmark_instrumentation {
13 // Please do not change the trace events in this file without updating
14 // tools/perf/measurements/rendering_stats.py accordingly.
15 // The benchmarks search for events and their arguments by name.
17 namespace internal {
18 const char kCategory[] = "cc,benchmark";
19 const char kBeginFrameId[] = "begin_frame_id";
20 } // namespace internal
22 const char kSendBeginFrame[] = "ThreadProxy::ScheduledActionSendBeginMainFrame";
23 const char kDoBeginFrame[] = "ThreadProxy::BeginMainFrame";
25 class ScopedBeginFrameTask {
26 public:
27 ScopedBeginFrameTask(const char* event_name, unsigned int begin_frame_id)
28 : event_name_(event_name) {
29 TRACE_EVENT_BEGIN1(internal::kCategory,
30 event_name_,
31 internal::kBeginFrameId,
32 begin_frame_id);
34 ~ScopedBeginFrameTask() {
35 TRACE_EVENT_END0(internal::kCategory, event_name_);
38 private:
39 const char* event_name_;
41 DISALLOW_COPY_AND_ASSIGN(ScopedBeginFrameTask);
44 void IssueMainThreadRenderingStatsEvent(const MainThreadRenderingStats& stats);
45 void IssueImplThreadRenderingStatsEvent(const ImplThreadRenderingStats& stats);
47 } // namespace benchmark_instrumentation
48 } // namespace cc
50 #endif // CC_DEBUG_BENCHMARK_INSTRUMENTATION_H_