31 #include "utils/timer.h"
42 static const clockid_t clockType = CLOCK_MONOTONIC;
44 #define timeData ((static_cast<long long int>(time.tv_sec) * 1000000000LL \
45 + static_cast<long long int>(time.tv_nsec)) / 1)
51 long long unsigned int startTime;
53 void init(
const std::string &path)
55 file.open(path.c_str(), std::ios_base::trunc);
57 clock_gettime(clockType, &time);
58 temp.reserve(10000000U);
71 clock_gettime(clockType, &time);
72 temp.append(
toString(timeData - startTime)).append(
76 void blockStart(
const std::string &name)
79 clock_gettime(clockType, &time);
80 temp.append(
toString(timeData - startTime)).append(
81 " start: ").append(name).append(
"\n");
84 void blockEnd(
const std::string &name)
87 clock_gettime(clockType, &time);
88 temp.append(
toString(timeData - startTime)).append(
89 " end: ").append(name).append(
"\n");
std::string toString(T const &value)
converts any type to a string