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 BaseProfilingCategory_h
8 #define BaseProfilingCategory_h
10 #include "mozilla/Types.h"
14 #include "ProfilingCategoryList.h"
17 namespace baseprofiler
{
21 // An enum that lists all possible category pairs in one list.
22 // This is the enum that is used in profiler stack labels. Having one list that
23 // includes subcategories from all categories in one list allows assigning the
24 // category pair to a stack label with just one number.
25 #define CATEGORY_ENUM_BEGIN_CATEGORY(name, labelAsString, color)
26 #define CATEGORY_ENUM_SUBCATEGORY(supercategory, name, labelAsString) name,
27 #define CATEGORY_ENUM_END_CATEGORY
28 enum class ProfilingCategoryPair
: uint32_t {
29 MOZ_PROFILING_CATEGORY_LIST(CATEGORY_ENUM_BEGIN_CATEGORY
,
30 CATEGORY_ENUM_SUBCATEGORY
,
31 CATEGORY_ENUM_END_CATEGORY
)
35 #undef CATEGORY_ENUM_BEGIN_CATEGORY
36 #undef CATEGORY_ENUM_SUBCATEGORY
37 #undef CATEGORY_ENUM_END_CATEGORY
39 // An enum that lists just the categories without their subcategories.
40 #define SUPERCATEGORY_ENUM_BEGIN_CATEGORY(name, labelAsString, color) name,
41 #define SUPERCATEGORY_ENUM_SUBCATEGORY(supercategory, name, labelAsString)
42 #define SUPERCATEGORY_ENUM_END_CATEGORY
43 enum class ProfilingCategory
: uint32_t {
44 MOZ_PROFILING_CATEGORY_LIST(SUPERCATEGORY_ENUM_BEGIN_CATEGORY
,
45 SUPERCATEGORY_ENUM_SUBCATEGORY
,
46 SUPERCATEGORY_ENUM_END_CATEGORY
)
50 #undef SUPERCATEGORY_ENUM_BEGIN_CATEGORY
51 #undef SUPERCATEGORY_ENUM_SUBCATEGORY
52 #undef SUPERCATEGORY_ENUM_END_CATEGORY
56 struct ProfilingCategoryPairInfo
{
57 ProfilingCategory mCategory
;
58 uint32_t mSubcategoryIndex
;
62 MFBT_API
const ProfilingCategoryPairInfo
& GetProfilingCategoryPairInfo(
63 ProfilingCategoryPair aCategoryPair
);
65 } // namespace baseprofiler
66 } // namespace mozilla
68 #endif /* BaseProfilingCategory_h */