www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - cpuid wrapper

reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Hi all,
I've written a simple class that encapsulates the cpuid instruction. It 
could probably be improved and polished, but I'm fairly happy with it.

One thing I'm considering is if a static only class would be better, 
it's not like the info can change dynamically...

Get it here: http://famolsen.dk/d/cpuid.zip

The zip contains the cpuid module and a simple test app. Running the 
test app I get personally get this:

Vendor string:    AuthenticAMD
Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
Multithreading:   2 threads / 2 cores

The threading info should work on both Intel and AMD cpus, but I have no 
way to test the Intel path. Any feedback would be much appreciated.

Also, I'm considering creating a library with sse/2/3 optimised batch 
operations for vector operations normalisation etc. Would such a library 
be of interest to the D community?
Oct 24 2006
next sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
Tomas Lindquist Olsen wrote:
 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It 
 could probably be improved and polished, but I'm fairly happy with it.
 
 One thing I'm considering is if a static only class would be better, 
 it's not like the info can change dynamically...
 
 Get it here: http://famolsen.dk/d/cpuid.zip
 
 The zip contains the cpuid module and a simple test app. Running the 
 test app I get personally get this:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 The threading info should work on both Intel and AMD cpus, but I have no 
 way to test the Intel path. Any feedback would be much appreciated.
 
 Also, I'm considering creating a library with sse/2/3 optimised batch 
 operations for vector operations normalisation etc. Would such a library 
 be of interest to the D community?
Very yes.
Oct 24 2006
prev sibling next sibling parent reply Paolo Invernizzi <arathorn NOSPAM_fastwebnet.it> writes:
On my machine...

D:\Users\invernizzi\tmp>build test.d -exec
Vendor string:    GenuineIntel
Processor string:               Intel(R) Pentium(R) D CPU 3.00GHz
Features:         MMX SSE SSE2 SSE3 AMD64 HTT
Multithreading:   2 threads / 2 cores

---
Paolo Invernizzi

Tomas Lindquist Olsen wrote:

 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 The threading info should work on both Intel and AMD cpus, but I have no 
 way to test the Intel path. Any feedback would be much appreciated.
Oct 24 2006
next sibling parent Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Paolo Invernizzi wrote:
 On my machine...
 
 D:\Users\invernizzi\tmp>build test.d -exec
 Vendor string:    GenuineIntel
 Processor string:               Intel(R) Pentium(R) D CPU 3.00GHz
 Features:         MMX SSE SSE2 SSE3 AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 ---
 Paolo Invernizzi
 
Hmm. Is that information correct? I thought all recent Pentium CPU's had two hardware threads per core.
Oct 24 2006
prev sibling parent Don Clugston <dac nospam.com.au> writes:
Paolo Invernizzi wrote:
 On my machine...
 
 D:\Users\invernizzi\tmp>build test.d -exec
 Vendor string:    GenuineIntel
 Processor string:               Intel(R) Pentium(R) D CPU 3.00GHz
 Features:         MMX SSE SSE2 SSE3 AMD64 HTT
 Multithreading:   2 threads / 2 cores
And here's a single-thread result:
bud test.d -exec
Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) M processor 1.86GHz Features: MMX SSE SSE2 Multithreading: 1 threads / 1 cores
 
 ---
 Paolo Invernizzi
 
 Tomas Lindquist Olsen wrote:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores

 The threading info should work on both Intel and AMD cpus, but I have 
 no way to test the Intel path. Any feedback would be much appreciated.
 Also, I'm considering creating a library with sse/2/3 optimised batch
 operations for vector operations normalisation etc. Would such a library
 be of interest to the D community?
