doc: Add serial to list of ci file reserved words
[charm.git] / src / ck-ldb / tm_timings.h
1 #ifndef TIMINGS_H
2 #define TIMINGS_H
3 #include <stdio.h>
4
5 #ifndef _WIN32
6 #include <sys/time.h>
7 #else
8 #include <sys/timeb.h>
9 #endif
10 #include <stdlib.h>
11 #include <unistd.h>
12
13 #define MAX_CLOCK 100
14
15 #ifndef _WIN32
16 typedef struct timeval CLOCK_T;
17
18
19 #define CLOCK(c) gettimeofday(&c,(struct timezone *)NULL)
20 #define CLOCK_DIFF(c1,c2)  \
21 ((double)(c1.tv_sec-c2.tv_sec)+(double)(c1.tv_usec-c2.tv_usec)/1e+6)
22 #define CLOCK_DISPLAY(c) fprintf(stderr,"%d.%d",(int)c.tv_sec,(int)c.tv_usec)
23
24 #else    /* for windows */
25
26 #ifdef __CYGWIN__
27 typedef struct timeb CLOCK_T;
28 #else
29 typedef struct _timeb CLOCK_T;
30 #endif
31
32 #define CLOCK(c) _ftime(&c)
33 #define CLOCK_DIFF(c1,c2)  \
34 ((double)(c1.time-c2.time)+(double)(c1.millitm-c2.millitm)/1e+3)
35 #define CLOCK_DISPLAY(c) fprintf(stderr,"%d.%d",(int)c.time,(int)c.millitm*1e+3)
36
37 #endif
38
39 double time_diff();
40 void get_time();
41
42 #define TIC get_time()
43 #define TOC time_diff()
44
45 #endif /*TIMINGS_H*/
46