title: Using SIGAR API to calculate CPU usage
body: <p>I am using SIAGR API to calculate CPU usage but getting the exception when it is <strong>tested with LOAD RUNNER</strong> other wise it is ok.</p>
  
  <pre><code>org.hyperic.sigar.SigarFileNotFoundException: No such file or directory
      at org.hyperic.sigar.Cpu.gather(Native Method)
      at org.hyperic.sigar.Cpu.fetch(Cpu.java:30)
      at org.hyperic.sigar.Sigar.getCpu(Sigar.java:320)
      at org.hyperic.sigar.Sigar.getCpuPerc(Sigar.java:348)
  </code></pre>
  
  <p>please find sample code below</p>
  
  <pre><code> public static void main(String[] args)
  {
      try
      {
          Shell shell = new Shell();
          shell.setPageSize(PageControl.SIZE_UNLIMITED);
  
          Sigar sigar = shell.getSigar();
  
          CpuPerc cpu = null;
  
          for (int i = 0; i &lt; 10; i++)
          {
              try
              {
                  Thread.sleep(500L);
              } catch (Exception e)
              {
                  // TODO: handle exception
              }
  
              cpu = sigar.getCpuPerc();
              double val = cpu.getCombined();
  
              int cpuUsage = (int) (val * 100);
              // System.out.println(CpuPerc.format(val));
              System.out.println(cpuUsage);
          }
      } 
      catch (SigarException e)
      {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>My Requirement is to collect the CPU Usage at specific time interval for 50 cycles.. and log the average and highest.</p>
  
  <p>Please help me resolve this issue</p>