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