I've been trying to get a process CPU usage by using Sigar library but I always get values of 0 even when it should be higher.
I'm doing this on a timer every second:
Sigar sigar = new Sigar();
long pid = find.find("Exe.Name.ct=myprocess.exe");
ProcCpu cpu = sigar.getProcCpu(pid);
System.out.println(cpu.getPercent());
I've been taking a look at this other related question and its accepted answer but it doesn't seem to work properly plus things like TOTAL_TIME_UPDATE_LIMIT
are kind of a mystery.
I also took a look at this another one but it didn't provide to me anything new.
Has anyone tried to monitor the process CPU before with Sigar? What's the way to accomplish it?
Thanks.