File: mips.patch

package info (click to toggle)
rocksdb 9.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 46,252 kB
  • sloc: cpp: 503,390; java: 43,039; ansic: 9,834; python: 8,381; perl: 5,822; sh: 4,921; makefile: 2,386; asm: 550; xml: 342
file content (28 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: "Laszlo Boszormenyi (GCS)" <gcs@debian.org>
Date: Sun, 24 Nov 2024 23:29:28 -0800
Subject: mips

implement timer implementation for mips platform

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../transactions/lock/range/range_tree/lib/portability/toku_time.h  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
index ca60a0d..0f1e49d 100644
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -166,6 +166,12 @@ static inline tokutime_t toku_time_now(void) {
   unsigned long result;
   asm volatile("rdtime.d\t%0,$r0" : "=r"(result));
   return result;
+#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