🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6282

Re: How to detect number of CPUs and hyperthreading?

#6282
From: Remy Lebeau (TeamB)
Date: Sun, 22 May 2005 05:04
26 lines
1784 bytes
"SubZero" <g_ates@hotmail.com> wrote in message
news:428f19db$1@newsgroups.borland.com...

> I wish to get the number of CPUs

GetSystemInfo()

> whether they are hyper threading or multi-cored.

You need to query each CPU directly, via the CPUID assembly instruction.

You can use SetThreadAffinityMask() to specify which CPU a given thread will
execute on.  Calling CPUID with an EAX register value of 0x01 will return
the CPU's version info in the EBX register.  Bits 16-23 of the EBX register
will specify the number of logical processors per physical processor. For a
hyper-threaded CPU, this value will be 2.

I don't know how to identify dual-core CPUs.  Do note, however, that a
dual-core CPU can also support hyper-threading as well.

Go to Intel's website to download the manuals for the Pentium assembly
instruction set for more details.


Gambit
Technical Details
Message-ID: <429012e6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <428f19db$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f023ae5d6b5f79c7
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <428f19db$1@newsgroups.borland.com>
Subject: Re: How to detect number of CPUs and hyperthreading?
Date: Sat, 21 May 2005 22:04:53 -0700
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <429012e6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1116738278 68.69.17.41 (21 May 2005 22:04:38 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail