use shell commands

This commit is contained in:
Doug MacEachern 2005-05-13 18:07:27 +00:00
parent dbf28a4397
commit 3d5e199f5b
1 changed files with 8 additions and 48 deletions

View File

@ -1,7 +1,5 @@
package net.hyperic.sigar.cmd; package net.hyperic.sigar.cmd;
import net.hyperic.sigar.CpuInfo;
import net.hyperic.sigar.OperatingSystem;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
/** /**
@ -21,60 +19,22 @@ public class SysInfo extends SigarCommandBase {
return "Display system information"; return "Display system information";
} }
private String getJavaProp(String name) {
return System.getProperty("java." + name);
}
public void output(String[] args) throws SigarException { public void output(String[] args) throws SigarException {
/** //sigar/os info
* OS info Version.printInfo(this.out);
*/
OperatingSystem os = OperatingSystem.getInstance();
println(os.getName() + " " +
os.getVersion() + " " +
os.getArch());
if (os.getName().equals("Linux")) {
println(os.getVendor() + " " + os.getVendorVersion());
}
/**
* JVM info
*/
println(getJavaProp("vm.name") + " - " +
getJavaProp("vm.vendor") + " [" +
getJavaProp("vm.version") + "]");
println(getJavaProp("specification.vendor") + " " +
getJavaProp("specification.name") + " " +
getJavaProp("specification.version"));
println("JAVA_HOME=" + getJavaProp("home"));
println(""); println("");
/** //uptime
* uptime
*/
new Uptime(this.shell).output(args); new Uptime(this.shell).output(args);
println(""); println("");
/** //cpu info
* CPU info CpuInfo cpuinfo = new CpuInfo(this.shell);
*/ cpuinfo.displayTimes = false;
CpuInfo[] infos = this.sigar.getCpuInfoList(); cpuinfo.output(args);
for (int i=0; i<infos.length; i++) {
CpuInfo info = infos[i];
println("CPU " + i + ":");
println(" Vendor........" + info.getVendor());
println(" Model........." + info.getModel());
println(" Mhz..........." + info.getMhz());
println(" Cache size...." + info.getCacheSize());
}
println(""); println("");
/** //memory info
* memory info
*/
new Free(this.shell).output(args); new Free(this.shell).output(args);
} }