Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accurate CPU count.

Status
Not open for further replies.

curmudge0n

Programmer
Joined
Jan 19, 2004
Messages
1
Location
CA
Not sure if this is the right place to ask this, but I have a cross-platform app that needs to know the number of processors for licensing purposes.

In linux, I've developed a semi-reliable way of determining the count by grepping /cpu/procinfo and looking for the ht flag.

Anyway, does someone know a method for getting an accurate cpu count in windows? Is using the registry the best bet, or will hyperthreading make that count unreliable too?

Cheers.
 
On 95/85/ME the number of processors is always 1, even if there are more present, because these OS'es don't support a multiprocessor architecture.
On NT-based systems, there is an environment variable present, it is called NUMBER_OF_PROCESSORS.



Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top