什么是在Windows基准程序的最佳方法是什么?是在、基准、程序、方法

2023-09-02 10:44:59 作者:倒影年华

我需要做一些性能基准测试在Windows .NET程序(C#),但是我没有这样做在Windows世界基准多少。我已经研究过使用Windows 2000 / XP性能监视器的自定义计数器,但我不认为这是完全是我想要的。

I need to do some performance benchmarks on .NET programs (C#) in Windows, but I haven't done benchmarking much in the Windows world. I've looked into using the Windows 2000/XP Performance monitor with custom counters for this, but I don't think this is quite what I want.

有没有良好的制度设施,这在Windows XP中,或者我需要只使用System.Diagnostics.Stopwatch 和写入文本日志进行手工除pretation,还是有别的原因呢?

Are there any good system facilities for this in Windows XP, or do I need to just use System.Diagnostics.Stopwatch [edit] and write text logs for manual interpretation, or is there something else?

编辑:有什么超越 System.Diagnostics.Stopwatch

推荐答案

有关微基准我真的很喜欢MeasureIt的(可以从的 http://msdn.microsoft.com/en-us/magazine/cc500596.aspx )。这是写的万斯·莫里森的性能架构师在CLR一个测试项目。它目前拥有一套好的基准为一定数量的净/ CLR核心方法。它的最好的部分是,它是微不足道的调整和增加新的标准,你会为任何想进行测试。只需运行MeasureIt的/编辑,它会启动VS与项目本身,以便您可以查看如何将这些标准被写入并添加新的类似的方式,如果你喜欢。

For micro-benchmarking I really like MeasureIt (can be downloaded from http://msdn.microsoft.com/en-us/magazine/cc500596.aspx). It is a test project written by Vance Morrison a Performance Architect on the CLR. It currently has a good set of benchmarks for a number of .Net/CLR core methods. The best part of it is that it is trivial to tweak and add new benchmarks for whatever you would like to test. Simply run "MeasureIt /edit" and it will launch VS with the project for itself so that you can view how those benchmarks are written and add new ones in a similar fashion if you like.

正如已经写得很清楚了秒表可能做到这一点最简单的方法,并MeasureIt的使用秒表下其时序,但它也做一些其他的事情一样运行code X倍块,然后为您提供统计信息的运行而什么不是。

As already been stated StopWatch is probably the easiest way to do this and MeasureIt uses StopWatch underneath for its timings but it also does some other things like running a block of code X times and then providing you stats for the runs and what not.