timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
types.hpp
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2020, The Regents of the University of California,
4// through Lawrence Berkeley National Laboratory (subject to receipt of any
5// required approvals from the U.S. Dept. of Energy). All rights reserved.
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in all
15// copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23// SOFTWARE.
24
25#pragma once
26
29#include "timemory/enum.h"
32
33// Declared in timemory/mpl/concepts.hpp
34// TIMEMORY_DECLARE_TEMPLATE_COMPONENT(gotcha, size_t Nt, typename Components,
35// typename Differentiator = anonymous_t<void>)
36//
38TIMEMORY_DECLARE_COMPONENT(memory_allocations)
39//
41
42//--------------------------------------------------------------------------------------//
43//
44// APIs
45//
46//--------------------------------------------------------------------------------------//
47//
48namespace tim
49{
50namespace trait
51{
52template <size_t Nt, typename ComponentsT, typename DiffT>
53struct component_apis<component::gotcha<Nt, ComponentsT, DiffT>>
54{
56};
57} // namespace trait
58} // namespace tim
59//
60TIMEMORY_SET_COMPONENT_API(component::malloc_gotcha, tpls::gotcha, category::external,
61 category::memory, os::supports_linux)
62TIMEMORY_SET_COMPONENT_API(component::memory_allocations, tpls::gotcha,
63 category::external, category::memory, os::supports_linux)
64//
65//--------------------------------------------------------------------------------------//
66//
67// STATISTICS
68//
69//--------------------------------------------------------------------------------------//
70//
71TIMEMORY_STATISTICS_TYPE(component::malloc_gotcha, double)
72//
73//--------------------------------------------------------------------------------------//
74//
75// IS AVAILABLE
76//
77//--------------------------------------------------------------------------------------//
78//
79#if !defined(TIMEMORY_USE_GOTCHA)
80//
81TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, tpls::gotcha, false_type)
82TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, component::malloc_gotcha, false_type)
83TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, component::memory_allocations, false_type)
84//
85namespace tim
86{
87namespace trait
88{
89//
90template <size_t N, typename Comp, typename Diff>
91struct is_available<component::gotcha<N, Comp, Diff>> : false_type
92{};
93//
94} // namespace trait
95} // namespace tim
96//
97#endif // TIMEMORY_USE_GOTCHA
98//
99//--------------------------------------------------------------------------------------//
100//
101// IS MEMORY CATEGORY
102//
103//--------------------------------------------------------------------------------------//
104//
105TIMEMORY_DEFINE_CONCRETE_TRAIT(is_memory_category, component::malloc_gotcha, true_type)
106//
107//--------------------------------------------------------------------------------------//
108//
109// USES MEMORY UNITS
110//
111//--------------------------------------------------------------------------------------//
112//
113TIMEMORY_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::malloc_gotcha, true_type)
114//
115//--------------------------------------------------------------------------------------//
116//
117// IS GOTCHA
118// START PRIORITY
119// STOP PRIORITY
120//
121//--------------------------------------------------------------------------------------//
122//
123namespace tim
124{
125//
126//--------------------------------------------------------------------------------------//
127//
128namespace trait
129{
130//
131template <size_t N, typename Comp, typename Diff>
132struct is_gotcha<component::gotcha<N, Comp, Diff>> : true_type
133{};
134//
135//
136template <size_t N, typename Comp, typename Diff>
137struct start_priority<component::gotcha<N, Comp, Diff>> : priority_constant<256>
138{};
139//
140//
141template <size_t N, typename Comp, typename Diff>
142struct stop_priority<component::gotcha<N, Comp, Diff>> : priority_constant<-256>
143{};
144//
145} // namespace trait
146//
147//--------------------------------------------------------------------------------------//
148//
149namespace concepts
150{
151//
152//--------------------------------------------------------------------------------------//
153//
154template <template <typename...> class Tuple, typename... T>
155struct has_gotcha<Tuple<T...>>
156{
157 using type = typename mpl::get_true_types<trait::is_gotcha, Tuple<T...>>::type;
158 static constexpr bool value = (mpl::get_tuple_size<type>::value != 0);
159};
160//
161//--------------------------------------------------------------------------------------//
162//
163} // namespace concepts
164} // namespace tim
165//
166//======================================================================================//
167//
168TIMEMORY_PROPERTY_SPECIALIZATION(malloc_gotcha, TIMEMORY_MALLOC_GOTCHA, "malloc_gotcha",
169 "")
170//
172 "memory_allocations", "")
173//
174//======================================================================================//
175//
TIMEMORY_DECLARE_COMPONENT(caliper_config) TIMEMORY_DECLARE_COMPONENT(caliper_marker) TIMEMORY_DECLARE_COMPONENT(caliper_loop_marker) TIMEMORY_COMPONENT_ALIAS(caliper
Toolset
Definition: types.hpp:40
#define TIMEMORY_PROPERTY_SPECIALIZATION(TYPE, ENUM, ID,...)
Specialization of the property specialization.
Definition: macros.hpp:223
TIMEMORY_DECLARE_TEMPLATE_COMPONENT(user_bundle, size_t Idx, typename Tag=TIMEMORY_API) TIMEMORY_BUNDLE_INDEX(ompt_bundle_idx
int EventTypes int EventTypes papi_array< 16 > papi_array< 8 > TIMEMORY_SET_COMPONENT_API(component::papi_vector, tpls::papi, category::external, category::hardware_counter, os::supports_linux) TIMEMORY_SET_TEMPLATE_COMPONENT_API(TIMEMORY_ESC(size_t MaxNumEvents)
false_type TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, component::perfetto_trace, false_type) TIMEMORY_PROPERTY_SPECIALIZATION(perfetto_trace
#define TIMEMORY_MEMORY_ALLOCATIONS
Definition: enum.h:500
#define TIMEMORY_MALLOC_GOTCHA
Definition: enum.h:497
#define TIMEMORY_STATISTICS_TYPE(COMPONENT, TYPE)
Definition: macros.hpp:207
trait to specify the APIs that the component is logically a part of
Definition: kokkosp.cpp:39
std::integral_constant< int, N > priority_constant
Definition: types.hpp:206
lightweight tuple-alternative for meta-programming logic
Definition: types.hpp:233
static constexpr size_t value
Definition: types.hpp:922
typename typename typename
Definition: types.hpp:226