Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / js / public / ProfilingCategory.h
blob5cf247abc1749cde278dad7ef4090323932fe8ff
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef js_ProfilingCategory_h
8 #define js_ProfilingCategory_h
10 #include "jstypes.h" // JS_PUBLIC_API
12 // The source lives in mozglue/baseprofiler/public/ProfilingCategoryList.h
13 #include "js/ProfilingCategoryList.h" // MOZ_PROFILING_CATEGORY_LIST
15 namespace JS {
17 // clang-format off
19 // An enum that lists all possible category pairs in one list.
20 // This is the enum that is used in profiler stack labels. Having one list that
21 // includes subcategories from all categories in one list allows assigning the
22 // category pair to a stack label with just one number.
23 #define CATEGORY_ENUM_BEGIN_CATEGORY(name, labelAsString, color)
24 #define CATEGORY_ENUM_SUBCATEGORY(supercategory, name, labelAsString) name,
25 #define CATEGORY_ENUM_END_CATEGORY
26 enum class ProfilingCategoryPair : uint32_t {
27 MOZ_PROFILING_CATEGORY_LIST(CATEGORY_ENUM_BEGIN_CATEGORY,
28 CATEGORY_ENUM_SUBCATEGORY,
29 CATEGORY_ENUM_END_CATEGORY)
30 COUNT,
31 LAST = COUNT - 1,
33 #undef CATEGORY_ENUM_BEGIN_CATEGORY
34 #undef CATEGORY_ENUM_SUBCATEGORY
35 #undef CATEGORY_ENUM_END_CATEGORY
37 // An enum that lists just the categories without their subcategories.
38 #define SUPERCATEGORY_ENUM_BEGIN_CATEGORY(name, labelAsString, color) name,
39 #define SUPERCATEGORY_ENUM_SUBCATEGORY(supercategory, name, labelAsString)
40 #define SUPERCATEGORY_ENUM_END_CATEGORY
41 enum class ProfilingCategory : uint32_t {
42 MOZ_PROFILING_CATEGORY_LIST(SUPERCATEGORY_ENUM_BEGIN_CATEGORY,
43 SUPERCATEGORY_ENUM_SUBCATEGORY,
44 SUPERCATEGORY_ENUM_END_CATEGORY)
45 COUNT,
46 LAST = COUNT - 1,
48 #undef SUPERCATEGORY_ENUM_BEGIN_CATEGORY
49 #undef SUPERCATEGORY_ENUM_SUBCATEGORY
50 #undef SUPERCATEGORY_ENUM_END_CATEGORY
52 // clang-format on
54 struct ProfilingCategoryPairInfo {
55 ProfilingCategory mCategory;
56 uint32_t mSubcategoryIndex;
57 const char* mLabel;
60 JS_PUBLIC_API const ProfilingCategoryPairInfo& GetProfilingCategoryPairInfo(
61 ProfilingCategoryPair aCategoryPair);
63 } // namespace JS
65 #endif /* js_ProfilingCategory_h */