Yes. But, make sure you're not just reinventing the wheel, since it's such a well-explored problem. I think it would make sense for D to come with a simple BLAS implementation for general use. I just found one little BLAS1 implementation that's under a BSD license: http://iridia.ulb.ac.be/~fvandenb/miniSSEL1BLAS/miniSSEL1BLAS.html which looks as though it is D-compatible and easy to port. No doubt there are many others on the net.
Oct 24 2006
prev sibling next sibling parent Lutger <lutger.blijdestijn gmail.com> writes:
Tomas Lindquist Olsen wrote:
 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It 
 could probably be improved and polished, but I'm fairly happy with it.
 
 One thing I'm considering is if a static only class would be better, 
 it's not like the info can change dynamically...
 
 Get it here: http://famolsen.dk/d/cpuid.zip
 
 The zip contains the cpuid module and a simple test app. Running the 
 test app I get personally get this:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 The threading info should work on both Intel and AMD cpus, but I have no 
 way to test the Intel path. Any feedback would be much appreciated.
 
 Also, I'm considering creating a library with sse/2/3 optimised batch 
 operations for vector operations normalisation etc. Would such a library 
 be of interest to the D community?
Thank you and yes, of course.
Oct 24 2006
prev sibling next sibling parent reply "Chris Miller" <chris dprogramming.com> writes:
On Tue, 24 Oct 2006 06:11:42 -0400, Tomas Lindquist Olsen  
<tomas famolsen.dk> wrote:

 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It  
 could probably be improved and polished, but I'm fairly happy with it.
Cool! I was just thinking about detecting the CPU recently. Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) 4 CPU 2.66GHz Features: MMX SSE SSE2 HTT Multithreading: 1 threads / 1 cores HTT with 1 thread/core?
Oct 24 2006
parent "nobody_" <spam spam.spam> writes:
Vendor string:    GenuineIntel
Processor string:               Intel(R) Pentium(R) 4 CPU 2.80GHz
Features:         MMX SSE SSE2 HTT
Multithreading:   2 threads / 1 cores

 Vendor string:    GenuineIntel
 Processor string:               Intel(R) Pentium(R) 4 CPU 2.66GHz
 Features:         MMX SSE SSE2 HTT
 Multithreading:   1 threads / 1 cores

 HTT with 1 thread/core?
HTT can be disabled/enabled in bios, maybe you have it disabled?
Oct 24 2006
prev sibling next sibling parent "Tiberiu Gal" <galtiberiu gmail.com> writes:
On Tue, 24 Oct 2006 13:11:42 +0300, Tomas Lindquist Olsen  
<tomas famolsen.dk> wrote:

 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It  
 could probably be improved and polished, but I'm fairly happy with it.

 One thing I'm considering is if a static only class would be better,  
 it's not like the info can change dynamically...

 Get it here: http://famolsen.dk/d/cpuid.zip

 The zip contains the cpuid module and a simple test app. Running the  
 test app I get personally get this:

 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores

 The threading info should work on both Intel and AMD cpus, but I have no  
 way to test the Intel path. Any feedback would be much appreciated.

 Also, I'm considering creating a library with sse/2/3 optimised batch  
 operations for vector operations normalisation etc. Would such a library  
 be of interest to the D community?
c:\>build test.d -exec Vendor string: AuthenticAMD Processor string: AMD Athlon(tm) XP 2000+ Features: MMX SSE 3DNow! 3DNow!+ MMX+ Multithreading: 1 threads / 1 cores it works fine -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Oct 24 2006
prev sibling next sibling parent reply Walter Bright <newshound digitalmars.com> writes:
Tomas Lindquist Olsen wrote:
 Get it here: http://famolsen.dk/d/cpuid.zip
I'd like to put this into Phobos. Can you explicitly make it public domain?
Oct 24 2006
parent Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Walter Bright wrote:
 I'd like to put this into Phobos. Can you explicitly make it public domain?
