如何准确的是System.Diagnostics.Stopwatch? [英] How accurate is System.Diagnostics.Stopwatch?

查看:185
本文介绍了如何准确的是System.Diagnostics.Stopwatch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何准确的是 System.Diagnostics.Stopwatch ?我试图做一些指标不同code路径,我需要它是准确的。我应该使用秒表或者是有其他的解决方案,更准确。

How accurate is System.Diagnostics.Stopwatch? I am trying to do some metrics for different code paths and I need it to be exact. Should I be using stopwatch or is there another solution that is more accurate.

有人告诉我,有时候秒表给了不正确的信息。

I have been told that sometimes stopwatch gives incorrect information.

推荐答案

为什么你没有配置文件侧重于微观基准测试你的code呢?

Why you don't profile your code instead of focusing on micro-benchmarks?

有一些优秀的开源分析器这样的:

There are some good Open Source profilers like:

  • NProf
  • Prof-It for C#
  • NProfiler
  • ProfileSharp

这篇关于如何准确的是System.Diagnostics.Stopwatch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