Advertisement
KennasSticky

C++_SolutionTime

Jan 23rd, 2022 (edited)
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement