Created
January 20, 2015 11:30
-
-
Save nuta/12d1ece81b32030b264a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
static inline void _main (void){ | |
} | |
typedef unsigned long long u64; | |
static inline u64 cycle (void){ | |
u64 stamp; | |
__asm__ __volatile__("rdtscp; shl $32,%%rdx; or %%rdx,%%rax" : "=a"(stamp)); | |
return stamp; | |
} | |
u64 try (void){ | |
u64 st,end; | |
st = cycle(); | |
_main(); | |
end = cycle(); | |
printf("%llu\n", end-st); | |
return 0; | |
} | |
int main (void){ | |
for(int i=0; i <= 1000; i++) | |
try(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment