1 #ifndef UTIL_H_GUARD
2 #define UTIL_H_GUARD
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include "cones.h"
9 #include "scs.h"
10 #include <stdio.h>
11 #include <stdlib.h>
12 
13 /* timing code courtesy of A. Domahidi */
14 #if (defined NOTIMER)
15 typedef void *SCS(timer);
16 #elif (defined _WIN32 || defined _WIN64 || defined _WINDLL)
17 /* Use Windows QueryPerformanceCounter for timing */
18 #include <windows.h>
19 typedef struct SCS(timer) {
20   LARGE_INTEGER tic;
21   LARGE_INTEGER toc;
22   LARGE_INTEGER freq;
23 } SCS(timer);
24 
25 #elif (defined __APPLE__)
26 /* Use MAC OSX mach_time for timing */
27 #include <mach/mach_time.h>
28 typedef struct SCS(timer) {
29   uint64_t tic;
30   uint64_t toc;
31   mach_timebase_info_data_t tinfo;
32 } SCS(timer);
33 
34 #else
35 /* Use POSIX clock_gettime() for timing on other machines */
36 #include <time.h>
37 typedef struct SCS(timer) {
38   struct timespec tic;
39   struct timespec toc;
40 } SCS(timer);
41 
42 #endif
43 
44 /* these all return milli-seconds */
45 void SCS(tic)(SCS(timer) * t);
46 scs_float SCS(tocq)(SCS(timer) * t);
47 void SCS(free_sol)(ScsSolution *sol);
48 void SCS(free_data)(ScsData *d, ScsCone *k, ScsSettings *stgs);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 #endif
54