/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef INCLUDE_PERFETTO_TRACING_TRACK_EVENT_CATEGORY_REGISTRY_H_ #define INCLUDE_PERFETTO_TRACING_TRACK_EVENT_CATEGORY_REGISTRY_H_ #include "perfetto/tracing/data_source.h" #include <stddef.h> #include <atomic> #include <utility> namespace perfetto { class DynamicCategory; // A compile-time representation of a track event category. See // PERFETTO_DEFINE_CATEGORIES for registering your own categories. struct PERFETTO_EXPORT_COMPONENT Category { … }; // Dynamically constructed category names should marked as such through this // container type to make it less likely for trace points to accidentally start // using dynamic categories. Events with dynamic categories will always be // slightly more expensive than regular events, so use them sparingly. class PERFETTO_EXPORT_COMPONENT DynamicCategory final { … }; namespace internal { constexpr const char* NullCategory(const char*) { … } perfetto::DynamicCategory NullCategory(const perfetto::DynamicCategory&); constexpr bool StringMatchesPrefix(const char* str, const char* prefix) { … } constexpr bool IsStringInPrefixList(const char*) { … } template <typename... Args> constexpr bool IsStringInPrefixList(const char* str, const char* prefix, Args... args) { … } // Holds all the registered categories for one category namespace. See // PERFETTO_DEFINE_CATEGORIES for building the registry. class PERFETTO_EXPORT_COMPONENT TrackEventCategoryRegistry { … }; } // namespace internal } // namespace perfetto #endif // INCLUDE_PERFETTO_TRACING_TRACK_EVENT_CATEGORY_REGISTRY_H_