Files
Drazen Urch 7bd1550195 libcpucycles (#3219)
* Checkpoint

* cpu cycle ffi

* Rename

* mixnode feature

* Bundle libcpucycles
2023-03-27 16:34:10 +02:00

21 lines
422 B
C

// version 20230105
// public domain
// djb
// adapted from supercop/cpucycles/amd64tscfreq.c
#include "cpucycles_internal.h"
long long ticks(void)
{
unsigned long long result;
asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax"
: "=a"(result) :: "%rdx");
return result;
}
long long ticks_setup(void)
{
if (!cpucycles_works(ticks)) return cpucycles_SKIP;
return cpucycles_MAYBECYCLECOUNTER;
}