typedef char* env_var_t;
#define readenv(p, n) ((p)=getenv(n))
#endif
+
+#if !defined(RPCC_DEFINED) && !defined(OS_WINDOWS)
+#ifdef _POSIX_MONOTONIC_CLOCK
+#if defined(__GNUC_PREREQ) && __GLIBC_PREREQ(2, 17) // don't require -lrt
+#define USE_MONOTONIC
+#elif defined(OS_ANDROID)
+#define USE_MONOTONIC
+#endif
+#endif
+/* use similar scale as x86 rdtsc for timeouts to work correctly */
+static inline unsigned long long rpcc(void){
+#ifdef USE_MONOTONIC
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return (unsigned long long)ts.tv_sec * 1000000000ull + ts.tv_nsec;
+#else
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ return (unsigned long long)tv.tv_sec * 1000000000ull + tv.tv_usec * 1000;
+#endif
+}
+#define RPCC_DEFINED
+#define RPCC64BIT
+#endif // !RPCC_DEFINED
+
+#ifndef RPCC_DEFINED
+#error "rpcc() implementation is missing for your platform"
#endif
+#endif // !ASSEMBLER
#ifdef OS_LINUX
#include "common_linux.h"
return r0;
}
+#define RPCC_DEFINED
#define HALT ldq $0, 0($0)
}
-static inline unsigned long long rpcc(void){
- unsigned long long ret=0;
- double v;
- struct timeval tv;
- gettimeofday(&tv,NULL);
- v=(double) tv.tv_sec + (double) tv.tv_usec * 1e-6;
- ret = (unsigned long long) ( v * 1000.0d );
- return ret;
-}
-
static inline int blas_quickdivide(blasint x, blasint y){
return x / y;
}
}
-static inline unsigned long long rpcc(void){
- unsigned long long ret=0;
- double v;
- struct timeval tv;
- gettimeofday(&tv,NULL);
- v=(double) tv.tv_sec + (double) tv.tv_usec * 1e-6;
- ret = (unsigned long long) ( v * 1000.0d );
- return ret;
-}
-
static inline int blas_quickdivide(blasint x, blasint y){
return x / y;
}
__asm__ __volatile__ ("mov %0=ar.itc" : "=r"(clocks));
return clocks;
}
+#define RPCC_DEFINED
static __inline unsigned long stmxcsr(void){
static __inline unsigned int rpcc(void) {
return __getReg(_IA64_REG_AR_ITC);
}
+#define RPCC_DEFINED
static __inline unsigned int stmxcsr(void) {
return __getReg(_IA64_REG_AR_FPSR);
#endif
return ret;
}
+#define RPCC_DEFINED
#if defined(LOONGSON3A) || defined(LOONGSON3B)
#ifndef NO_AFFINITY
#endif
}
+#define RPCC_DEFINED
#ifdef __64BIT__
#define RPCC64BIT
return clocks;
};
+#define RPCC_DEFINED
#ifdef __64BIT__
#define RPCC64BIT
return ((unsigned long long)a + ((unsigned long long)d << 32));
};
+#define RPCC_DEFINED
static __inline unsigned long getstackaddr(void){
unsigned long addr;
return ((BLASULONG)a + ((BLASULONG)d << 32));
}
+#define RPCC_DEFINED
#define RPCC64BIT