CpuTotalPc.cs

Cpu Load

using System.Diagnostics;
public static class CpuTotalPc
{
    private static PerformanceCounter _CPUsage;
    public static double CPULoad
    {
        get
        {
            if (_CPUsage == null)
                try
                {
                    _CPUsage = new PerformanceCounter("Processor", "% Processor Time", "_Total");
                }
                catch
                {
                    return 0;
                }
            return _CPUsage.NextValue();
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *