8

ASP.NET MVC アプリケーションでのリクエストのヒット時間、処理時間、メモリ消費、および応答時間をキャプチャしたいと考えています。

これを実行する方法やツールはありますか?

4

3 に答える 3

11

stackoverflow チームによって開発されたminiprofilerを確認してください

http://code.google.com/p/mvc-mini-profiler/

これは、いくつかの分析を行うのに役立ちます。これをプロジェクトに追加するために使用できる nuget パッケージが利用可能です。

Scott は、それを使用する方法についての投稿を書いています。

Glimpseを調べることもできます

telerik just traceのように、メモリとパフォーマンスのプロファイリングを行う市販の製品があります。試用版をダウンロードして使用できます

于 2012-10-19T19:40:44.337 に答える
6

独自の小さなパフォーマンス テスト モニターを作成できます。これは、Steven Sanderson の本 Pro Asp.Net MVC 2 Framework の 670 ページからのものです。

public class PerformanceMonitorModule : IHttpModule
{
    public void Dispose() { /* Nothing to do */ }
    public void Init(HttpApplication context)
    {
        context.PreRequestHandlerExecute += delegate(object sender, EventArgs e)
        {
            HttpContext requestContext = ((HttpApplication)sender).Context;
            Stopwatch timer = new Stopwatch();
            requestContext.Items["Timer"] = timer;
            timer.Start();
        };
        context.PostRequestHandlerExecute += delegate(object sender, EventArgs e)
        {
            HttpContext requestContext = ((HttpApplication)sender).Context;
            Stopwatch timer = (Stopwatch)requestContext.Items["Timer"];
            timer.Stop();

            if (requestContext.Response.ContentType == "text/html")
            {
                double seconds = (double)timer.ElapsedTicks / Stopwatch.Frequency;
                string result =
                string.Format("{0:F4} sec ({1:F0} req/sec)", seconds, 1 / seconds);
                requestContext.Response.Write("<hr/>Time taken: " + result);
            }
        };
    }
}

次に、web.config に追加します。

<add name="PerfModule" type="Namespace.PerformanceMonitorModule, AssemblyName"/>
于 2012-10-19T22:26:51.077 に答える
2

無料ではありませんが、とても良いです:

http://www.jetbrains.com/profiler/

dotTrace は、.NET アプリケーション用のパフォーマンスおよびメモリ プロファイラーのファミリです。

最新リリースの dotTrace 5.2 Performance は、.NET 開発者がパフォーマンスのボトルネックをすばやく見つけてアプリケーションを最適化するのに役立ちます。

于 2012-10-19T19:46:08.797 に答える