简体   繁体   中英

Get time stamp via Boost.Chrono in resolution of nanoseconds

Does boost chrono provides time stamp with nanoseconds resolution?? If yes how to get the time stamp?

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM