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.
macros.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
28
29/// \macro TIMEMORY_DECLARE_NS_API(NS, NAME)
30/// \brief Declare an API category. APIs are used to designate
31/// different project implementations, different external library tools, etc.
32///
33#if !defined(TIMEMORY_DECLARE_NS_API)
34# define TIMEMORY_DECLARE_NS_API(NS, NAME) \
35 namespace tim \
36 { \
37 namespace NS \
38 { \
39 struct NAME; \
40 } \
41 }
42#endif
43
44#if !defined(TIMEMORY_DECLARE_API)
45# define TIMEMORY_DECLARE_API(NAME) TIMEMORY_DECLARE_NS_API(api, NAME)
46#endif
47
48//
49/// \macro TIMEMORY_DEFINE_NS_API(NS, NAME)
50/// \param NS sub-namespace within tim::
51/// \param NAME the name of the API
52///
53/// \brief Define an API category within a namespace
54///
55#if !defined(TIMEMORY_DEFINE_NS_API)
56# define TIMEMORY_DEFINE_NS_API(NS, NAME) \
57 namespace tim \
58 { \
59 namespace NS \
60 { \
61 struct NAME : public concepts::api \
62 {}; \
63 } \
64 }
65#endif
66
67///
68/// \macro TIMEMORY_DEFINE_API
69/// \brief Define an API category. APIs are used to designate
70/// different project implementations, different external library tools, etc.
71/// Note: this macro inherits from \ref concepts::api instead of specializing
72/// is_api<...>, thus allowing specialization from tools downstream
73///
74#if !defined(TIMEMORY_DEFINE_API)
75# define TIMEMORY_DEFINE_API(NAME) TIMEMORY_DEFINE_NS_API(api, NAME)
76#endif