1 #include <FCMangle.h> 2 #define TMRC FortranCInterface_GLOBAL_(tmrc, TMRC) 3 4 #include <stdio.h> 5 #include <sys/types.h> 6 #include <time.h> 7 8 #include <sys/time.h> 9 #include <sys/resource.h> 10 #include <unistd.h> 11 12 #ifdef __bgq__ 13 #include "hwi/include/bqc/A2_inlines.h" 14 #endif 15 16 double TMRC (void) 17 { 18 19 #ifdef __bgq__ 20 21 /* use the GetTimeBase function available on BGQ */ 22 uint64_t TB = GetTimeBase(); 23 double t1 = 6.25e-10*TB; /* = 1/1.6e9 */ 24 25 #else 26 27 /* use the gettimeofday function available on any Linux platform */ 28 29 int rc; 30 struct timeval tv; 31 double t1 = 0; 32 33 rc = gettimeofday (&tv, NULL); 34 if (rc == -1) { 35 fprintf(stderr,"tmrc: gettimeofday\n"); 36 return 0.; 37 } 38 t1 = ((double) tv.tv_sec) + 1.e-6 * ((double) tv.tv_usec); 39 40 #endif 41 42 return t1; 43 } 44 45 46 47 48