Cool :) I have updated the zip and CPUID is now public domain. There is one more thing (at least) that should be implemented though before this is really worthy of being in std (IMHO). The threading info is only probing the hardware. The OS might not allow the app to use those resources so processor affinity stuff should be added. I can add this, just have to read up on it. Or if someone knows it already feel free to patch, in which case I will do nothing :P
Oct 24 2006
prev sibling next sibling parent clayasaurus <clayasaurus gmail.com> writes:
Tomas Lindquist Olsen wrote:
 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It 
 could probably be improved and polished, but I'm fairly happy with it.
 
 One thing I'm considering is if a static only class would be better, 
 it's not like the info can change dynamically...
 
 Get it here: http://famolsen.dk/d/cpuid.zip
 
 The zip contains the cpuid module and a simple test app. Running the 
 test app I get personally get this:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 The threading info should work on both Intel and AMD cpus, but I have no 
 way to test the Intel path. Any feedback would be much appreciated.
 
 Also, I'm considering creating a library with sse/2/3 optimised batch 
 operations for vector operations normalisation etc. Would such a library 
 be of interest to the D community?
I got... Vendor string: GenuineIntel Processor string: Genuine Intel(R) CPU T2300 1.66GHz Features: MMX SSE SSE2 SSE3 HTT Multithreading: 2 threads / 2 cores Seems to work. ~ Clay
Oct 24 2006
prev sibling next sibling parent "Andrey Khropov" <andkhropov_nosp m_mtu-net.ru> writes:
Tomas Lindquist Olsen wrote:

 One thing I'm considering is if a static only class would be better, it's not
 like the info can change dynamically...
Who knows... Maybe one day D will be used in a multi-processor system with Hot-Swapped CPUs. But anyway your code makes a nice contribution to D codebase. -- 'non-optimal' is a politically correct term for s*it
Oct 24 2006
prev sibling next sibling parent Lars Ivar Igesund <larsivar igesund.net> writes:
Tomas Lindquist Olsen wrote:

 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It
 could probably be improved and polished, but I'm fairly happy with it.
 
 One thing I'm considering is if a static only class would be better,
 it's not like the info can change dynamically...
 
 Get it here: http://famolsen.dk/d/cpuid.zip
 
 The zip contains the cpuid module and a simple test app. Running the
 test app I get personally get this:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 The threading info should work on both Intel and AMD cpus, but I have no
 way to test the Intel path. Any feedback would be much appreciated.
 
 Also, I'm considering creating a library with sse/2/3 optimised batch
 operations for vector operations normalisation etc. Would such a library
 be of interest to the D community?
larsivi larsivi-laptop:~/code/d/cpuid$ ./test Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) M processor 1.86GHz Features: MMX SSE SSE2 Multithreading: 1 threads / 1 cores Looks correct to me, the naming of the processor is Pentium-M 750 in the computer spec. -- Lars Ivar Igesund blog at http://larsivi.net DSource & #D: larsivi
Oct 24 2006
prev sibling next sibling parent Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Tomas Lindquist Olsen wrote:
 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It 
 could probably be improved and polished, but I'm fairly happy with it.
 
 One thing I'm considering is if a static only class would be better, 
 it's not like the info can change dynamically...
Maybe even just a module with some functions? (with recommendation to use static import)
 Get it here: http://famolsen.dk/d/cpuid.zip
 
 The zip contains the cpuid module and a simple test app. Running the 
 test app I get personally get this:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
 Features:         MMX SSE SSE2 SSE3 3DNow! 3DNow!+ MMX+ AMD64 HTT
 Multithreading:   2 threads / 2 cores
 
 The threading info should work on both Intel and AMD cpus, but I have no 
 way to test the Intel path. Any feedback would be much appreciated.
After a small patch: char[12] vendorStr = ' '; char[48] processorStr = ' '; (Otherwise it crashes with an "invalid UTF string" exception) it returned this: Vendor string: GenuineIntel Processor string: Features: MMX SSE Multithreading: 1 threads / 1 cores on my laptop, which looks about right. Guess my laptop is so old it doesn't have a processor string. Well, either that or your code's buggy :P. (It's a Celeron according to the sticker, and about 750 MHz IIRC) Other computer: Vendor string: AuthenticAMD Processor string: AMD Sempron(tm) 2600+ Features: MMX SSE 3DNow! 3DNow!+ MMX+ Multithreading: 1 threads / 1 cores also looks right.
 Also, I'm considering creating a library with sse/2/3 optimised batch
 operations for vector operations normalisation etc. Would such a library
 be of interest to the D community?
Not useful to me personally but the more D code is out there, the better :).
Oct 24 2006
prev sibling next sibling parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
The zip has been updated:
* Added public domain header
* Fixed bug with manufacturer not being set if HTT was not supported
* Fixed invalid processor string bugs

