title: Display used RAM continuously on control
body: <p>I have a <strong>process</strong></p>
  
  <pre><code>Process p = new Process();
  p.StartInfo = new ProcessStartInfo("java", -jar test.jar);
  </code></pre>
  
  <p>and I need get RAM, CPU of <code>process p</code> is used in <strong>realtime</strong></p>
  
  <p>my code to get RAM is used but not in realtime:</p>
  
  <pre><code>while(true) {
      txtRamIsUsed.Text = BytesToReadableValue(p.PrivateMemorySize64);
  }
  </code></pre>
  
  <pre><code>public string BytesToReadableValue(long number)
  {
      List&lt;string&gt; suffixes = new List&lt;string&gt; { " B", " KB", " MB", " GB", " TB", " PB" };
  
      for (int i = 0; i &lt; suffixes.Count; i++)
      {
          long temp = number / (int)Math.Pow(1024, i + 1);
  
          if (temp == 0)
          {
              return (number / (int)Math.Pow(1024, i)) + suffixes[i];
          }
      }
  
      return number.ToString();
  }
  </code></pre>