timing.h (2014-04-30 15:38:09 -0400, (build fd32605))
Go to the documentation of this file.
1 #pragma once
2 #include "defines.h"
3 
4 #if defined(_WIN32) || defined(_MSC_VER)
5  #include <windows.h>
6 #elif defined(__APPLE__) && defined(__MACH__)
7  // http://developer.apple.com/qa/qa2004/qa1398.html
8  #include <mach/mach_time.h>
9 #else // Linux
10  #ifndef AF_DOC
11  #include <sys/time.h>
12  #endif
13 #endif
14 
15 
16 namespace af {
58  typedef struct timer {
60  #if defined(_WIN32) || defined(_MSC_VER)
61  LARGE_INTEGER val;
62  #elif defined(__APPLE__) && defined(__MACH__)
63  uint64_t val;
64  #else // Linux
65  struct timeval val;
66  #endif
67 
72  AFAPI static timer start();
82  AFAPI static double stop();
83  AFAPI static double stop(timer start);
88 } timer;
89 
90 
95 AFAPI double timeit(void(*fn)());
99 }
static timer start()
static double stop()
#define AFAPI
Definition: defines.h:45
struct timeval val
Definition: timing.h:65
Definition: timing.h:59
double timeit(void(*fn)())
struct af::timer timer