20 using namespace std::chrono;
35 void start() { _timePoint1 = HighResClock::now(); }
36 void stop() { _timePoint2 = HighResClock::now(); }
37 float elapsedTimeInSec() {
return (
float)((double)elapsedTimeInMicroSec() / 1000000.0); }
39 int64_t
elapsedTimeInMicroSec() {
return duration_cast<microseconds>(HighResClock::now() - _timePoint1).count(); }
41 static void callAfterSleep(
int milliSec,
const function<
void(
void)>& callbackFunc)
46 this_thread::sleep_for(chrono::milliseconds(milliSec));
std::chrono::high_resolution_clock::time_point HighResTimePoint
std::chrono::high_resolution_clock HighResClock
High Resolution Timer class using C++11.
float elapsedTimeInMilliSec()
static void callAfterSleep(int milliSec, const function< void(void)> &callbackFunc)
int64_t elapsedTimeInMicroSec()
HighResTimePoint _timePoint1
high precision start time point
HighResTimePoint _timePoint2
high precision end time point