blob: 44fc9f485d4149f1480143796778be6fcd9620e5 [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
Mike Kleineb678fc2019-03-20 12:01:47 -05008#ifndef EventTracingPriv_DEFINED
9#define EventTracingPriv_DEFINED
Brian Osman53136aa2017-07-20 15:43:35 -040010
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/private/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
Mike Kleineb678fc2019-03-20 12:01:47 -050026 uint8_t* getCategoryGroupEnabled(const char* name);
Brian Osman65e4c612017-07-21 11:06:24 -040027 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag);
28
29private:
30 enum { kMaxCategories = 256 };
31
32 struct CategoryState {
Mike Kleineb678fc2019-03-20 12:01:47 -050033 uint8_t fEnabled;
Brian Osman65e4c612017-07-21 11:06:24 -040034 const char* fName;
35 };
36
37 CategoryState fCategories[kMaxCategories];
Mike Kleineb678fc2019-03-20 12:01:47 -050038 int fNumCategories;
39 SkMutex fMutex;
Brian Osman65e4c612017-07-21 11:06:24 -040040};
41
Brian Osman53136aa2017-07-20 15:43:35 -040042#endif