Programatically detect number of physical processors/cores or if hyper-threading is active on Window
Posted
by HTASSCPP
on Stack Overflow
See other posts from Stack Overflow
or by HTASSCPP
Published on 2010-05-25T02:57:07Z
Indexed on
2010/05/25
3:01 UTC
Read the original article
Hit count: 464
I have a multithreaded c++ application that runs on Windows, Mac and a few Linux flavours. To make a long story short: Inorder for it to run at maximum efficiency I have to be able to instantiate a single thread per physical processor/core. Creating more threads than there are physical processors/cores degrades the performance of my program considerably. I can already correctly detect the number of logical processors/cores correctly on all three of these platforms. To be able to detect the number of physical processors/cores correctly I'll have to detect if hyper-treading is supported AND active. My question therefore is if there is a way to detect whether hyperthreading is supported AND ENABLED? If so, how exactly.
© Stack Overflow or respective owner