Created
February 1, 2014 06:45
-
-
Save tanakamura/8748818 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* i7-4700MQ Win8.1 : 9533.579865clk | |
*/ | |
#include <windows.h> | |
#include <setjmp.h> | |
#define NUM (4096*8) | |
volatile int counter = 0; | |
jmp_buf jbuf; | |
LONG WINAPI handler(struct _EXCEPTION_POINTERS *exc) | |
{ | |
counter++; | |
longjmp(jbuf, 1); | |
} | |
static void | |
bench(void) | |
{ | |
int *p; | |
counter = 0; | |
setjmp(jbuf); | |
if (counter == NUM) { | |
return; | |
} | |
p = 0; | |
*p = 0; | |
} | |
int main() | |
{ | |
PVOID h; | |
int t0, t1; | |
h = AddVectoredExceptionHandler(1, handler); | |
bench(); | |
t0 = __rdtsc(); | |
bench(); | |
t1 = __rdtsc(); | |
printf("%f\n", (t1-t0)/(double)NUM); | |
RemoveVectoredExceptionHandler(h); | |
puts("done"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment