blob: fb7b2f3fa5764b8de268a82f127190127736ac1e [file] [log] [blame]
Brian Osman53136aa2017-07-20 15:43:35 -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 SkEventTracingPriv_DEFINED
9#define SkEventTracingPriv_DEFINED
10
Brian Osman65e4c612017-07-21 11:06:24 -040011#include "SkMutex.h"
Brian Osman53136aa2017-07-20 15:43:35 -040012
13/**
Mike Klein3bf00422017-07-24 14:27:18 -040014 * Construct and install an SkEventTracer, based on the mode,
15 * defaulting to the --trace command line argument.
Brian Osman53136aa2017-07-20 15:43:35 -040016 */
Mike Klein3bf00422017-07-24 14:27:18 -040017void initializeEventTracingForTools(const char* mode = nullptr);
Brian Osman53136aa2017-07-20 15:43:35 -040018
Brian Osman65e4c612017-07-21 11:06:24 -040019/**
20 * Helper class used by internal implementations of SkEventTracer to manage categories.
21 */
22class SkEventTracingCategories {
23public:
24 SkEventTracingCategories() : fNumCategories(0) {}
25
26 uint8_t* getCategoryGroupEnabled(const char* name);
27 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag);
28
29private:
30 enum { kMaxCategories = 256 };
31
32 struct CategoryState {
33 uint8_t fEnabled;
34 const char* fName;
35 };
36
37 CategoryState fCategories[kMaxCategories];
38 int fNumCategories;
39 SkMutex fMutex;
40};
41
Brian Osman53136aa2017-07-20 15:43:35 -040042#endif