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_FRIEND_API
12 // The source lives in mozglue/baseprofiler/public/ProfilingCategoryList.h
13 #include "js/ProfilingCategoryList.h" // MOZ_PROFILING_CATEGORY_LIST
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
)
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
)
48 #undef SUPERCATEGORY_ENUM_BEGIN_CATEGORY
49 #undef SUPERCATEGORY_ENUM_SUBCATEGORY
50 #undef SUPERCATEGORY_ENUM_END_CATEGORY
54 struct ProfilingCategoryPairInfo
{
55 ProfilingCategory mCategory
;
56 uint32_t mSubcategoryIndex
;
60 JS_FRIEND_API
const ProfilingCategoryPairInfo
& GetProfilingCategoryPairInfo(
61 ProfilingCategoryPair aCategoryPair
);
65 #endif /* js_ProfilingCategory_h */