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 "SkString.h" 13 14 /** 15 * A SkEventTracer implementation that logs events using SkDebugf. 16 */ 17 class SkDebugfTracer : public SkEventTracer { 18 public: SkDebugfTracer()19 SkDebugfTracer() {} 20 21 SkEventTracer::Handle addTraceEvent(char phase, 22 const uint8_t* categoryEnabledFlag, 23 const char* name, 24 uint64_t id, 25 int numArgs, 26 const char** argNames, 27 const uint8_t* argTypes, 28 const uint64_t* argValues, 29 uint8_t flags) override; 30 31 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag, 32 const char* name, 33 SkEventTracer::Handle handle) override; 34 35 const uint8_t* getCategoryGroupEnabled(const char* name) override; 36 getCategoryGroupName(const uint8_t * categoryEnabledFlag)37 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override { 38 static const char* category = "category?"; 39 return category; 40 } 41 42 private: 43 SkString fIndent; 44 int fCnt = 0; 45 }; 46 47 #endif 48