Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^2: Finding CPU stats on Win32?

by guice (Scribe)
on Apr 15, 2005 at 20:13 UTC ( #448332=note: print w/replies, xml ) Need Help??

in reply to Re: Finding CPU stats on Win32?
in thread Finding CPU stats on Win32?

Wow nice! Now if I can only find out if there's a way to view if Hyperthreading it turned on/off or possible...

-- philip
We put the 'K' in kwality!

Replies are listed 'Best First'.
Re^3: Finding CPU stats on Win32?
by BrowserUk (Patriarch) on Apr 15, 2005 at 22:33 UTC

    Detecting hyperthreading has to be done from assembler, and I'm not aware of any Win32 API that provides that information. There is an article on the Intel website that explains the intracacies.

    Update: Here's an implementation in D. It should be trivial to convert to C.

    import; import std.stdio; void main ( ) { int ht_supported = 0; int cores_per_socket = 1; asm{ mov EAX, 0; cpuid; test EAX, 0x10000000; jz NO_HYPER; mov ht_supported, 1; mov EAX, 4; cpuid; and EAX, 0xfc000000; shr EAX, 26; add EAX, 1; mov cores_per_socket, EAX; NO_HYPER:; }; if( ht_supported ) { printf( "Hyperthreading is supported and there are %d cores pe +r cpu\n", cores_per_socket ); } else { printf( "Hyperthreading is not supported on this processor\n" +); } }

    Update2: I also turned up this quite comprehensive cpu features detector sample on MSDN

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://448332]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2022-08-15 06:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found