Fix the rdtscp detection bug and add prefix for the macro.

This commit is contained in:
guangli-dai
2022-12-14 17:23:41 -08:00
committed by Qi Wang
parent 8b64be3441
commit 31e01a98f1
3 changed files with 9 additions and 3 deletions

View File

@@ -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_ */

View File

@@ -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);