title: Getting process CPU usage using Sigar library
body: <p>I've been trying to get a process CPU usage by using <a href="https://support.hyperic.com/display/SIGAR/Home" rel="nofollow noreferrer">Sigar library</a> but I always get values of 0 even when it should be higher.</p>
  
  <p>I'm doing this on a timer every second:</p>
  
  <pre><code>Sigar sigar = new Sigar();
  long pid = find.find("Exe.Name.ct=myprocess.exe");
  
  ProcCpu cpu = sigar.getProcCpu(pid);
  System.out.println(cpu.getPercent());
  </code></pre>
  
  <p>I've been taking a look at <a href="https://stackoverflow.com/questions/19323364/using-sigar-api-to-get-jvm-cpu-usage/19328057?noredirect=1#comment34062053_19328057">this other related question and its accepted answer</a> but it doesn't seem to work properly plus things like <code>TOTAL_TIME_UPDATE_LIMIT</code> are kind of a mystery. 
  I also took a look at <a href="https://stackoverflow.com/questions/10999392/how-to-get-cpu-ram-and-network-usage-of-a-java7-app">this another one</a> but it didn't provide to me anything new.</p>
  
  <p>Has anyone tried to monitor the process CPU before with Sigar? 
  What's the way to accomplish it?</p>
  
  <p>Thanks.</p>