c-cpp-compile-run icon indicating copy to clipboard operation
c-cpp-compile-run copied to clipboard

execution time

Open Asif-102 opened this issue 3 years ago • 1 comments

Please add a feature to show execution time in the terminal.

https://forum.sublimetext.com/uploads/default/original/3X/a/6/a6ad7e44f792d16344c32081b3e93fea9e2322f3.png

Asif-102 avatar Sep 19 '22 21:09 Asif-102

You can do that using chrono library I do it like this:

int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cout << fixed << setprecision(25); cerr << fixed << setprecision(10); auto start = std::chrono::high_resolution_clock::now();

int t = 1;
cin >> t;
while(t--) solve();

auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_caststd::chrono::nanoseconds(stop - start); //cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s "<< endl; } ` Do not forget to include chrono library and using namespace chrono

joshi248 avatar Jun 06 '23 08:06 joshi248