- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am loking for ways to detect hyper threading in c++ program on Linux. I don't intent to read /proc/cpuinfo file.
I have tried cpuid and then edx value, somehow, it returns the same value on machines with HT and without HT.
It seems some cpucounter program on web is not working for intel64.
I am using 64 bit Linux machine with :
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz
...
Thank you.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The question becomes: Do you want completely portable code?
IOW to older generations of Intel and non-Intel (AMD?) archetectures than your Intel(R) Core(TM) i7-3960X CPU
Also, there is a potential issue should you have a multi-socket system where some sockets have HT (enabled) and others do not.
You might start by consulting Google:
"detecting multi-core processor topology" site:intel.com format:.pdf
*** open the.PDF file link(s) not the non-pdf file (html) link
*** the Intel site has wrong hyperlinks in (bmunged up in update)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GRIPE
Unable to post comments with simple formatting such as blank lines and white space on left side for indentation
And NO I am not willing to accept having to type in HTML tags.
This is a general purpose programmers forum (e.g. C++, FORTRAN, etc), not a web designer/programmer forum (HTML, HTML6).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...I have tried cpuid and then edx value, somehow, it returns the same value on machines with HT and without HT...
I have two test-cases that use CPUID instruction and I didn't have any problems with detecting HTT:
...
const RTuint _HTT_FEATURE_BIT = 0x10000000; // 00010000000000000000000000000000
...
MOV eax, 1
CPUID
MOV uiFeatureRegCX, ecx
MOV uiFeatureRegDX, edx
if( ( uiFeatureRegDX & _HTT_FEATURE_BIT )
{
return ( RTbool )RTtrue;
}
...
Did you check a 28th bit of EDX register?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page