profiling - What is the default unit of time of c++'s chrono? -


i used code measure runtime of program this answer

auto start = std::chrono::system_clock::now();  /* work */  auto end = std::chrono::system_clock::now(); auto elapsed = end - start; std::cout << elapsed.count() << '\n'; 

i needed measure runtime trend kind of curious unit is.

you can check self, code:

using clock = std::chrono::system_clock; using duration = clock::duration; std::cout << duration::period::num << " , " << duration::period::den << '\n'; 

on system prints:

 1 , 1000000000 

that is, period in terms of nanoseconds (i.e. 10−9s).


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -