My Project
timing.h
Go to the documentation of this file.
1/*******************************************************
2 * Copyright (c) 2014, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10#pragma once
11#include <af/defines.h>
12
13#ifdef __cplusplus
14
15#if defined(_WIN32) || defined(_MSC_VER)
16 #include <windows.h>
17#elif defined(__APPLE__) && defined(__MACH__)
18 // http://developer.apple.com/qa/qa2004/qa1398.html
19 #include <mach/mach_time.h>
20#else // Linux
21 #ifndef AF_DOC
22 #include <sys/time.h>
23 #endif
24#endif
25
26namespace af {
27
29 typedef struct timer {
30 #if defined(_WIN32) || defined(_MSC_VER)
32 #elif defined(__APPLE__) && defined(__MACH__)
34 #else // Linux
35 struct timeval val;
36 #endif
37
38 AFAPI static timer start();
39
40 AFAPI static double stop();
41 AFAPI static double stop(timer start);
42
43} timer;
44
45AFAPI double timeit(void(*fn)());
46}
47
48#endif
#define AFAPI
Definition defines.h:31
AFAPI array sum(const array &in, const int dim=-1)
C++ Interface for sum of elements in an array.
Definition algorithm.h:15
AFAPI double timeit(void(*fn)())
Internal timer object.
Definition timing.h:29
struct timeval val
Definition timing.h:35
static AFAPI timer start()
static AFAPI double stop()
static AFAPI double stop(timer start)