GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSChrono.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_TOOLS_GGEMSCHRONO_HH
2 #define GUARD_GGEMS_TOOLS_GGEMSCHRONO_HH
3 
4 // ************************************************************************
5 // * This file is part of GGEMS. *
6 // * *
7 // * GGEMS is free software: you can redistribute it and/or modify *
8 // * it under the terms of the GNU General Public License as published by *
9 // * the Free Software Foundation, either version 3 of the License, or *
10 // * (at your option) any later version. *
11 // * *
12 // * GGEMS is distributed in the hope that it will be useful, *
13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 // * GNU General Public License for more details. *
16 // * *
17 // * You should have received a copy of the GNU General Public License *
18 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
19 // * *
20 // ************************************************************************
21 
34 #include <chrono>
35 #include <string>
36 
37 #include "GGEMS/global/GGEMSExport.hh"
38 
39 typedef std::chrono::time_point<std::chrono::system_clock> ChronoTime;
40 typedef std::chrono::duration<int64_t,std::nano> DurationNano;
42 #if __MINGW64__ || __clang__ || (_MSC_VER > 1800) || __GNUC__
43 typedef std::chrono::milliseconds Ms;
44 typedef std::chrono::seconds Secs;
45 typedef std::chrono::minutes Mins;
46 typedef std::chrono::hours Hs;
47 #endif
48 
53 namespace GGEMSChrono
54 {
61  void GGEMS_EXPORT DisplayTime(DurationNano const& duration, std::string const& displayed_text);
62 
67  inline ChronoTime Now(void) {return std::chrono::system_clock::now();}
68 
74  inline DurationNano Zero(void) {return std::chrono::duration<int64_t,std::nano>::zero();}
75 }
76 
77 #endif // End of GUARD_GGEMS_TOOLS_CHRONO_HH
GGEMSChrono::Zero
DurationNano Zero(void)
Initialization at zero nanosecond.
Definition: GGEMSChrono.hh:74
GGEMSChrono::DisplayTime
void DisplayTime(DurationNano const &duration, std::string const &displayed_text)
Print the execution time.
Definition: GGEMSChrono.cc:38
DurationNano
std::chrono::duration< int64_t, std::nano > DurationNano
Definition: GGEMSChrono.hh:40
ChronoTime
std::chrono::time_point< std::chrono::system_clock > ChronoTime
Definition: GGEMSChrono.hh:39
GGEMSChrono::Now
ChronoTime Now(void)
Definition: GGEMSChrono.hh:67
GGEMSChrono
namespace computing/displaying the time