diff options
Diffstat (limited to 'meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch')
-rw-r--r-- | meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch b/meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch new file mode 100644 index 000000000..2979b73d2 --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/files/0005-Implement-timer-implementation-for-mips-platform.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 2ebc0ff33e41d23e4d3aec1a86f3d8bd4be410e7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 21 Mar 2024 14:14:58 +0800 | ||
4 | Subject: [PATCH] Implement timer implementation for mips platform | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | .../lock/range/range_tree/lib/portability/toku_time.h | 6 ++++++ | ||
11 | 1 file changed, 6 insertions(+) | ||
12 | |||
13 | 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 | ||
14 | index 0a7488c397..ad7d9f2124 100644 | ||
15 | --- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h | ||
16 | +++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h | ||
17 | @@ -162,6 +162,12 @@ static inline tokutime_t toku_time_now(void) { | ||
18 | unsigned long result; | ||
19 | asm volatile ("rdtime.d\t%0,$r0" : "=r" (result)); | ||
20 | return result; | ||
21 | +#elif defined(__mips__) | ||
22 | + // mips apparently only allows rdtsc for superusers, so we fall | ||
23 | + // back to gettimeofday. It's possible clock_gettime would be better. | ||
24 | + struct timeval tv; | ||
25 | + gettimeofday(&tv, nullptr); | ||
26 | + return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; | ||
27 | #else | ||
28 | #error No timer implementation for this platform | ||
29 | #endif | ||
30 | -- | ||
31 | 2.25.1 | ||
32 | |||