问题
Does boost chrono provides time stamp with nanoseconds resolution?? If yes how to get the time stamp?
回答1:
Nanoseconds resolution ? On which hardware do you want to run your program ? On my PC, my performance counter has a frequency of approx. 4 Mhz, so a tick last 250 ns.
As answered here, boost chrono can give you the nanosecond resolution, but you will not be sure of the measure's accuracy.
回答2:
In order to easily get time stamps with boost chrono for different measurements you can use boost CPU Timers. A table about the timer accuracy is also given on this site.
To measure the resolution yourself on your specific hardware use boost's cpu_timer_info.cpp.
来源:https://stackoverflow.com/questions/12956956/get-time-stamp-via-boost-chrono-in-resolution-of-nanoseconds