mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-14 02:57:47 +01:00
Get cycle count from ARM64 PMCCNTR_EL0 register
This commit is contained in:
parent
329824cafe
commit
e9f86fee61
@ -244,11 +244,12 @@ uint64_t zmq::clock_t::rdtsc ()
|
|||||||
#elif defined(_MSC_VER) && defined(_M_ARM) // NC => added for windows ARM
|
#elif defined(_MSC_VER) && defined(_M_ARM) // NC => added for windows ARM
|
||||||
return __rdpmccntr64 ();
|
return __rdpmccntr64 ();
|
||||||
#elif defined(_MSC_VER) && defined(_M_ARM64) // NC => added for windows ARM64
|
#elif defined(_MSC_VER) && defined(_M_ARM64) // NC => added for windows ARM64
|
||||||
//return __rdpmccntr64 ();
|
const int64_t pmccntr_el0 = (((3 & 1) << 14) | // op0
|
||||||
//return __rdtscp (nullptr);
|
((3 & 7) << 11) | // op1
|
||||||
// todo: find proper implementation for ARM64
|
((9 & 15) << 7) | // crn
|
||||||
static uint64_t snCounter = 0;
|
((13 & 15) << 3) | // crm
|
||||||
return ++snCounter;
|
((0 & 7) << 0)); // op2
|
||||||
|
return _ReadStatusReg(pmccntr_el0);
|
||||||
#elif (defined __GNUC__ && (defined __i386__ || defined __x86_64__))
|
#elif (defined __GNUC__ && (defined __i386__ || defined __x86_64__))
|
||||||
uint32_t low, high;
|
uint32_t low, high;
|
||||||
__asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
|
__asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
|
||||||
|
Loading…
Reference in New Issue
Block a user