My Project
Loading...
Searching...
No Matches
TimingMacros.hpp
1/*
2 Copyright 2023 SINTEF Digital
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef OPM_TIMINGMACROS_HPP
20#define OPM_TIMINGMACROS_HPP
21
22// This file defines macros
23// OPM_TIMEBLOCK - time block of main part of codes which do not effect performance
24// OPM_TIMEFUNCTION - time block of main part of codes which do not effect performance with name from function
25// OPM_TIMEBLOCK_LOCAL - detailed timing which may effect performance
26// OPM_TIMEFUNCTION_LOCAL - detailed timing which may effect performance with name from function
27
28#ifndef DETAILED_PROFILING
29#define DETAILED_PROFILING 0 // set to 1 to enable invasive profiling
30#endif
31
32#if USE_TRACY
33#define TRACY_ENABLE 1
34#include <tracy/Tracy.hpp>
35#define OPM_TIMEBLOCK(blockname) ZoneNamedN(blockname, #blockname, true)
36#define OPM_TIMEFUNCTION() ZoneNamedN(myname, __func__, true)
37#if DETAILED_PROFILING
38#define OPM_TIMEBLOCK_LOCAL(blockname) ZoneNamedN(blockname, #blockname, true)
39#define OPM_TIMEFUNCTION_LOCAL() ZoneNamedN(myname, __func__, true)
40#endif
41#endif
42
43#ifndef OPM_TIMEBLOCK
44#define OPM_TIMEBLOCK(x)\
45 do { /* nothing */ } while (false)
46#endif
47
48// detailed timing which may effect performance
49#ifndef OPM_TIMEBLOCK_LOCAL
50#define OPM_TIMEBLOCK_LOCAL(x)\
51 do { /* nothing */ } while (false)
52#endif
53
54#ifndef OPM_TIMEFUNCTION
55#define OPM_TIMEFUNCTION()\
56 do { /* nothing */ } while (false)
57#endif
58
59#ifndef OPM_TIMEFUNCTION_LOCAL
60#define OPM_TIMEFUNCTION_LOCAL()\
61 do { /* nothing */ } while (false)
62#endif
63
64#endif // OPM_TIMINGMACROS_HPP