ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4TiMemory.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4TiMemory.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 // ----------------------------------------------------------------------
30 // G4TiMemory
31 //
32 // Provides empty macros when Geant4 is compiled with TiMemory disabled
33 // ----------------------------------------------------------------------
34 
35 #ifndef g4timemory_hh_
36 #define g4timemory_hh_
37 
38 // Fundamental definitions
39 #ifndef G4GMAKE
40 # include "G4GlobalConfig.hh"
41 #endif
42 
43 #include "globals.hh"
44 
45 //----------------------------------------------------------------------------//
46 #ifdef GEANT4_USE_TIMEMORY
47 
48 # include <timemory/timemory.hpp>
49 
50 using G4AutoTimer = tim::auto_timer;
51 
52 #else
53 
54 # include <ostream>
55 # include <string>
56 
57 namespace tim
58 {
59 template <typename... _Args>
60 void timemory_init(_Args...)
61 {
62 }
63 inline void timemory_finalize() {}
64 inline void print_env() {}
65 
68 struct dummy
69 {
70  template <typename... _Args>
71  dummy(_Args&&...)
72  {
73  }
74  ~dummy() = default;
75  dummy(const dummy&) = default;
76  dummy(dummy&&) = default;
77  dummy& operator=(const dummy&) = default;
78  dummy& operator=(dummy&&) = default;
79 
80  void start() {}
81  void stop() {}
83  void conditional_stop() {}
84  void report_at_exit(bool) {}
85  template <typename... _Args>
86  void mark_begin(_Args&&...)
87  {
88  }
89  template <typename... _Args>
90  void mark_end(_Args&&...)
91  {
92  }
93  friend std::ostream& operator<<(std::ostream& os, const dummy&) { return os; }
94 };
95 
96 } // namespace tim
97 
98 // startup/shutdown/configure
99 # define TIMEMORY_INIT(...)
100 # define TIMEMORY_FINALIZE()
101 # define TIMEMORY_CONFIGURE(...)
102 
103 // label creation
104 # define TIMEMORY_BASIC_LABEL(...) std::string("")
105 # define TIMEMORY_LABEL(...) std::string("")
106 # define TIMEMORY_JOIN(...) std::string("")
107 
108 // define an object
109 # define TIMEMORY_BLANK_MARKER(...)
110 # define TIMEMORY_BASIC_MARKER(...)
111 # define TIMEMORY_MARKER(...)
112 
113 // define an unique pointer object
114 # define TIMEMORY_BLANK_POINTER(...)
115 # define TIMEMORY_BASIC_POINTER(...)
116 # define TIMEMORY_POINTER(...)
117 
118 // define an object with a caliper reference
119 # define TIMEMORY_BLANK_CALIPER(...)
120 # define TIMEMORY_BASIC_CALIPER(...)
121 # define TIMEMORY_CALIPER(...)
122 
123 // define a static object with a caliper reference
124 # define TIMEMORY_STATIC_BLANK_CALIPER(...)
125 # define TIMEMORY_STATIC_BASIC_CALIPER(...)
126 # define TIMEMORY_STATIC_CALIPER(...)
127 
128 // invoke member function on caliper reference or type within reference
129 # define TIMEMORY_CALIPER_APPLY(...)
130 # define TIMEMORY_CALIPER_TYPE_APPLY(...)
131 
132 // get an object
133 # define TIMEMORY_BLANK_HANDLE(...) tim::dummy()
134 # define TIMEMORY_BASIC_HANDLE(...) tim::dummy()
135 # define TIMEMORY_HANDLE(...) tim::dummy()
136 
137 // get a pointer to an object
138 # define TIMEMORY_BLANK_POINTER_HANDLE(...) nullptr
139 # define TIMEMORY_BASIC_POINTER_HANDLE(...) nullptr
140 # define TIMEMORY_POINTER_HANDLE(...) nullptr
141 
142 // debug only
143 # define TIMEMORY_DEBUG_BLANK_MARKER(...)
144 # define TIMEMORY_DEBUG_BASIC_MARKER(...)
145 # define TIMEMORY_DEBUG_MARKER(...)
146 
147 // auto-timers
148 # define TIMEMORY_BLANK_AUTO_TIMER(...)
149 # define TIMEMORY_BASIC_AUTO_TIMER(...)
150 # define TIMEMORY_AUTO_TIMER(...)
151 # define TIMEMORY_BLANK_AUTO_TIMER_HANDLE(...)
152 # define TIMEMORY_BASIC_AUTO_TIMER_HANDLE(...)
153 # define TIMEMORY_AUTO_TIMER_HANDLE(...)
154 # define TIMEMORY_DEBUG_BASIC_AUTO_TIMER(...)
155 # define TIMEMORY_DEBUG_AUTO_TIMER(...)
156 
158 
159 #endif
160 
161 //----------------------------------------------------------------------------//
162 
163 #endif
164