5
/* from http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IA32LinuxCluster/Doc/timing.html */
7
unsigned long long int nanotime_ia32(void)
9
unsigned long long int val;
10
__asm__ __volatile__("rdtsc" : "=A" (val) : );
14
#define SPARSE 3192963000. /* persimmon */
15
/* #define SPARSE 1994171000. */ /* Dell Latitude C840 ("sparse") */
16
/* #define SPARSE 1395738000. */ /* IBM Thinkpad */
21
static unsigned start=0;
24
double dsecnd_ (void) /* Include an '_' if you will be calling from Fortan */
26
return (((double) nanotime_ia32 ( )) / SPARSE) ;
34
/* CPU Clock Freq. in Hz from routine in /usr/lib/librt.a */
35
/* CPS=__get_clockfreq(); */
36
/* CPU Clock Freq. in Hz taken from /proc/cpuinfo */
41
/* Uncomment one of the following */
42
foo=iCPS*nanotime_ia32(); /* If running on IA32 machine */
43
/* foo=iCPS*nanotime_ia64(); */ /* If running on IA64 machine */
51
/* generic ANSI C version */
55
double x = clock ( ) ;
56
return (x / CLOCKS_PER_SEC) ;