summaryrefslogtreecommitdiff
path: root/chromium/cc/debug/benchmark_instrumentation.cc
blob: 74caae8bcc2c66b8349b825c26c19e86e3d58b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/debug/trace_event.h"
#include "cc/debug/benchmark_instrumentation.h"

namespace cc {
namespace benchmark_instrumentation {

// Please do not change the trace events in this file without updating
// tools/perf/measurements/rendering_stats.py accordingly.
// The benchmarks search for events and their arguments by name.

void IssueMainThreadRenderingStatsEvent(
    const RenderingStats::MainThreadRenderingStats& stats) {
  TRACE_EVENT_INSTANT1("benchmark",
                       "BenchmarkInstrumentation::MainThreadRenderingStats",
                       TRACE_EVENT_SCOPE_THREAD,
                       "data", stats.AsTraceableData());
}

void IssueImplThreadRenderingStatsEvent(
    const RenderingStats::ImplThreadRenderingStats& stats) {
  TRACE_EVENT_INSTANT1("benchmark",
                       "BenchmarkInstrumentation::ImplThreadRenderingStats",
                       TRACE_EVENT_SCOPE_THREAD,
                       "data", stats.AsTraceableData());
}

void IssueDisplayRenderingStatsEvent() {
  scoped_refptr<base::debug::TracedValue> record_data =
      new base::debug::TracedValue();
  record_data->SetInteger("frame_count", 1);
  TRACE_EVENT_INSTANT1(
      "benchmark",
      "BenchmarkInstrumentation::DisplayRenderingStats",
      TRACE_EVENT_SCOPE_THREAD,
      "data",
      scoped_refptr<base::debug::ConvertableToTraceFormat>(record_data));
}

}  // namespace benchmark_instrumentation
}  // namespace cc