add OpenFd
This commit is contained in:
parent
fa5bea7363
commit
a82fbb4cda
|
@ -1,5 +1,6 @@
|
|||
package net.hyperic.sigar.jmx;
|
||||
|
||||
import net.hyperic.sigar.ProcFd;
|
||||
import net.hyperic.sigar.ProcMem;
|
||||
import net.hyperic.sigar.ProcTime;
|
||||
import net.hyperic.sigar.Sigar;
|
||||
|
@ -44,6 +45,15 @@ public class SigarProcess implements SigarProcessMBean {
|
|||
}
|
||||
}
|
||||
|
||||
private ProcFd getFd() {
|
||||
try {
|
||||
long pid = this.sigar.getPid();
|
||||
return this.sigar.getProcFd(pid);
|
||||
} catch (SigarException e) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public Long getMemSize() {
|
||||
return new Long(getMem().getSize());
|
||||
}
|
||||
|
@ -76,6 +86,10 @@ public class SigarProcess implements SigarProcessMBean {
|
|||
return new Long(getTime().getSys());
|
||||
}
|
||||
|
||||
public Long getOpenFd() {
|
||||
return new Long(getFd().getTotal());
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
SigarProcessMBean proc = new SigarProcess();
|
||||
System.out.println("MemSize=" + proc.getMemSize());
|
||||
|
@ -84,5 +98,6 @@ public class SigarProcess implements SigarProcessMBean {
|
|||
System.out.println("MemPageFaults=" + proc.getMemPageFaults());
|
||||
System.out.println("TimeUser=" + proc.getTimeUser());
|
||||
System.out.println("TimeSys=" + proc.getTimeSys());
|
||||
System.out.println("OpenFd=" + proc.getOpenFd());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public interface SigarProcessMBean {
|
|||
public Long getTimeUser();
|
||||
|
||||
public Long getTimeSys();
|
||||
|
||||
public Long getOpenFd();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue