GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSChrono.cc
Go to the documentation of this file.
1 // ************************************************************************
2 // * This file is part of GGEMS. *
3 // * *
4 // * GGEMS is free software: you can redistribute it and/or modify *
5 // * it under the terms of the GNU General Public License as published by *
6 // * the Free Software Foundation, either version 3 of the License, or *
7 // * (at your option) any later version. *
8 // * *
9 // * GGEMS is distributed in the hope that it will be useful, *
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 // * GNU General Public License for more details. *
13 // * *
14 // * You should have received a copy of the GNU General Public License *
15 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
16 // * *
17 // ************************************************************************
18 
33 
37 
38 void GGEMSChrono::DisplayTime(DurationNano const& duration, std::string const& displayed_text)
39 {
40  #if __MINGW64__ || __clang__ || (_MSC_VER > 1800) || __GNUC__
41  // Display the iteration time
42  GGcout("GGEMSChrono", "DisplayTime", 0) << "Elapsed time (" << displayed_text << "): " << std::setfill( '0' ) << std::setw(2) << std::chrono::duration_cast<Hs>((duration)).count() << " hours " << std::setw(2) << std::chrono::duration_cast<Mins>((duration) % Hs(1)).count() << " mins " << std::setw(2) << std::chrono::duration_cast<Secs>((duration) % Mins(1) ).count() << " secs " << std::setw(3) << std::chrono::duration_cast<Ms>((duration) % Secs(1)).count() << " ms" << GGendl;
43  #else
44  GGcout("Chrono", "DisplayTime", 0) << "Elapsed time (" << displayedText << "): " << duration.count() / 1000000000.0f << "sec";
45  #endif
46 }
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
GGEMSChrono.hh
Namespace computing/displaying the time.
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGendl
#define GGendl
overload C++ std::endl
Definition: GGEMSPrint.hh:60
GGEMSPrint.hh
Print a custom std::cout end std::cerr handling verbosity.