OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
UtilTiming.cpp
Go to the documentation of this file.
1 
12 #include "UtilTiming.hpp"
13 
15 void GetWallTime::StopInfo(const std::string& info, std::ostream& out) const
16 {
17  const double duration = Stop();
18  if (duration < CLOCK_USE_SEC) {
19  std::cout << info << " costs " << std::fixed << std::setprecision(3) << duration
20  << "ms" << std::endl;
21  } else if (duration < CLOCK_USE_MIN) {
22  std::cout << info << " costs " << std::fixed << std::setprecision(3)
23  << duration / 1000.0 << "s" << std::endl;
24  } else {
25  std::cout << info << " costs " << std::fixed << std::setprecision(3)
26  << duration / 60000.0 << "m" << std::endl;
27  }
28 }
29 
30 /*----------------------------------------------------------------------------*/
31 /* Brief Change History of This File */
32 /*----------------------------------------------------------------------------*/
33 /* Author Date Actions */
34 /*----------------------------------------------------------------------------*/
35 /* Shizhe Li Oct/01/2021 Create file */
36 /* Chensong Zhang Oct/15/2021 Format file */
37 /*----------------------------------------------------------------------------*/
Elapsed wall-time and CPU-cycles declaration.
const double CLOCK_USE_MIN
Show clock time in minutes.
Definition: UtilTiming.hpp:24
const double CLOCK_USE_SEC
Show clock time in seconds.
Definition: UtilTiming.hpp:23
__inline__ double Stop() const
Stop the timer and return duration from start() in ms.
Definition: UtilTiming.hpp:54
void StopInfo(const std::string &info, std::ostream &out=std::cout) const
Stop the timer and print out duration time.
Definition: UtilTiming.cpp:15