title: get current CPU utilization in C#
body: <p>I want to have current CPU utilization in my project</p>
  
  <pre><code>namespace Monitoring_Tool
  {
      public partial class ajaxExecute : System.Web.UI.Page
      {
          private PerformanceCounter theCPUCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
          private PerformanceCounter theMemCounter = new PerformanceCounter("Memory", "Available MBytes");
  
          protected void Page_Load(object sender, EventArgs e)
          {
              float cpuUsage = 0.00F;
  
              cpuUsage = this.theCPUCounter.NextValue();
          }
      }
  }
  </code></pre>
  
  <p>When I debug my project, the value in <code>cpuUsage</code> is showing <code>0.00</code> but when I do <code>QuickWatch</code> on <code>this.theCPUCounter.NextValue();</code> it is showing <code>20.6786852</code>.</p>
  
  <p><strong>Why can't I store it in a variable?</strong></p>