3

サーバーコードにたくさんのHTTPHandlerがあります。
LiveでWebサーバーのパフォーマンスを監視するにはどうすればよいですか?
次の統計が必要です:
1。(各ハンドラーまたはサマリーの)1秒あたりの要求数2.CPU
使用率

前もって感謝します

4

1 に答える 1

6

これらのリンクとこれらのコード行を試してみてください。これは確かに役立ちます。

http://www.codeproject.com/KB/dotnet/perfcounter.aspx http://www.aspheute.com/english/20000809.asp http://www.csharphelp.com/2006/05/performance-monitoring/

System.DiagnosticsのPerformanceCounterクラスを使用できます。

PerformanceCounter cpuCounter;
PerformanceCounter ramCounter;

cpuCounter = new PerformanceCounter();

cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";

ramCounter = new PerformanceCounter("Memory", "Available MBytes");


public string getCurrentCpuUsage(){
            cpuCounter.NextValue()+"%";
}

public string getAvailableRAM(){
            ramCounter.NextValue()+"MB";
}

これらすべてがあなたの問題を解決します。

于 2010-09-21T06:17:34.227 に答える