更新时间:2016-03-14 23:25:23浏览次数:1+次
下面是我写的代码检测到我笔记本的CPU的情况:
typedef struct _SYSTEM_INFO {
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;//处理器架构
WORD wReserved;
} ;
} ;
DWORD dwPageSize;//物理内存页大小
LPVOID lpMinimumApplicationAddress;//应用程序可访问的最小物理内存
LPVOID lpMaximumApplicationAddress;//应用程序可访问的最大物理内存
DWORD_PTR dwActiveProcessorMask;//活动的处理器掩码
DWORD dwNumberOfProcessors;//物理的处理器个数
DWORD dwProcessorType;//处理器类型系列
DWORD dwAllocationGranularity;//内存分配粒度
WORD wProcessorLevel;//处理器级别
WORD wProcessorRevision;//处理器的修订版本号
} SYSTEM_INFO;
#include <iostream>
#include <Windows.h>
using namespace std;
void main()
{
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
//GetSystemInfo(&si);
cout<<"处理器架构:";
switch(si.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
cout<<"x64架构 (AMD 或 Intel)";
break;
case PROCESSOR_ARCHITECTURE_IA64:
cout<<"因特尔安腾处理器家族系列(IPF)";
break;
case PROCESSOR_ARCHITECTURE_INTEL:
cout<<"x86架构";
break;
case PROCESSOR_ARCHITECTURE_UNKNOWN:
cout<<"未知处理器架构";
break;
}
cout<<endl;
cout<<"页大小:"<<si.dwPageSize/1024<<"KB\n";
cout<<"程序可使用物理内存最小地址:0x"<<hex<<si.lpMinimumApplicationAddress<<endl;
cout<<"程序可使用物理内存最大地址:0x"<<hex<<si.lpMaximumApplicationAddress<<endl;
cout<<"处理器掩码:0x"<<hex<<si.dwActiveProcessorMask<<endl;
cout<<"处理器个数(物理):"<<si.dwNumberOfProcessors<<endl;
cout<<"处理器系列:";
switch(si.dwProcessorType)
{
case PROCESSOR_INTEL_386:
cout<<"386"<<endl;
break;
case PROCESSOR_INTEL_486:
cout<<"486"<<endl;
break;
case PROCESSOR_INTEL_PENTIUM:
cout<<"586奔腾"<<endl;
break;
case PROCESSOR_INTEL_IA64:
cout<<"2200IA64"<<endl;
break;
case PROCESSOR_AMD_X8664:
cout<<"8664"<<endl;
break;
}
cout<<"分配粒度:"<<si.dwAllocationGranularity/1024<<"KB"<<endl;
}
相关资讯