开发者

Why does WinAPI's GetSystemInfo tell that my quad-core machine has 8 cores?

I'm trying to find out how to get the number of CPU cores progr开发者_Go百科ammatically. This is the code I'm using:

SYSTEM_INFO sysinfo;
GetSystemInfo( &sysinfo );
std::cout << "CPU count: " << sysinfo.dwNumberOfProcessors << std::endl;

This is running on Windows on the iMac i7 via Boot Camp. It would be nice to find out that Apple made a manufacturing mistake and put an 8-core in my machine instead of a 4-core.


If your machine is hyper-threaded, it will have 8 virtual cores.

Check the Performance tab of the Windows Task Manager, see how many CPUs are displayed.


This is caused by Hyper-Threading in your i7 processor. You may want to use GetLogicalProcessorInformation function to obtain correct information about logical and physical cores. http://msdn.microsoft.com/en-us/library/ms683194

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