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 SwapUsage parse(List <string> str) { SwapUsage swap = new SwapUsage(); foreach (string s in str) { if (s.EndsWith("K total swap")) { swap.totalSwap = long.Parse(s.Replace("K total swap", "")); } else if (s.EndsWith("K used swap")) { swap.usedSwap = long.Parse(s.Replace("K used swap", "")); } else if (s.EndsWith("K free swap")) { swap.freeSwap = long.Parse(s.Replace("K free swap", "")); } } return(swap); }
public static SwapUsage profile() { return(SwapUsage.parse("vmstat -s".Bash().Split('\n').Select(x => x.Trim()).ToList())); }
public static SwapUsage parse(string str) { return(SwapUsage.parse(str.Split('\n').ToList())); }