简体   繁体   English

在C#中测量任务之间的延迟

[英]Measuring latency between tasks in C#

I am aware of an currently using the System.Diagnostics.Stopwatch class, but since I am measuring latency, I would like to know if the stopwatch is really the correct tool for the job. 我知道当前正在使用System.Diagnostics.Stopwatch类,但是由于我正在测量延迟,因此我想知道秒表是否真的是完成任务的正确工具。

Is it accurate enough? 它足够准确吗? How reliable are the results? 结果有多可靠?

From Msdn Msdn

"Provides a set of methods and properties that you can use to accurately measure elapsed time." “提供了一组方法和属性,可用于准确测量经过的时间。”

From what I've read - it is the recommended way, and exactly the thing it's been created for (in terms of accuracy) 根据我所读的内容-这是推荐的方法,它也是为它创建的东西(就准确性而言)

It's recommended to use it, instead of DateTime.Now - someValueInThePast, or other approaches with timers or similar 建议使用它,而不是DateTime.Now-someValueInThePast或其他带有计时器或类似方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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