rocksdb: Implement timer for mips
PATCH 1/2 rocksdb: Implement timer for mips
Signed-off-by Khem Raj <[email protected]>
--- meta-oe/recipes-dbs/rocksdb/files/mips.patch | 19 +++++++++++++++++++ meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb | 1 + 2 files changed, 20 insertions(+) create mode 100644 meta-oe/recipes-dbs/rocksdb/files/mips.patch
meta-oe/recipes-dbs/rocksdb/files/mips.patch new file +19 -0
@@ -0,0 +1,19 @@ +implement timer implementation for mips platform + +Signed-off-by: Khem Raj <[email protected]> +--- 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
meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb +1 -0
@@ -16,6 +16,7 @@ SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH} \ file://0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch \ file://0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch \ file://ppc64.patch \ + file://mips.patch \ " S = "${WORKDIR}/git"
Signature · 1 line
2.32.0
PATCH 2/2 rocksdb: Implement timer for armv6+
Signed-off-by Khem Raj <[email protected]>
--- meta-oe/recipes-dbs/rocksdb/files/arm.patch | 26 +++++++++++++++++++ meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb | 1 + 2 files changed, 27 insertions(+) create mode 100644 meta-oe/recipes-dbs/rocksdb/files/arm.patch
meta-oe/recipes-dbs/rocksdb/files/arm.patch new file +26 -0
@@ -0,0 +1,26 @@ +implement timer for arm >= v6 + +Signed-off-by: Khem Raj <[email protected]> +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -161,6 +161,20 @@ static inline tokutime_t toku_time_now(v + struct timeval tv; + gettimeofday(&tv, nullptr); + return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; ++#elif (__ARM_ARCH >= 6) ++ uint32_t pmccntr; ++ uint32_t pmuseren; ++ uint32_t pmcntenset; ++ // Read the user mode perf monitor counter access permissions. ++ asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren)); ++ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code. ++ asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset)); ++ if (pmcntenset & 0x80000000ul) { // Is it counting? ++ asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr)); ++ // The counter is set up to count every 64th cycle ++ return (uint64_t)pmccntr * 64; // Should optimize to << 6 ++ } ++ } + #else + #error No timer implementation for this platform + #endif
meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb +1 -0
@@ -17,6 +17,7 @@ SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH} \ file://0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch \ file://ppc64.patch \ file://mips.patch \ + file://arm.patch \ " S = "${WORKDIR}/git"
Signature · 1 line
2.32.0