Multicore and thread aware .Net stopwatch?

后端 未结 2 355
清歌不尽
清歌不尽 2020-12-18 21:18

As we all know the stopwatch might have issues in a multi-threaded async application that will be running on all cores.

On a multipro

2条回答
  •  清酒与你
    2020-12-18 21:46

    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.

提交回复
热议问题