在 C# 中分析方法以了解运行需要多长时间 [英] Profiling a method in C# to know how long does it take to run

查看:21
本文介绍了在 C# 中分析方法以了解运行需要多长时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取时间报告以了解在类中运行 C# 方法需要多长时间.我考虑使用 profiler 来做到这一点.

I need to get a timing report to know how long does it take to run a C# method in a class. I think about using profiler to do that.

输入是类中方法的名称,输出是

The input is the name of a method in a class, the output is

  1. 什么方法/类调用这个方法.
  2. 运行方法的时间量.

Visual Studio 2010 和 Mono 有哪些工具/商业产品可用?

What tools/commercial products are available for that for Visual Studio 2010 and Mono?

推荐答案

另一个开源分析器是 slimtune http://code.google.com/p/slimtune/

Another opensource profiler is slimtune http://code.google.com/p/slimtune/

或者,您可以使用 COM 和 ICorProfilerCallback 接口创建自己的分析器,但如果您想要一个非常定制的分析器集合,我会这样做.

Alternatively you can create your own profiler using COM and the ICorProfilerCallback interfaces, but I would do this if you wanted a very customized profiler gathering.

这篇关于在 C# 中分析方法以了解运行需要多长时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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