1 #ifndef _VIENNACL_TOOLS_TIMER_HPP_
2 #define _VIENNACL_TOOLS_TIMER_HPP_
30 #define WINDOWS_LEAN_AND_MEAN
50 QueryPerformanceFrequency(&freq);
55 QueryPerformanceCounter((LARGE_INTEGER*) &start_time);
60 LARGE_INTEGER elapsed;
61 QueryPerformanceCounter((LARGE_INTEGER*) &end_time);
62 elapsed.QuadPart = end_time.QuadPart - start_time.QuadPart;
63 return elapsed.QuadPart /
static_cast<double>(freq.QuadPart);
69 LARGE_INTEGER start_time;
70 LARGE_INTEGER end_time;
100 gettimeofday(&tval, NULL);
101 ts =
static_cast<double>(tval.tv_sec * 1000000 + tval.tv_usec);
107 gettimeofday(&tval, NULL);
108 double end_time =
static_cast<double>(tval.tv_sec * 1000000 + tval.tv_usec);
110 return static_cast<double>(end_time-ts) / 1000000.0;