Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _GNU_SOURCE
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <stdint.h>
- #include <string.h>
- #include <limits.h>
- #include <x86intrin.h>
- int main(int argc, char *argv[])
- {
- unsigned junk;
- unsigned long long time;
- int i;
- int min = INT_MAX;
- for (i = 0; i < 10000000; i++) {
- time = __rdtscp(&junk);
- syscall(-1L);
- time = __rdtscp(&junk) - time;
- if (time < min)
- min = time;
- }
- printf("ctx cycles: %d\n", min);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement