#pragma once #include #include #include namespace platform { class Timer { private: std::string label; long int start; long int end; long int gettime() { struct timeval tp; gettimeofday(&tp, NULL); return (double)(tp.tv_sec * 1000 + (double)tp.tv_usec / 1000); }; public: Timer(const char *lbl) { this->label = std::string(lbl); this->start = this->gettime(); } ~Timer() { this->end = this->gettime(); unsigned long diff = this->end - this->start; std::cout << this->label << diff << std::endl; } }; };