skia2/tools/trace/SkDebugfTracer.h
Brian Osman 65e4c614f0 Add category support to JSON and SkDebugf tracing
Bug: skia:
Change-Id: I4d0bdb9d954e49b79ace0552d7b74b36a512c00d
Reviewed-on: https://skia-review.googlesource.com/25642
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-07-21 16:38:23 +00:00

51 lines
1.6 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkDebugfTracer_DEFINED
#define SkDebugfTracer_DEFINED
#include "SkEventTracer.h"
#include "SkEventTracingPriv.h"
#include "SkString.h"
/**
* A SkEventTracer implementation that logs events using SkDebugf.
*/
class SkDebugfTracer : public SkEventTracer {
public:
SkDebugfTracer() {}
SkEventTracer::Handle addTraceEvent(char phase,
const uint8_t* categoryEnabledFlag,
const char* name,
uint64_t id,
int numArgs,
const char** argNames,
const uint8_t* argTypes,
const uint64_t* argValues,
uint8_t flags) override;
void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
const char* name,
SkEventTracer::Handle handle) override;
const uint8_t* getCategoryGroupEnabled(const char* name) override {
return fCategories.getCategoryGroupEnabled(name);
}
const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override {
return fCategories.getCategoryGroupName(categoryEnabledFlag);
}
private:
SkString fIndent;
int fCnt = 0;
SkEventTracingCategories fCategories;
};
#endif