Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<chrono>
- class Timer {
- using clock_t = std::chrono::high_resolution_clock;
- using microseconds = std::chrono::microseconds;
- public:
- Timer() : start_t(clock_t::now()) {}
- ~Timer() {
- const auto finish = clock_t::now();
- const auto us = std::chrono::duration_cast<microseconds> (finish - start_t).count();
- std::cout << us << " us" << std::endl;
- }
- private:
- const clock_t::time_point start_t;
- };
- int main () {
- for (int i = 0; i < 1000000; ++i)
- std::cout << i << std::endl;
- Timer t;
- int b = 0;
- b = 2 + 2;
- std::cout << b;
- std::cout << "Ver.1";
- }
Advertisement
Add Comment
Please, Sign In to add comment