public static SystemUsage profile() { SystemUsage systemUsage = new SystemUsage(); systemUsage.cpu = CpuUsage.profile(); systemUsage.memory = MemoryUsage.profile(); systemUsage.swap = SwapUsage.profile(); systemUsage.dateTime = DateTime.UtcNow; return(systemUsage); }
public static MemoryUsage parse(List <string> str) { MemoryUsage mem = new MemoryUsage(); foreach (string s in str) { if (s.EndsWith("K total memory")) { mem.totalMemory = long.Parse(s.Replace("K total memory", "")); } else if (s.EndsWith("K used memory")) { mem.usedMemory = long.Parse(s.Replace("K used memory", "")); } else if (s.EndsWith("K free memory")) { mem.freeMemory = long.Parse(s.Replace("K free memory", "")); } } return(mem); }
public static MemoryUsage profile() { return(MemoryUsage.parse("vmstat -s".Bash().Split('\n').Select(x => x.Trim()).ToList())); }
public static MemoryUsage parse(string str) { return(MemoryUsage.parse(str.Split('\n').ToList())); }