Skip to content

Instantly share code, notes, and snippets.

@kaja47
Created November 4, 2016 23:23
Show Gist options
  • Save kaja47/b2f7ecadd9dabb98ac2b39873c0a62de to your computer and use it in GitHub Desktop.
Save kaja47/b2f7ecadd9dabb98ac2b39873c0a62de to your computer and use it in GitHub Desktop.
#include <immintrin.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
int len = 16;
char* arr = malloc(1024*1024*16);
int stride = 1024*4;
// warm TLB
for (int i = 0; i < len; i++) {
arr[i*stride] = 1;
}
if (_xbegin() == -1) {
for (int i = 0; i < len; i++) {
arr[i*stride] = 1;
}
_xend();
printf("success\n");
} else {
printf("failure\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment