Multicore and thread aware .Net stopwatch?

。_饼干妹妹 提交于 2019-11-29 09:18:16

I have searched for an answer to this specific problem myself and the best that I have seen is DateTime.UtcNow. It would seem that there is no Windows exposed high resolution and reliable counter (I have googled for one for ages and still haven't come across any).

Actually, according to the official documentation, post-Windows XP, it should be just fine to use StopWatch / QueryPerformanceCounter on multiprocessor systems. If the system does not support invariant TSC, QPC will automatically use a different timer strategy.

Do note the comment section, though, for virtualized systems. It seems that you have to be careful in that specific case.

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