hgext3rd: fix build on aarch64

Summary: On aarch64, use `rdtsc` equivalent.

Test Plan: built on aarch64

Reviewers: durham, rmcelroy, tracelog, phillco, quark

Reviewed By: tracelog, quark

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D6368688

Tags: aarch64

Signature: 6368688:1511039472:9b26a569ca1f185d6652ac8fb0c3c5a5d306b0cc
This commit is contained in:
Andrew Gallagher 2017-11-19 19:01:57 -08:00
parent 5b16b0ac57
commit ab16183253

View File

@ -84,9 +84,15 @@ static double rdtscratio; /* set by disable() */
/* fast way to get wall time */
inline static rdtsc_t rdtsc() {
#ifdef __aarch64__
unsigned long long val;
asm volatile("mrs %0, cntvct_el0" : "=r" (val));
return val;
#else
unsigned long lo, hi;
asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
return (rdtsc_t)(lo | (hi << 32));
#endif
}
/* fast, but inaccurate hashing of a Python frame */