Get time stamp via Boost.Chrono in resolution of nanoseconds

£可爱£侵袭症+ 提交于 2019-12-11 15:41:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!