blob: db2305d296e27fcf6e1e8120f7908c39d855db09 [file] [log] [blame]
Andrew Geissler69721092021-07-23 12:57:00 -04001implement timer implementation for mips platform
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
5+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
6@@ -155,7 +155,12 @@ static inline tokutime_t toku_time_now(v
7 __asm __volatile__("rdcycle %0" : "=r"(result));
8 return result;
9 #endif
10-
11+#elif defined(__mips__)
12+ // mips apparently only allows rdtsc for superusers, so we fall
13+ // back to gettimeofday. It's possible clock_gettime would be better.
14+ struct timeval tv;
15+ gettimeofday(&tv, nullptr);
16+ return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec;
17 #else
18 #error No timer implementation for this platform
19 #endif