/// <summary>
        /// 获取linux系统总物理内存使用情况(总量/已使用/未使用)(返回单位MB)
        /// </summary>
        /// <returns></returns>
        public static MemoryMetrics GetLinuxMemoryMetrics()
        {
            try
            {
                string output = "";

                var info = new ProcessStartInfo();
                info.FileName  = "/bin/bash";
                info.Arguments = "-c \"free -m\"";
                info.RedirectStandardOutput = true;

                using (var process = Process.Start(info))
                {
                    output = process.StandardOutput.ReadToEnd();
                }

                /*  单位应该是MB
                 * total        used        free      shared  buff/cache   available
                 * Mem:          64299       16049        3002           2       45246       47763
                 * Swap:          8191           0        8191
                 */

                if (string.IsNullOrWhiteSpace(output))
                {
                    return(null);
                }

                var lines  = output.Trim().Split('\n');
                var memory = lines[1].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                MemoryMetrics memoryMetrics = new MemoryMetrics()
                {
                    Total = double.Parse(memory[1]),
                    Used  = double.Parse(memory[2]),
                };
                memoryMetrics.Free        = memoryMetrics?.Total - memoryMetrics?.Used;
                memoryMetrics.FreePercent = Math.Round(double.Parse(memory[2]) * 100.00 / double.Parse(memory[1]), 3);

                return(memoryMetrics);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        /// <summary>
        /// 获取Windows系统总物理内存使用情况(总量/已使用/未使用)(返回单位MB)
        /// </summary>
        /// <returns></returns>
        public static MemoryMetrics GetWindowsMemoryMetrics()
        {
            try
            {
                string output = "";

                var info = new ProcessStartInfo();
                info.FileName  = "wmic";
                info.Arguments = "OS get FreePhysicalMemory,TotalVisibleMemorySize /Value";
                info.RedirectStandardOutput = true;

                using (var process = Process.Start(info))
                {
                    output = process.StandardOutput.ReadToEnd();
                }

                /*
                 * FreePhysicalMemory=2527660
                 *
                 * TotalVisibleMemorySize=8306868
                 */

                if (string.IsNullOrWhiteSpace(output))
                {
                    return(null);
                }

                var lines      = output.Trim().Split('\n');
                var freeParts  = lines[0].Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
                var totalParts = lines[1].Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);

                MemoryMetrics memoryMetrics = new MemoryMetrics()
                {
                    Total = Math.Round(double.Parse(totalParts[1]) / 1024, 0),
                    Free  = Math.Round(double.Parse(freeParts[1]) / 1024, 0)
                };
                memoryMetrics.Used = memoryMetrics.Total - memoryMetrics.Free;

                return(memoryMetrics);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }