I have written the following code
import org.hyperic.sigar.*;
import org.hyperic.sigar.ProcCpu;
public class ProcessWorking{
public static void main(String args[]) throws SigarException{
Sigar sigar = new Sigar();
long id = sigar.getPid();
ProcCpu cpu = sigar.getProcCpu(id);
System.out.println(cpu.getLastTime());
}
}
But the output which I get is
output
{User=50, LastTime=-893188, Percent=0.0, StartTime=1323862645000, Total=70, Sys=20}
I am not sure y the LastTime is coming in the negative value and what ever complex looping structure I run the Percent of CPU used is always 0.0,
Could anyone please help, with this? Thanks in advance
import org.hyperic.sigar.*;
import org.hyperic.sigar.ProcCpu;
public class ProcessWorking{
public static void main(String args[]) throws SigarException{
Sigar sigar = new Sigar();
long id = sigar.getPid();
ProcCpu cpu = sigar.getProcCpu(id);
System.out.println(cpu.getLastTime());
}
}
But the output which I get is
output
{User=50, LastTime=-893188, Percent=0.0, StartTime=1323862645000, Total=70, Sys=20}
I am not sure y the LastTime is coming in the negative value and what ever complex looping structure I run the Percent of CPU used is always 0.0,
Could anyone please help, with this? Thanks in advance