Hi,
I'm trying to run the following code:
import org.hyperic.sigar.SigarException;import org.hyperic.sigar.Sigarpublic class PerformanceMonitor {public static void main(String[] args) throws SigarException, InterruptedException {for(long pid: new Sigar().getProcList())System.out.println(formatProcInfo(sigar, pid));}private static String formatProcInfo(Sigar sigar, long pid) throws SigarException {return String.format("%d - %s - %d%% - %d - %d",pid,sigar.getProcState(pid).getName(),sigar.getProcCpu(pid).getPercent(),sigar.getProcMem(pid).getResident(),sigar.getProcMem(pid).getSize());}}
I get the following Exception:
Exception in thread "main" org.hyperic.sigar.SigarPermissionDeniedException: m Files\Common Files at org.hyperic.sigar.ProcCpu.gather(Native Method) at org.hyperic.sigar.ProcCpu.fetch(ProcCpu.java:30) at org.hyperic.sigar.Sigar.getProcCpu(Sigar.java:488) at perfMon.PerformanceMonitor.formatProcInfo(PerformanceMonitor.java:37) at perfMon.PerformanceMonitor.main(PerformanceMonitor.java:29)
I'm running the code on a Winows 8 x86 machine.
What am I doing wrong?