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 plateform 28 29 int rc; 30 struct timeval tv; 31 32 rc = gettimeofday (&tv, NULL); 33 if (rc == -1) { 34 fprintf(stderr,"tmrc: gettimeofday\n"); 35 return 0.; 36 } 37 double t1 = ((double) tv.tv_sec) + 1.e-6 * ((double) tv.tv_usec); 38 39 #endif 40 41 return t1; 42 } 43 44 45 46 47