测量代码的执行时间 [英] Measuring the Execution Time of Code

查看:98
本文介绍了测量代码的执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我一直在寻找一种不错的方法来衡量执行我的代码所花费的时间.我已经看到不同站点上的某些人会使用Stopwatch类以编程方式执行此操作以测量执行代码所需的时间,但是我想知道是否有更好的方法来测量所花费的时间.

有插件或工具之类的建议吗?

Heya all,
I''ve been looking around for a decent way to measure the time it takes to execute my code. I have seen some people on various sites will do this programmatically using the Stopwatch class to measure the time it takes to execute the code within, but I was wondering if there is a better method of measuring the time taken.

Any suggestions like plug-ins or tools?

Cheers guys.

推荐答案

Visual Studio的更高版本具有^ ].树视图不只是寻找时间,还可以帮助您深入了解并了解如何调用方法,并且可以对该数据进行很多分析.

我还使用过蚂蚁分析器. [ clr分析器 [
The higher versions of Visual studio has a profiler[^]. It is more than just finding time, the tree view helps you dig deep and find out how your methods are called and you can do a lot of anylysis with that data.

I have also used ants profiler.[^] and that also provides a lot of feautures.

You also have the clr profiler[^] (its free). It takes up a lot of memory and hard disk space, but it gives you a lot of information. It shows you how many objects are created, how much memory it used and a lot more useful information.


这篇关于测量代码的执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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