Header-only file allowing timing runtime assessments for C++.
START_TIMER(): Start a time-measured block. may be TM::nano, TM::micro, TM::milli, TM::sec, TM::min
LAP(): Display intermediate timings. is the displayed message.
END_TIMER(): Display last timer and total. is the displayed message.
int main() {
START_TIMER(TM::milli)
std::cout << "Hello World!"
<< std::endl;
for(int i=0,j=0;i<100000000;++i)
j++;
LAP("intermediate")
for(int i=0,j=0;i<100000000;++i)
j++;
END_TIMER("Time exec")
return 0;
}
Output:
Hello World!
» intermediate: 174.81 ms
» Time exec: 171.69 ms
» Total: 346.59 ms
- C++17
- Change standard output for variable outputs.