aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-dbs/rocksdb/files/mips.patch
blob: db2305d296e27fcf6e1e8120f7908c39d855db09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
implement timer implementation for mips platform

Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -155,7 +155,12 @@ static inline tokutime_t toku_time_now(v
   __asm __volatile__("rdcycle %0" : "=r"(result));
   return result;
 #endif
-
+#elif defined(__mips__)
+  // mips apparently only allows rdtsc for superusers, so we fall
+  // back to gettimeofday.  It's possible clock_gettime would be better.
+  struct timeval tv;
+  gettimeofday(&tv, nullptr);
+  return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec;
 #else
 #error No timer implementation for this platform
 #endif