Open alinayaa opened 1 year ago
<PackageReference Include="CZGL.SystemInfo" Version="2.2.0" />
try
{
var memory = MemoryHelper.GetMemoryValue();
var memorySize =
(float)Math.Round(memory.TotalPhysicalMemory * 1.0 / 1024 / 1024 / 1024, 2);
var memoryUsedSize =
(float)Math.Round(memory.UsedPhysicalMemory * 1.0 / 1024 / 1024 / 1024, 2);
Console.WriteLine($"memorySize:{memorySize}GB");
Console.WriteLine($"memoryUsedSize:{memoryUsedSize}GB");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
memorySize:0GB
memoryUsedSize:1.6173236E+10GB
uname -a
Linux 4.4.83 #132 SMP PREEMPT Tue Nov 8 15:29:19 CST 2022 armv7l armv7l a
cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
linux arm32v7环境下无法获取已用内存和总内存,需要的话我可以提供远程可测试的设备