Advertisement
KennasSticky

C++_SolutionTime

Jan 23rd, 2022 (edited)
671
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <chrono>
  2.  
  3. using namespace std;
  4. using namespace std::chrono;
  5.  
  6. int main()
  7. {
  8.     // Get starting timepoint
  9.     auto start = high_resolution_clock::now();
  10.  
  11.     // PROGRAM PROCESSES FOUND HERE
  12.  
  13.     // Get ending timepoint
  14.     auto stop = high_resolution_clock::now();
  15.  
  16.     // Get duration. Substart timepoints to
  17.     // get durarion. To cast it to proper unit
  18.     // use duration cast method
  19.     auto duration = duration_cast<microseconds>(stop - start);
  20.  
  21.     cout << "Time taken by function: "
  22.          << duration.count() << " microseconds" << endl;
  23.  
  24.     return 0;
  25. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement