#ifndef TESTS_TIMING_H
#define TESTS_TIMING_H
#include <assert.h>
#if defined(_WIN32)
#include <windows.h>
#else
#include <sys/time.h>
#endif
#include <time.h>
#if defined(_WIN32)
static double seconds()
{
static double clock_frequency;
static bool have_frequency;
LARGE_INTEGER qpc;
QueryPerformanceCounter(&qpc);
if (have_frequency)
return qpc.QuadPart * clock_frequency;
have_frequency = true;
QueryPerformanceFrequency(&qpc);
clock_frequency = 1.0 / (double) qpc.QuadPart;
return seconds();
}
#else
static double seconds()
{ … }
#endif
#define TIME(function, time) …
#endif