Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <iostream>
  3. #include <chrono>
  4.  
  5. #define TIMER_START { \
  6. using namespace std::chrono; \
  7. auto t0 = high_resolution_clock::now();
  8. #define TIMER_END(percision) \
  9. auto t1 = high_resolution_clock::now(); \
  10. std::cout << duration_cast<percision>(t1 - t0).count() << " "#percision"\n"; \
  11. }
  12.  
  13. int main(){
  14. TIMER_START
  15. int sum = 0;
  16. for(int i=0; i<100000000; i++)
  17. sum += i;
  18. TIMER_END(milliseconds)
  19.  
  20. system("pause");
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement