time function c++
/* Answer to: "time function c++" */
#include <chrono>
using namespace std::chrono;
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout << duration.count() << endl;
3.57
7
#include <chrono>
using namespace std::chrono;
auto start = high_resolution_clock::now();
// perform function to be timed here...
auto stop = high_resolution_clock::now();
cout << duration_cast<microseconds>(stop - start).count() << endl;
Thank you!
7
0
Are there any code examples left?
New code examples in category C++