• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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"
12 #include "SkEventTracingPriv.h"
13 #include "SkString.h"
14 
15 /**
16  * A SkEventTracer implementation that logs events using SkDebugf.
17  */
18 class SkDebugfTracer : public SkEventTracer {
19 public:
SkDebugfTracer()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 
getCategoryGroupEnabled(const char * name)36     const uint8_t* getCategoryGroupEnabled(const char* name) override {
37         return fCategories.getCategoryGroupEnabled(name);
38     }
39 
getCategoryGroupName(const uint8_t * categoryEnabledFlag)40     const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override {
41         return fCategories.getCategoryGroupName(categoryEnabledFlag);
42     }
43 
44 private:
45     SkString fIndent;
46     int fCnt = 0;
47     SkEventTracingCategories fCategories;
48 };
49 
50 #endif
51