1#ifndef VIENNASHE_UTIL_TIMER_HPP
2#define VIENNASHE_UTIL_TIMER_HPP
49 timer() { QueryPerformanceFrequency(&freq_); }
54 QueryPerformanceCounter((LARGE_INTEGER*) &start_time_);
60 LARGE_INTEGER end_time;
61 QueryPerformanceCounter((LARGE_INTEGER*) &end_time);
62 return (
static_cast<double>(end_time.QuadPart) -
static_cast<double>(start_time_.QuadPart)) /
static_cast<double>(freq_.QuadPart);
67 LARGE_INTEGER start_time_;
83 gettimeofday(&tval, 0);
84 ts_ = tval.tv_sec * 1000000 + tval.tv_usec;
91 gettimeofday(&tval, 0);
93 long end_time = tval.tv_sec * 1000000 + tval.tv_usec;
95 return static_cast<double>(end_time - ts_) / 1000000.0;
void start()
Starts the timer.
double get() const
Returns the number of seconds elapsed.
The main ViennaSHE namespace. All functionality resides inside this namespace.