// Start of timing.h. // The function get_wall_time() returns the wall time in microseconds // (with an unspecified offset). #ifdef _WIN32 #include static int64_t get_wall_time(void) { LARGE_INTEGER time,freq; assert(QueryPerformanceFrequency(&freq)); assert(QueryPerformanceCounter(&time)); return ((double)time.QuadPart / freq.QuadPart) * 1000000; } static int64_t get_wall_time_ns(void) { return get_wall_time() * 1000; } #else // Assuming POSIX #include #include static int64_t get_wall_time_ns(void) { struct timespec time; assert(clock_gettime(CLOCK_MONOTONIC, &time) == 0); return time.tv_sec * 1000000000 + time.tv_nsec; } static int64_t get_wall_time(void) { return get_wall_time_ns() / 1000; } #endif // End of timing.h.