Does anyone know how to check the CPU usage of a website in IIS or by any other means? Thanks very much.
+3
A:
How to calculate the CPU Usage Programmatically using C# or VB.NET using PerformanceCounter.
static PerformanceCounter cpuUsage;
public static void Main(string[] args)
{
cpuUsage = new PerformanceCounter("Processor", "% Processor Time", "_Total");
Console.WriteLine(cpuUsage.NextValue() + " %");
Thread.Sleep(1000);
Console.WriteLine(cpuUsage.NextValue() + " %");
Console.Read();
}
David Glass
2009-12-17 01:52:55