为了正常的体验网站,请在浏览器设置里面开启Javascript功能!
首页 > c 读取cpu数量,内存容量

c 读取cpu数量,内存容量

2018-08-04 2页 doc 14KB 3阅读

用户头像

is_731942

暂无简介

举报
c 读取cpu数量,内存容量c 读取cpu数量,内存容量 C#读取CPU数量,内存容量 可以通过Windows Management Instrumentation (WMI)提供的接口读取所需要的信息。 private static UInt32 CountPhysicalProcessors() ManagementObjectSearcher objects = new ManagementObjectSearcher( “SELECT * FROM Win32_ComputerSystem”); ManagementObjectCol...
c 读取cpu数量,内存容量
c 读取cpu数量,内存容量 C#读取CPU数量,内存容量 可以通过Windows Management Instrumentation (WMI)提供的接口读取所需要的信息。 private static UInt32 CountPhysicalProcessors() ManagementObjectSearcher objects = new ManagementObjectSearcher( “SELECT * FROM Win32_ComputerSystem”); ManagementObjectCollection coll = objects.Get(); foreach(ManagementObject obj in coll) return (UInt32)obj[“NumberOfProcessors”]; return 0; private static UInt64 CountPhysicalMemory() ManagementObjectSearcher objects =new ManagementObjectSearcher( “SELECT * FROM Win32_PhysicalMemory”); ManagementObjectCollection coll = objects.Get(); UInt64 total = 0; foreach (ManagementObject obj in coll) total += (UInt64)obj[“Capacity”]; return total; } 请添加对程序集System.Management的引用,确保代码可以正确编译。 Console.WriteLine(“Machine: {0}”, Environment.MachineName); Console.WriteLine(“# of processors (logical): {0}”, Environment.ProcessorCount); Console.WriteLine(“# of processors (physical): {0}” CountPhysicalProcessors()); Console.WriteLine(“RAM installed: {0:N0} bytes”, CountPhysicalMemory()); Console.WriteLine(“Is OS 64-bit? {0}”, Environment.Is64BitOperatingSystem); Console.WriteLine(“Is process 64-bit? {0}”, Environment.Is64BitProcess); Console.WriteLine(“Little-endian: {0}”, BitConverter.IsLittleEndian); foreach (Screen screen in System.Windows.Forms.Screen.AllScreens) Console.WriteLine(“Screen {0}”, screen.DeviceName); Console.WriteLine(“\tPrimary {0}”, screen.Primary); Console.WriteLine(“\tBounds: {0}”, screen.Bounds); Console.WriteLine(“\tWorking Area: {0}”,screen.WorkingArea); Console.WriteLine(“\tBitsPerPixel: {0}”,screen.BitsPerPixel); }
/
本文档为【c 读取cpu数量,内存容量】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索