Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 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 | |
Mike Klein | eb678fc | 2019-03-20 12:01:47 -0500 | [diff] [blame] | 8 | #ifndef EventTracingPriv_DEFINED |
| 9 | #define EventTracingPriv_DEFINED |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/private/SkMutex.h" |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 12 | |
| 13 | /** |
Mike Klein | 3bf0042 | 2017-07-24 14:27:18 -0400 | [diff] [blame] | 14 | * Construct and install an SkEventTracer, based on the mode, |
| 15 | * defaulting to the --trace command line argument. |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 16 | */ |
Mike Klein | 3bf0042 | 2017-07-24 14:27:18 -0400 | [diff] [blame] | 17 | void initializeEventTracingForTools(const char* mode = nullptr); |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 18 | |
Brian Osman | 65e4c61 | 2017-07-21 11:06:24 -0400 | [diff] [blame] | 19 | /** |
| 20 | * Helper class used by internal implementations of SkEventTracer to manage categories. |
| 21 | */ |
| 22 | class SkEventTracingCategories { |
| 23 | public: |
| 24 | SkEventTracingCategories() : fNumCategories(0) {} |
| 25 | |
Mike Klein | eb678fc | 2019-03-20 12:01:47 -0500 | [diff] [blame] | 26 | uint8_t* getCategoryGroupEnabled(const char* name); |
Brian Osman | 65e4c61 | 2017-07-21 11:06:24 -0400 | [diff] [blame] | 27 | const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag); |
| 28 | |
| 29 | private: |
| 30 | enum { kMaxCategories = 256 }; |
| 31 | |
| 32 | struct CategoryState { |
Mike Klein | eb678fc | 2019-03-20 12:01:47 -0500 | [diff] [blame] | 33 | uint8_t fEnabled; |
Brian Osman | 65e4c61 | 2017-07-21 11:06:24 -0400 | [diff] [blame] | 34 | const char* fName; |
| 35 | }; |
| 36 | |
| 37 | CategoryState fCategories[kMaxCategories]; |
Mike Klein | eb678fc | 2019-03-20 12:01:47 -0500 | [diff] [blame] | 38 | int fNumCategories; |
| 39 | SkMutex fMutex; |
Brian Osman | 65e4c61 | 2017-07-21 11:06:24 -0400 | [diff] [blame] | 40 | }; |
| 41 | |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 42 | #endif |