Quantcast
Channel: Measuring the runtime of a C++ code? - Stack Overflow
Viewing all articles
Browse latest Browse all 8

Answer by Nathan for Measuring the runtime of a C++ code?

$
0
0

If you wish to print the measured time with printf(), you can use this:

auto start = std::chrono::system_clock::now();/* measured work */auto end = std::chrono::system_clock::now();auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);printf("Time = %lld ms\n", static_cast<long long int>(elapsed.count()));

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>