资源介绍
C# 系统操作 实时显示CPU内存使用率
Microsoft.VisualBasic.Devices.Computer myInfo = new Microsoft.VisualBasic.Devices.Computer();
//获取物理内存总量
pbMemorySum.Maximum = Convert.ToInt32(myInfo.Info.TotalPhysicalMemory/1024/1024);
pbMemorySum.Value = Convert.ToInt32(myInfo.Info.TotalPhysicalMemory / 1024 / 1024);
lblSum.Text = (myInfo.Info.TotalPhysicalMemory / 1024).ToString();
//获取可用物理内存总量
pbMemoryUse.Maximum = Convert.ToInt32(myInfo.Info.TotalPhysicalMemory / 1024 / 1024);
pbMemoryUse.Value = Convert.ToInt32(myInfo.Info.AvailablePhysicalMemory / 1024 / 1024);
lblMuse.Text = (myInfo.Info.AvailablePhysicalMemory / 1024).ToString();
//获取虚拟内存总量
pbVmemorysum.Maximum = Convert.ToInt32(myInfo.Info.TotalVirtualMemory / 1024 / 1024);
pbVmemorysum.Value = Convert.ToInt32(myInfo.Info.TotalVirtualMemory / 1024 / 1024);
lblVinfo.Text = (myInfo.Info.TotalVirtualMemory / 1024).ToString();
//获取可用虚拟内存总量
pbVmemoryuse.Maximum = Convert.ToInt32(myInfo.Info.TotalVirtualMemory / 1024 / 1024);
pbVmemoryuse.Value = Convert.ToInt32(myInfo.Info.AvailableVirtualMemory/ 1024 / 1024);
lblVuse.Text = (myInfo.Info.AvailableVirtualMemory / 1024).ToString();
- 上一篇: C#版cpu使用率监控程序
- 下一篇: c# 获取系统内存和cpu使用情况