public override (long TotalMemory, int PercentInUse) TupleGetTotalPhysicalMemorySizeAndPercentInUse()
        {
            Dictionary <string, ulong> memInfo = LinuxProcFS.ReadMemInfo();

            long totalMemory  = (long)memInfo[MemInfoConstants.MemTotal];
            long freeMem      = (long)memInfo[MemInfoConstants.MemFree];
            long availableMem = (long)memInfo[MemInfoConstants.MemAvailable];

            // Divide by 1048576 to convert total memory from KB to GB.
            return(totalMemory / 1048576, (int)(((double)(totalMemory - availableMem - freeMem)) / totalMemory * 100));
        }
        public override ulong GetCommittedBytes()
        {
            Dictionary <string, ulong> memInfo = LinuxProcFS.ReadMemInfo();

            ulong memTotal  = memInfo[MemInfoConstants.MemTotal];
            ulong memFree   = memInfo[MemInfoConstants.MemFree];
            ulong memAvail  = memInfo[MemInfoConstants.MemAvailable];
            ulong swapTotal = memInfo[MemInfoConstants.SwapTotal];
            ulong swapFree  = memInfo[MemInfoConstants.SwapFree];

            return((memTotal - memAvail - memFree + (swapTotal - swapFree)) * 1024);
        }
        public override async Task <OSInfo> GetOSInfoAsync(CancellationToken cancellationToken)
        {
            OSInfo osInfo = default(OSInfo);

            (int exitCode, List <string> outputLines) = await ExecuteProcessAsync("lsb_release", "-d");

            if (exitCode == 0 && outputLines.Count == 1)
            {
                /*
                ** Example:
                ** Description:\tUbuntu 18.04.2 LTS
                */
                osInfo.Name = outputLines[0].Split(':', count: 2)[1].Trim();
            }

            osInfo.Version = await File.ReadAllTextAsync("/proc/version");

            osInfo.Language          = string.Empty;
            osInfo.Status            = "OK";
            osInfo.NumberOfProcesses = Process.GetProcesses().Length;

            // Source code: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/meminfo.c
            Dictionary <string, ulong> memInfo = LinuxProcFS.ReadMemInfo();

            osInfo.TotalVisibleMemorySizeKB = memInfo[MemInfoConstants.MemTotal];
            osInfo.FreePhysicalMemoryKB     = memInfo[MemInfoConstants.MemFree];
            osInfo.AvailableMemoryKB        = memInfo[MemInfoConstants.MemAvailable];

            // On Windows, TotalVirtualMemorySize = TotalVisibleMemorySize + SizeStoredInPagingFiles.
            // SizeStoredInPagingFiles - Total number of kilobytes that can be stored in the operating system paging files—0 (zero)
            // indicates that there are no paging files. Be aware that this number does not represent the actual physical size of the paging file on disk.
            // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem
            osInfo.TotalVirtualMemorySizeKB = osInfo.TotalVisibleMemorySizeKB + memInfo[MemInfoConstants.SwapTotal];

            osInfo.FreeVirtualMemoryKB = osInfo.FreePhysicalMemoryKB + memInfo[MemInfoConstants.SwapFree];

            (float uptime, float idleTime) = await LinuxProcFS.ReadUptimeAsync();

            osInfo.LastBootUpTime = DateTime.UtcNow.AddSeconds(-uptime).ToString("o");

            try
            {
                osInfo.InstallDate = new DirectoryInfo("/var/log/installer").CreationTimeUtc.ToString("o");
            }
            catch (IOException)
            {
                osInfo.InstallDate = "N/A";
            }

            return(osInfo);
        }