It seems that there is actually some interest in this module so I will 
accept feature requests.
Oct 24 2006
next sibling parent reply Carlos Santander <csantander619 gmail.com> writes:
Tomas Lindquist Olsen escribió:
 The zip has been updated:
 * Added public domain header
 * Fixed bug with manufacturer not being set if HTT was not supported
 * Fixed invalid processor string bugs
 
 It seems that there is actually some interest in this module so I will 
 accept feature requests.
I have one: support other processors ;) -- Carlos Santander Bernal
Oct 24 2006
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Carlos Santander wrote:

 It seems that there is actually some interest in this module so I will 
 accept feature requests.
I have one: support other processors ;)
Here is something that supports Mac OS X (Darwin): http://www.algonet.se/~afb/d/cpuinfo.zip Name: ppc7450 CPU Type: CPU_TYPE_POWERPC CPU Subtype: CPU_SUBTYPE_POWERPC_7450 Description: PowerPC 7450 Vector Unit: true Name: i486 CPU Type: CPU_TYPE_I386 CPU Subtype: CPU_SUBTYPE_486 Description: Intel 80486 Vector Unit: true It's not public domain but copyrighted*, though... But sysctl(3) should be all that a "cpuid" needs ? Maybe that can be used to write a portable version: hw.cpufrequency: 800000000 hw.optional.altivec: 1 --anders * Since it needs to use the Mac OS X system headers.
Oct 25 2006
prev sibling parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Did another update with bunch of fixes. I took the time to read the 
official cpuid specs from intel and amd and I was not doing it 100% 
correctly.
Oct 25 2006
parent reply "Chris Miller" <chris dprogramming.com> writes:
On Wed, 25 Oct 2006 05:13:08 -0400, Tomas Lindquist Olsen  =

<tomas famolsen.dk> wrote:

 Did another update with bunch of fixes. I took the time to read the  =
 official cpuid specs from intel and amd and I was not doing it 100%  =
 correctly.
Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) 4 CPU 2.66GHz Signature: Family=3D15 Model=3D2 Stepping=3D7 Features: MMX FXSR SSE SSE2 HTT Multithreading: 4095 threads / 64 cores Wooohooo!
Oct 25 2006
parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
Chris Miller wrote:
 On Wed, 25 Oct 2006 05:13:08 -0400, Tomas Lindquist Olsen 
 <tomas famolsen.dk> wrote:
 
 Did another update with bunch of fixes. I took the time to read the 
 official cpuid specs from intel and amd and I was not doing it 100% 
 correctly.
Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) 4 CPU 2.66GHz Signature: Family=15 Model=2 Stepping=7 Features: MMX FXSR SSE SSE2 HTT Multithreading: 4095 threads / 64 cores Wooohooo!
aiii. I messed it up :( Try again?
Oct 25 2006
parent "Chris Miller" <chris dprogramming.com> writes:
On Wed, 25 Oct 2006 06:57:14 -0400, Tomas Lindquist Olsen  =

<tomas famolsen.dk> wrote:

 Chris Miller wrote:
 On Wed, 25 Oct 2006 05:13:08 -0400, Tomas Lindquist Olsen  =
 <tomas famolsen.dk> wrote:

 Did another update with bunch of fixes. I took the time to read the =
=
 official cpuid specs from intel and amd and I was not doing it 100% =
=
 correctly.
Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) 4 CPU 2.66GHz Signature: Family=3D15 Model=3D2 Stepping=3D7 Features: MMX FXSR SSE SSE2 HTT Multithreading: 4095 threads / 64 cores Wooohooo!
aiii. I messed it up :( Try again?
Vendor string: GenuineIntel Processor string: Intel(R) Pentium(R) 4 CPU 2.66GHz Signature: Family=3D15 Model=3D2 Stepping=3D7 Features: MMX FXSR SSE SSE2 HTT Multithreading: 1 threads / 1 cores Give me back my supercomputer ;)
Oct 25 2006
prev sibling next sibling parent Tydr Schnubbis <fake address.dude> writes:
Tomas Lindquist Olsen wrote:
 Hi all,
 I've written a simple class that encapsulates the cpuid instruction. It 
 could probably be improved and polished, but I'm fairly happy with it.
