[python-win32] win32api documentation

J dreadpiratejeff at gmail.com
Mon Oct 12 17:54:33 CEST 2009


Ok... that all helped a lot.  I've been playing around with memory a
bit, and cache, and I'll poke at that some more later.  Today I've
been looking into processors.

So WMI provides Win32_Processor and from what I've read, there exists
one instance of Win32_Processor for each processor on a SMP machine.

So for starters, I assume then that if I had one such machine, I could
count all the cores simply by doing something like:

for p in c.Win32_Processor :
    procCount = procCount + 1

which makes sense.

Now that I look at it, I seem to be able to pull information based on
each core, and I can count cores.  But what about counting processor
sockets or packages?  For example,

Lets say, I do that simple loop and get a return of 16.

How do I differentiate between 16 cores, or 8 cores with
HyperThreading turned on?

Admittedly, that's more an educational curiosity.  The systems I'll be
using all this on are readily accessible, and we'll know ahead of time
that System A has 2 4-core processors and that we turned HT off in
BIOS, so we should only see 8 logical processors when we test.  Any
delta from that will fail the test.

So like I said, I was just curious if there is any built in way via
WMI or whatever to differentiate without having to go and manually
create a class based on the Windows API (because I'm not good enough
to do that kind of work).

Either way, thanks for the help so far, the WMI wrapper is pretty
cool.  I've never written system level code before, beyond
instrumenting some device drivers and services to see why they break,
so this has been pretty fun so far as a learning experience.

Cheers
Jeff



-- 

Pablo Picasso  - "Computers are useless. They can only give you
answers." - http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html


More information about the python-win32 mailing list