Guest User

Untitled

a guest
Dec 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <time.h>
  4. #include <unistd.h>
  5.  
  6. volatile uint64_t a,b;
  7.  
  8. int main()
  9. {
  10. int i;
  11. clock_t start,end,ended;
  12. for (i=0;i<10000000;i++){
  13. a = b * a * i;
  14. }
  15. start = clock();
  16. for (i=0;i<10000000;i++){
  17. a = b * a * i;
  18. }
  19. end = clock();
  20. sleep(1);
  21. ended = clock();
  22. printf("start %ld end %ld diff %ld\n", start, end, end-start);
  23. printf("end %ld ended %ld diff %ld\n", end, ended, ended-end);
  24. }
Add Comment
Please, Sign In to add comment