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
Post a Comment