A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

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
26 namespace af {
27
29 typedef struct timer {
30 #if defined(_WIN32) || defined(_MSC_VER)
31 LARGE_INTEGER val;
32 #elif defined(__APPLE__) && defined(__MACH__)
33 uint64_t val;
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
45 AFAPI double timeit(void(*fn)());
46}
47
48#endif
defines.h
AFAPI
#define AFAPI
Definition defines.h:38
af
Definition algorithm.h:15
af::timeit
AFAPI double timeit(void(*fn)())
af::timer
struct af::timer timer
Internal timer object.
af::timer
Internal timer object.
Definition timing.h:29
af::timer::val
struct timeval val
Definition timing.h:35
af::timer::start
static AFAPI timer start()
af::timer::stop
static AFAPI double stop()
af::timer::stop
static AFAPI double stop(timer start)