This commit is contained in:
Martin Reinecke 2018-10-26 16:06:30 +02:00
parent 18c82762c3
commit 1c5c9eb579
3 changed files with 18 additions and 5 deletions

View file

@ -25,7 +25,7 @@
/*
* Functionality for reading wall clock time
*
* Copyright (C) 2010, 2011 Max-Planck-Society
* Copyright (C) 2010-2016 Max-Planck-Society
* Author: Martin Reinecke
*/
@ -33,6 +33,8 @@
#include <omp.h>
#elif defined (USE_MPI)
#include "mpi.h"
#elif defined (_WIN32)
#include <Windows.h>
#else
#include <sys/time.h>
#include <stdlib.h>
@ -46,6 +48,17 @@ double wallTime(void)
return omp_get_wtime();
#elif defined (USE_MPI)
return MPI_Wtime();
#elif defined (_WIN32)
static double inv_freq = -1.;
if (inv_freq<0)
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
inv_freq = 1. / double(freq.QuadPart);
}
LARGE_INTEGER count;
QueryPerformanceCounter(&count);
return count.QuadPart*inv_freq;
#else
struct timeval t;
gettimeofday(&t, NULL);