Skip to content

Instantly share code, notes, and snippets.

@febnug
Created December 30, 2019 06:44
Show Gist options
  • Save febnug/8caa271998b00fd171e87abfe64417b3 to your computer and use it in GitHub Desktop.
Save febnug/8caa271998b00fd171e87abfe64417b3 to your computer and use it in GitHub Desktop.
int timings[64*N];
int main(void)
{
int i;
__asm__ __volatile__ (
"lea edx, [timings] \n\t"
"rdtsc \n\t"
".rept 32 \n\t"
"mov eax,[edx] \n\t"
"inc eax \n\t"
"mov dword ptr [edx], eax \n\t"
"add edx, 4 \n\t"
".endr \n\t"
:
: [timings] "m" (*timings)
);
for(i=0; i<32; i++)
printf("%d\n", timings[i]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment