问题描述
Stopwatch.GetTimeStamp()
可能返回。
有人知道这些错误在存储什么吗?具体来说?
Does anyone know what these bugs hold in store in concrete terms?
- 不同处理器上的时间戳是否可能完全不相关-或仅相差很小(亚毫秒)最多)?
- 不同处理器上的数字是否会随时间推移而漂移-那么实际上会导致上述完全不相关的时间戳吗? (我认为不同处理器上的不同频率可能会这样做)
推荐答案
that is because it is written in the doc:
因此可以使用性能计数器。
And therefore comes the alea of using the performance counter.
Windows实施至少有两个可能的性能计数器来源:HPET,RDTC,这是由ACPI确定。但是,ACPI主要是问题所在,大多数制造商都实施得很糟糕,因此有时决定完全忽略ACPI建议,而做其他事情。
Windows implementation has at least 2 possible sources for performance counter, the HPET, the RDTC, and this is determined by ACPI. However, ACPI is mostly the problem, most manufacturers are implementing it badly therefore sometimes the decision to ignore completely the ACPI advice and do something else instead.
使用RDTC时,线程如果运气不佳,并且您测量的时间过短,则在另一个CPU上进行迁移将导致稍微负面的结果。但这有可能发生。
When using RDTC, thread migration over another CPU will result in slightly negative results if luck is not with you and that you measure a super small time anyway. But it can happen.
这篇关于多处理器上的Stopwatch.GetTimeStamp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!