Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:12

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4TiMemory
0027 //
0028 // Description:
0029 //
0030 // Provides empty macros when Geant4 is compiled with TiMemory disabled
0031 
0032 // Author: Jonathan R. Madsen, 25 April 2019
0033 // --------------------------------------------------------------------
0034 #ifndef g4timemory_hh
0035 #define g4timemory_hh 1
0036 
0037 // Fundamental definitions
0038 #ifndef G4GMAKE
0039 #  include "G4GlobalConfig.hh"
0040 #endif
0041 
0042 #include "globals.hh"
0043 
0044 #include <cstddef>
0045 #include <functional>
0046 #include <string>
0047 #include <utility>
0048 
0049 //----------------------------------------------------------------------------//
0050 
0051 #ifdef GEANT4_USE_TIMEMORY
0052 
0053 #  include <timemory/timemory.hpp>
0054 
0055 namespace g4tim
0056 {
0057 using namespace tim;
0058 }  // namespace g4tim
0059 
0060 using G4AutoTimer = g4tim::auto_timer;
0061 
0062 #else
0063 
0064 #  include <ostream>
0065 #  include <string>
0066 
0067 namespace g4tim
0068 {
0069 
0070   /// this provides "functionality" for *_HANDLE macros
0071   /// and can be omitted if these macros are not utilized
0072   struct dummy
0073   {
0074     template <typename... _Types, typename... _Args>
0075     static void configure(_Args&&...)
0076     {}
0077     template <typename... _Args>
0078     dummy(_Args&&...)
0079     {}
0080     ~dummy()            = default;
0081     dummy(const dummy&) = default;
0082     dummy(dummy&&)      = default;
0083     dummy& operator=(const dummy&) = default;
0084     dummy& operator=(dummy&&) = default;
0085 
0086     void record() {}
0087     void start() {}
0088     void stop() {}
0089     void push() {}
0090     void pop() {}
0091     void reset() {}
0092     void report_at_exit(bool) {}
0093     template <typename... _Args>
0094     void mark_begin(_Args&&...)
0095     {}
0096     template <typename... _Args>
0097     void mark_end(_Args&&...)
0098     {}
0099     friend std::ostream& operator<<(std::ostream& os, const dummy&)
0100     {
0101       return os;
0102     }
0103   };
0104 
0105 }  // namespace g4tim
0106 
0107 // startup/shutdown/configure
0108 #  define TIMEMORY_INIT(...)
0109 #  define TIMEMORY_FINALIZE()
0110 #  define TIMEMORY_CONFIGURE(...)
0111 
0112 // label creation
0113 #  define TIMEMORY_BASIC_LABEL(...) std::string("")
0114 #  define TIMEMORY_LABEL(...) std::string("")
0115 #  define TIMEMORY_JOIN(...) std::string("")
0116 
0117 // define an object
0118 #  define TIMEMORY_BLANK_MARKER(...)
0119 #  define TIMEMORY_BASIC_MARKER(...)
0120 #  define TIMEMORY_MARKER(...)
0121 
0122 // define an unique pointer object
0123 #  define TIMEMORY_BLANK_POINTER(...)
0124 #  define TIMEMORY_BASIC_POINTER(...)
0125 #  define TIMEMORY_POINTER(...)
0126 
0127 // define an object with a caliper reference
0128 #  define TIMEMORY_BLANK_CALIPER(...)
0129 #  define TIMEMORY_BASIC_CALIPER(...)
0130 #  define TIMEMORY_CALIPER(...)
0131 
0132 // define a static object with a caliper reference
0133 #  define TIMEMORY_STATIC_BLANK_CALIPER(...)
0134 #  define TIMEMORY_STATIC_BASIC_CALIPER(...)
0135 #  define TIMEMORY_STATIC_CALIPER(...)
0136 
0137 // invoke member function on caliper reference or type within reference
0138 #  define TIMEMORY_CALIPER_APPLY(...)
0139 #  define TIMEMORY_CALIPER_TYPE_APPLY(...)
0140 
0141 // get an object
0142 #    define TIMEMORY_BLANK_HANDLE(...) g4tim::dummy()
0143 #    define TIMEMORY_BASIC_HANDLE(...) g4tim::dummy()
0144 #  define TIMEMORY_HANDLE(...) tim::dummy()
0145 
0146 // get a pointer to an object
0147 #  define TIMEMORY_BLANK_POINTER_HANDLE(...) nullptr
0148 #  define TIMEMORY_BASIC_POINTER_HANDLE(...) nullptr
0149 #  define TIMEMORY_POINTER_HANDLE(...) nullptr
0150 
0151 // debug only
0152 #  define TIMEMORY_DEBUG_BLANK_MARKER(...)
0153 #  define TIMEMORY_DEBUG_BASIC_MARKER(...)
0154 #  define TIMEMORY_DEBUG_MARKER(...)
0155 
0156 // auto-timers
0157 #  define TIMEMORY_BLANK_AUTO_TIMER(...)
0158 #  define TIMEMORY_BASIC_AUTO_TIMER(...)
0159 #  define TIMEMORY_AUTO_TIMER(...)
0160 #  define TIMEMORY_BLANK_AUTO_TIMER_HANDLE(...)
0161 #  define TIMEMORY_BASIC_AUTO_TIMER_HANDLE(...)
0162 #  define TIMEMORY_AUTO_TIMER_HANDLE(...)
0163 #  define TIMEMORY_DEBUG_BASIC_AUTO_TIMER(...)
0164 #  define TIMEMORY_DEBUG_AUTO_TIMER(...)
0165 
0166 using G4AutoTimer = g4tim::dummy;
0167 
0168 #endif
0169 
0170 //----------------------------------------------------------------------------//
0171 
0172 #endif