blob: ca049d707bb650e6032d5f16356cd64190d80d3d [file] [log] [blame]
Brian Salomondcbb9d92017-07-19 10:53:20 -04001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkDebugfTracer_DEFINED
9#define SkDebugfTracer_DEFINED
10
11#include "SkEventTracer.h"
Brian Osman65e4c612017-07-21 11:06:24 -040012#include "SkEventTracingPriv.h"
Brian Salomondcbb9d92017-07-19 10:53:20 -040013#include "SkString.h"
14
15/**
16 * A SkEventTracer implementation that logs events using SkDebugf.
17 */
18class SkDebugfTracer : public SkEventTracer {
19public:
20 SkDebugfTracer() {}
21
22 SkEventTracer::Handle addTraceEvent(char phase,
23 const uint8_t* categoryEnabledFlag,
24 const char* name,
25 uint64_t id,
26 int numArgs,
27 const char** argNames,
28 const uint8_t* argTypes,
29 const uint64_t* argValues,
30 uint8_t flags) override;
31
32 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
33 const char* name,
34 SkEventTracer::Handle handle) override;
35
Brian Osman65e4c612017-07-21 11:06:24 -040036 const uint8_t* getCategoryGroupEnabled(const char* name) override {
37 return fCategories.getCategoryGroupEnabled(name);
38 }
Brian Salomondcbb9d92017-07-19 10:53:20 -040039
40 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override {
Brian Osman65e4c612017-07-21 11:06:24 -040041 return fCategories.getCategoryGroupName(categoryEnabledFlag);
Brian Salomondcbb9d92017-07-19 10:53:20 -040042 }
43
44private:
45 SkString fIndent;
46 int fCnt = 0;
Brian Osman65e4c612017-07-21 11:06:24 -040047 SkEventTracingCategories fCategories;
Brian Salomondcbb9d92017-07-19 10:53:20 -040048};
49
50#endif