1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#ifndef TIMINGS_H
#define TIMINGS_H
#include <stdio.h>
#include "ompi_config.h"
#ifndef _WIN32
#include <sys/time.h>
#else
#include <sys/timeb.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#define MAX_CLOCK 1000
#ifndef _WIN32
typedef struct timeval CLOCK_T;
#define CLOCK(c) gettimeofday(&c,(struct timezone *)NULL)
#define CLOCK_DIFF(c1,c2) \
((double)(c1.tv_sec-c2.tv_sec)+(double)(c1.tv_usec-c2.tv_usec)/1e+6)
#define CLOCK_DISPLAY(c) fprintf(stderr,"%d.%d",(int)c.tv_sec,(int)c.tv_usec)
#else /* for windows */
#ifdef __CYGWIN__
typedef struct timeb CLOCK_T;
#else
typedef struct _timeb CLOCK_T;
#endif
#define CLOCK(c) _ftime(&c)
#define CLOCK_DIFF(c1,c2) \
((double)(c1.time-c2.time)+(double)(c1.millitm-c2.millitm)/1e+3)
#define CLOCK_DISPLAY(c) fprintf(stderr,"%d.%d",(int)c.time,(int)c.millitm*1e+3)
#endif
OMPI_HIDDEN double tm_time_diff(void);
OMPI_HIDDEN void tm_get_time(void);
#define TIC tm_get_time()
#define TOC tm_time_diff()
#endif /*TIMINGS_H*/
|