atlas
Trace.h
1 /*
2  * (C) Copyright 2013 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation
8  * nor does it submit to any jurisdiction.
9  */
10 
11 #pragma once
12 
13 #include "atlas/library/config.h"
14 #include "atlas/runtime/trace/Barriers.h"
15 #include "atlas/runtime/trace/Logging.h"
16 #include "atlas/runtime/trace/TraceT.h"
17 
18 //-----------------------------------------------------------------------------------------------------------
19 
52 #define ATLAS_TRACE( ... )
53 #define ATLAS_TRACE_SCOPE( ... )
54 #define ATLAS_TRACE_BARRIERS( enabled )
55 
56 //-----------------------------------------------------------------------------------------------------------
57 
58 namespace atlas {
59 
60 namespace runtime {
61 namespace trace {
62 struct TraceTraits {
63 #if ATLAS_HAVE_TRACE_BARRIERS
65 #else
67 #endif
69 };
70 
71 } // namespace trace
72 } // namespace runtime
73 
74 class Trace : public runtime::trace::TraceT<runtime::trace::TraceTraits> {
77 
78 public:
79  using Base::Base;
80 };
81 
82 } // namespace atlas
83 
84 //-----------------------------------------------------------------------------------------------------------
85 
86 #if ATLAS_HAVE_TRACE
87 
88 #include "atlas/util/detail/BlackMagic.h"
89 
90 #undef ATLAS_TRACE
91 #undef ATLAS_TRACE_SCOPE
92 #undef ATLAS_TRACE_BARRIERS
93 
94 #define ATLAS_TRACE( ... ) __ATLAS_TYPE( ::atlas::Trace, Here() __ATLAS_COMMA_ARGS( __VA_ARGS__ ) )
95 #define ATLAS_TRACE_SCOPE( ... ) __ATLAS_TYPE_SCOPE( ::atlas::Trace, Here() __ATLAS_COMMA_ARGS( __VA_ARGS__ ) )
96 #define ATLAS_TRACE_BARRIERS( enabled ) __ATLAS_TYPE( ::atlas::Trace::Barriers, enabled )
97 
98 #endif
99 
100 //-----------------------------------------------------------------------------------------------------------
Definition: Barriers.h:21
Definition: Barriers.h:33
Definition: Trace.h:74
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
Definition: TraceT.h:39
Definition: Logging.h:47