Do more. Code less. Free software for GPU computing.
<scroll to top>

timing.h

Go to the documentation of this file.
00001 #pragma once
00002 #include "defines.h"
00003 
00004 #if defined(_WIN32) || defined(_MSC_VER)
00005   #include <windows.h>
00006 #elif defined(__APPLE__) && defined(__MACH__)
00007   // http://developer.apple.com/qa/qa2004/qa1398.html
00008   #include <mach/mach_time.h>
00009 #else // Linux
00010   #ifndef AF_DOC
00011     #include <sys/time.h>
00012   #endif
00013 #endif
00014 
00015 
00016 namespace af {
00017 
00019 typedef struct timer {
00020     #if defined(_WIN32) || defined(_MSC_VER)
00021       LARGE_INTEGER val;
00022     #elif defined(__APPLE__) && defined(__MACH__)
00023       uint64_t val;
00024     #else // Linux
00025       struct timeval val;
00026     #endif
00027 
00029 AFAPI static timer tic();
00030 
00032 AFAPI static double toc();
00033 
00035 AFAPI static double toc(timer start);
00036 
00037 } timer;
00038 
00109 AFAPI double timeit(void(*fn)());
00110 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines