1/* Answer to: "time function c++" */
2
3#include <chrono>
4using namespace std::chrono;
5
6auto start = high_resolution_clock::now();
7auto stop = high_resolution_clock::now();
8auto duration = duration_cast<microseconds>(stop - start);
9
10cout << duration.count() << endl;
1#include <chrono>
2using namespace std::chrono;
3
4auto start = high_resolution_clock::now();
5
6// perform function to be timed here...
7
8auto stop = high_resolution_clock::now();
9cout << duration_cast<microseconds>(stop - start).count() << endl;