Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- svetoslave@vm-ubuntu-svetoslave:~/scratch$ cat linear.c
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char *argv[]) {
- long long x = strtoll(argv[1], NULL, 0);
- printf("Iterating %lld times\n", x);
- for (long long i = 0; i < x; i++) {
- asm volatile("nop");
- }
- printf("Done\n");
- return 0;
- }
- svetoslave@vm-ubuntu-svetoslave:~/scratch$ time ./linear 10000
- Iterating 10000 times
- Done
- real 0m0,001s
- user 0m0,001s
- sys 0m0,000s
- svetoslave@vm-ubuntu-svetoslave:~/scratch$ time ./linear 100000
- Iterating 100000 times
- Done
- real 0m0,001s
- user 0m0,001s
- sys 0m0,000s
- svetoslave@vm-ubuntu-svetoslave:~/scratch$ time ./linear 1000000
- Iterating 1000000 times
- Done
- real 0m0,003s
- user 0m0,002s
- sys 0m0,000s
- svetoslave@vm-ubuntu-svetoslave:~/scratch$ time ./linear 10000000
- Iterating 10000000 times
- Done
- real 0m0,020s
- user 0m0,020s
- sys 0m0,000s
- svetoslave@vm-ubuntu-svetoslave:~/scratch$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement