Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <iostream>
- #include <chrono>
- #define TIMER_START { \
- using namespace std::chrono; \
- auto t0 = high_resolution_clock::now();
- #define TIMER_END(percision) \
- auto t1 = high_resolution_clock::now(); \
- std::cout << duration_cast<percision>(t1 - t0).count() << " "#percision"\n"; \
- }
- int main(){
- TIMER_START
- int sum = 0;
- for(int i=0; i<100000000; i++)
- sum += i;
- TIMER_END(milliseconds)
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement