23 #ifndef COM_DAFER45_TBTK_UTIL 24 #define COM_DAFER45_TBTK_UTIL 44 static void tick(std::string tag =
"");
51 static std::vector<std::chrono::time_point<std::chrono::high_resolution_clock>> timestamps;
54 static std::vector<std::string> tags;
58 timestamps.push_back(std::chrono::high_resolution_clock::now());
63 std::chrono::time_point<std::chrono::high_resolution_clock> stop = std::chrono::high_resolution_clock::now();
64 if(timestamps.size() > 0){
65 std::chrono::time_point<std::chrono::high_resolution_clock> start = timestamps.back();
66 timestamps.pop_back();
67 std::string tag = tags.back();
70 int hours = (std::chrono::duration_cast<std::chrono::hours>(stop - start).count());
71 int minutes = (std::chrono::duration_cast<std::chrono::minutes>(stop - start).count())%60;
72 int seconds = (std::chrono::duration_cast<std::chrono::seconds>(stop - start).count())%60;
73 int milliseconds = (std::chrono::duration_cast<std::chrono::milliseconds>(stop - start).count())%1000;
74 int microseconds = (std::chrono::duration_cast<std::chrono::microseconds>(stop - start).count())%1000;
75 int nanoseconds = (std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start).count())%1000;
80 if(hours > 0 || minutes > 0)
82 if(hours > 0 || minutes > 0 || seconds > 0)
84 if(hours > 0 || minutes > 0 || seconds > 0 || milliseconds > 0)
86 if(hours > 0 || minutes > 0 || seconds > 0 || milliseconds > 0 || microseconds > 0)
88 if(hours > 0 || minutes > 0 || seconds > 0 || milliseconds > 0 || microseconds > 0 || nanoseconds > 0)
93 Streams::out <<
"Error in Time::tock(): No corresponding tick call made.\n";
static void tick(std::string tag="")
Definition: Util.h:57
static void tock()
Definition: Util.h:62
static std::ostream out
Definition: Streams.h:37
Definition: AbstractOperator.h:26