summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguangli-dai <gdai@fb.com>2022-12-14 17:23:41 -0800
committerQi Wang <interwq@gmail.com>2023-03-23 11:16:19 -0700
commit31e01a98f159926493158cde6453cde55f21c42b (patch)
tree769ab1bdf31aae14d1009d74ecc4a79ba023c331
parent8b64be34414e92fcbcdbaf5b81db6d26289667b5 (diff)
downloadjemalloc-31e01a98f159926493158cde6453cde55f21c42b.tar.gz
Fix the rdtscp detection bug and add prefix for the macro.
-rw-r--r--configure.ac4
-rw-r--r--include/jemalloc/internal/jemalloc_internal_defs.h.in6
-rw-r--r--include/jemalloc/internal/jemalloc_internal_inlines_a.h2
3 files changed, 9 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index f38b72d6..ec7a97cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -522,10 +522,10 @@ typedef unsigned __int32 uint32_t;
return 0;
]])],
[je_cv_rdtscp=yes],
- [je_cv_rdstcp=no],
+ [je_cv_rdtscp=no],
[je_cv_rdtscp=no]))
if test "x${je_cv_rdtscp}" = "xyes"; then
- AC_DEFINE([HAVE_RDTSCP], 1, [])
+ AC_DEFINE([JEMALLOC_HAVE_RDTSCP], [ ], [ ])
fi
fi
;;
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
index 41e40ccf..87845a48 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -443,4 +443,10 @@
/* If defined, use volatile asm during benchmarks. */
#undef JEMALLOC_HAVE_ASM_VOLATILE
+/*
+ * If defined, support the use of rdtscp to get the time stamp counter
+ * and the processor ID.
+ */
+#undef JEMALLOC_HAVE_RDTSCP
+
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
diff --git a/include/jemalloc/internal/jemalloc_internal_inlines_a.h b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
index 7686a9b7..cb6d78fa 100644
--- a/include/jemalloc/internal/jemalloc_internal_inlines_a.h
+++ b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
@@ -14,7 +14,7 @@ malloc_getcpu(void) {
return GetCurrentProcessorNumber();
#elif defined(JEMALLOC_HAVE_SCHED_GETCPU)
return (malloc_cpuid_t)sched_getcpu();
-#elif defined(HAVE_RDTSCP)
+#elif defined(JEMALLOC_HAVE_RDTSCP)
unsigned int ax, cx, dx;
asm volatile("rdtscp" : "=a"(ax), "=d"(dx), "=c"(cx) ::);
return (malloc_cpuid_t)(dx & 0xfff);