benchmark_instrumentation.cc revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
14e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
24e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
34e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// found in the LICENSE file.
44e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
54e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "base/debug/trace_event.h"
64e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "cc/debug/benchmark_instrumentation.h"
74e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
84e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)namespace cc {
94e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Please do not change the trace events in this file without updating
114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// tools/perf/measurements/rendering_stats.py accordingly.
124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// The benchmarks search for events and their arguments by name.
134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent(
154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    const MainThreadRenderingStats& stats) {
164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  TRACE_EVENT_INSTANT1("benchmark",
174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                       "BenchmarkInstrumentation::MainThreadRenderingStats",
184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                       TRACE_EVENT_SCOPE_THREAD,
194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                       "data", stats.AsTraceableData());
204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void BenchmarkInstrumentation::IssueImplThreadRenderingStatsEvent(
234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    const ImplThreadRenderingStats& stats) {
244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  TRACE_EVENT_INSTANT1("benchmark",
254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                       "BenchmarkInstrumentation::ImplThreadRenderingStats",
264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                       TRACE_EVENT_SCOPE_THREAD,
274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                       "data", stats.AsTraceableData());
284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}  // namespace cc
31