Doesn't quite work for me, says '0 threads / 0 cores'. I have an Athlon thunderbird model C, 1.4 GHz. The rest of the info looks correct. Vendor string: AuthenticAMD Processor string: AMD Athlon(tm) processor Features: MMX 3DNow! 3DNow!+ MMX+ Multithreading: 0 threads / 0 cores
Oct 24 2006
prev sibling parent reply notknown <notknown none.com> writes:
Vendor string:    AuthenticAMD
Processor string: AMD Sempron(tm)
Features:         MMX SSE 3DNow! 3DNow!+ MMX+
Multithreading:   0 threads / 0 cores

0 threads sounds weird, I am on Linux though.
Oct 25 2006
parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
notknown wrote:
 
 Vendor string:    AuthenticAMD
 Processor string: AMD Sempron(tm)
 Features:         MMX SSE 3DNow! 3DNow!+ MMX+
 Multithreading:   0 threads / 0 cores
 
 0 threads sounds weird, I am on Linux though.
Weird indeed. The thread and core fields are initialised to one, and only if HTT is available is the code that set them invoked. As you dont have HTT on the list this really does not make sense. Can you try printing the value of those fields before the 'if (hyperThreading)' in CPUID.this ?
Oct 25 2006
parent reply notknown <notknown none.com> writes:
Tomas Lindquist Olsen kirjoitti:
 notknown wrote:
 Vendor string:    AuthenticAMD
 Processor string: AMD Sempron(tm)
 Features:         MMX SSE 3DNow! 3DNow!+ MMX+
 Multithreading:   0 threads / 0 cores

 0 threads sounds weird, I am on Linux though.
Weird indeed. The thread and core fields are initialised to one, and only if HTT is available is the code that set them invoked. As you dont have HTT on the list this really does not make sense. Can you try printing the value of those fields before the 'if (hyperThreading)' in CPUID.this ?
Okay, I added these lines right before that if: writefln("flags=", flags); writefln("misc=", misc); writefln("exflags=", exflags); writefln("apic=", apic); writefln("vendorStr=", vendorStr); writefln("processorStr=", processorStr); writefln("maxThreads=", maxThreads); writefln("maxCores=", maxCores); writefln("manufac=", manufac); It prints now: flags=58981375 misc=0 exflags=3251371007 apic=0 vendorStr=AuthenticAMD processorStr=AMD Sempron(tm) maxThreads=0 maxCores=0 manufac=2 Vendor string: AuthenticAMD Processor string: AMD Sempron(tm) Features: MMX SSE 3DNow! 3DNow!+ MMX+ Multithreading: 0 threads / 0 cores
Oct 25 2006
parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
notknown wrote:
 Tomas Lindquist Olsen kirjoitti:
 notknown wrote:
 Vendor string:    AuthenticAMD
 Processor string: AMD Sempron(tm)
 Features:         MMX SSE 3DNow! 3DNow!+ MMX+
 Multithreading:   0 threads / 0 cores

 0 threads sounds weird, I am on Linux though.
