Skip to content

Commit bbd3111

Browse files
jwangdybjori
authored andcommitted
CDRIVER-1946 SEGFAULT with fast performance counters on NUMA
1 parent d42650d commit bbd3111

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/mongoc/mongoc-counters-private.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,12 @@ _mongoc_get_cpu_count (void)
8989
static BSON_INLINE unsigned
9090
_mongoc_sched_getcpu (void)
9191
{
92-
volatile uint32_t rax, rdx, aux;
93-
__asm__ volatile ("rdtscp\n" : "=a" (rax), "=d" (rdx), "=c" (aux) : : );
94-
return aux;
92+
volatile uint32_t rax, rdx, rcx;
93+
__asm__ volatile ("rdtscp\n" : "=a" (rax), "=d" (rdx), "=c" (rcx) : : );
94+
unsigned node_id, core_id;
95+
// node_id = (rcx & 0xFFF000)>>12; // node_id is unused
96+
core_id = rcx & 0xFFF;
97+
return core_id;
9598
}
9699
#elif defined(HAVE_SCHED_GETCPU)
97100
# define _mongoc_sched_getcpu sched_getcpu

0 commit comments

Comments
 (0)