예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public static MemoryUsage profile()
 {
     return(MemoryUsage.parse("vmstat -s".Bash().Split('\n').Select(x => x.Trim()).ToList()));
 }
예제 #4
0
 public static MemoryUsage parse(string str)
 {
     return(MemoryUsage.parse(str.Split('\n').ToList()));
 }