@SuppressWarnings("deprecation")
private ProcessObject getProcessInfo(SigarProxy sigar, long pid)
throws SigarException {
ProcessObject pObj = new ProcessObject(pid);
ProcState state = sigar.getProcState(pid);
ProcTime time = null;
pObj.setPid(pid);
// get process credential
try {
ProcCredName cred = sigar.getProcCredName(pid);
pObj.setprocessCredentialName(cred.getUser());
} catch (SigarException e) {
}
// get process time
try {
time = sigar.getProcTime(pid);
pObj.setProcessTime(getStartTime(time.getStartTime()));
} catch (SigarException e) {
}
// get process memory related information
try {
ProcMem mem = sigar.getProcMem(pid);
pObj.setMemorySize(mem.getSize());
pObj.setRssSize(mem.getRss());
pObj.setSharedMemory(mem.getShare());
pObj.setResident(mem.getResident());
} catch (SigarException e) {
}
pObj.setProcessState(String.valueOf(state.getState()));
try {
ProcCpu cpu = sigar.getProcCpu(pid);
int cpuCores = sigar.getCpuInfoList()[0].getTotalCores();
int cpuSockets = sigar.getCpuInfoList()[0].getTotalSockets();