Weird indeed. The thread and core fields are initialised to one, and only if HTT is available is the code that set them invoked. As you dont have HTT on the list this really does not make sense. Can you try printing the value of those fields before the 'if (hyperThreading)' in CPUID.this ?
Okay, I added these lines right before that if: writefln("flags=", flags); writefln("misc=", misc); writefln("exflags=", exflags); writefln("apic=", apic); writefln("vendorStr=", vendorStr); writefln("processorStr=", processorStr); writefln("maxThreads=", maxThreads); writefln("maxCores=", maxCores); writefln("manufac=", manufac); It prints now: flags=58981375 misc=0 exflags=3251371007 apic=0 vendorStr=AuthenticAMD processorStr=AMD Sempron(tm) maxThreads=0 maxCores=0 manufac=2 Vendor string: AuthenticAMD Processor string: AMD Sempron(tm) Features: MMX SSE 3DNow! 3DNow!+ MMX+ Multithreading: 0 threads / 0 cores
This seems like a compiler bug. It's declared: uint maxThreads=1; Am I missing something?
Oct 25 2006
parent reply notknown <notknown none.com> writes:
Tomas Lindquist Olsen kirjoitti:
 notknown wrote:
 Tomas Lindquist Olsen kirjoitti:
 notknown wrote:
 Vendor string:    AuthenticAMD
 Processor string: AMD Sempron(tm)
 Features:         MMX SSE 3DNow! 3DNow!+ MMX+
 Multithreading:   0 threads / 0 cores

 0 threads sounds weird, I am on Linux though.
Weird indeed. The thread and core fields are initialised to one, and only if HTT is available is the code that set them invoked. As you dont have HTT on the list this really does not make sense. Can you try printing the value of those fields before the 'if (hyperThreading)' in CPUID.this ?
Okay, I added these lines right before that if: writefln("flags=", flags); writefln("misc=", misc); writefln("exflags=", exflags); writefln("apic=", apic); writefln("vendorStr=", vendorStr); writefln("processorStr=", processorStr); writefln("maxThreads=", maxThreads); writefln("maxCores=", maxCores); writefln("manufac=", manufac); It prints now: flags=58981375 misc=0 exflags=3251371007 apic=0 vendorStr=AuthenticAMD processorStr=AMD Sempron(tm) maxThreads=0 maxCores=0 manufac=2 Vendor string: AuthenticAMD Processor string: AMD Sempron(tm) Features: MMX SSE 3DNow! 3DNow!+ MMX+ Multithreading: 0 threads / 0 cores
This seems like a compiler bug. It's declared: uint maxThreads=1; Am I missing something?
Could it be because you run the code from constructor? Maybe it is not yet set at that point, just guessing?
Oct 25 2006
parent reply notknown <notknown none.com> writes:
 This seems like a compiler bug. It's declared:
 uint maxThreads=1;

 Am I missing something?
Could it be because you run the code from constructor? Maybe it is not yet set at that point, just guessing?
Okay, must be compiler bug, just checked and it is not touched anywhere except the initialization.
Oct 25 2006
parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
notknown wrote:
 This seems like a compiler bug. It's declared:
 uint maxThreads=1;

 Am I missing something?
Could it be because you run the code from constructor? Maybe it is not yet set at that point, just guessing?
Okay, must be compiler bug, just checked and it is not touched anywhere except the initialization.
Do you think you could narrow this down? Seems it's not happening for Windows users. Might as well report it if it's a real bug. Basically some testing of class member initialisers.
Oct 25 2006
parent notknown <notknown none.com> writes:
Tomas Lindquist Olsen kirjoitti:
 notknown wrote:
 This seems like a compiler bug. It's declared:
 uint maxThreads=1;

 Am I missing something?
Could it be because you run the code from constructor? Maybe it is not yet set at that point, just guessing?
Okay, must be compiler bug, just checked and it is not touched anywhere except the initialization.
Do you think you could narrow this down? Seems it's not happening for Windows users. Might as well report it if it's a real bug. Basically some testing of class member initialisers.
Okay, I do not know bug report systems, so wrote narrowed test to D.bugs. Hope it works that way too.
Oct 26 2006