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

* cpu cycle ffi

* Rename

* mixnode feature

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

23 lines
394 B
C

// version 20230105
// public domain
// djb
#include "cpucycles_internal.h"
#ifndef __i386__
#error this code is only for 32-bit x86 platforms
#endif
long long ticks(void)
{
long long result;
asm volatile(".byte 15;.byte 49" : "=A" (result));
return result;
}
long long ticks_setup(void)
{
if (!cpucycles_works(ticks)) return cpucycles_SKIP;
return cpucycles_MAYBECYCLECOUNTER;
}