Initial revision
This commit is contained in:
1 parent
1a7957fb1e
commit
dffe0da855
207 files changed
+34390
No files matched your search
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using Hyperic.Sigar;
|
||||
|
||||
public class CpuInfo {
|
||||
|
||||
public static void Main() {
|
||||
Sigar sigar = new Sigar();
|
||||
|
||||
Hyperic.Sigar.CpuInfo[] infos =
|
||||
sigar.CpuInfos();
|
||||
|
||||
System.Console.WriteLine(infos.Length + " total CPUs..");
|
||||
|
||||
foreach (Hyperic.Sigar.CpuInfo info in infos) {
|
||||
System.Console.WriteLine("Vendor........" + info.Vendor);
|
||||
System.Console.WriteLine("Model........." + info.Model);
|
||||
System.Console.WriteLine("Mhz..........." + info.Mhz);
|
||||
System.Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using Hyperic.Sigar;
|
||||
|
||||
public class Df {
|
||||
|
||||
public static void Main() {
|
||||
Sigar sigar = new Sigar();
|
||||
|
||||
foreach (FileSystem fs in sigar.FileSystemList()) {
|
||||
FileSystemUsage usage;
|
||||
ulong used, avail, total, pct;
|
||||
|
||||
try {
|
||||
usage = sigar.FileSystemUsage(fs.DirName);
|
||||
|
||||
used = usage.Total - usage.Free;
|
||||
avail = usage.Avail;
|
||||
total = usage.Total;
|
||||
pct = (ulong)(usage.UsePercent * 100);
|
||||
} catch (ApplicationException) {
|
||||
used = avail = total = pct = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
string usePct;
|
||||
if (pct == 0) {
|
||||
usePct = "-";
|
||||
}
|
||||
else {
|
||||
usePct = pct + "%";
|
||||
}
|
||||
|
||||
System.Console.WriteLine(fs.DevName + "\t" +
|
||||
total + "\t" +
|
||||
used + "\t" +
|
||||
avail + "\t" +
|
||||
usePct + "\t" +
|
||||
fs.DirName + "\t" +
|
||||
fs.SysTypeName + "/" + fs.TypeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Hyperic.Sigar;
|
||||
|
||||
public class Free {
|
||||
|
||||
public static void Main() {
|
||||
Sigar sigar = new Sigar();
|
||||
|
||||
Mem mem = sigar.Mem();
|
||||
Swap swap = sigar.Swap();
|
||||
|
||||
System.Console.WriteLine("\tTotal\tUsed\tFree");
|
||||
|
||||
System.Console.WriteLine("Mem:\t" +
|
||||
mem.Total / 1024 + "\t" +
|
||||
mem.Used / 1024 + "\t" +
|
||||
mem.Free / 1024);
|
||||
|
||||
System.Console.WriteLine("Swap:\t" +
|
||||
swap.Total / 1024 + "\t" +
|
||||
swap.Used / 1024 + "\t" +
|
||||
swap.Free / 1024);
|
||||
|
||||
System.Console.WriteLine("RAM:\t" + mem.Ram + "MB");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user