How can I check nbr of cores of computer?

alex.gaynor at gmail.com alex.gaynor at gmail.com
Wed Jul 30 04:12:15 CEST 2008


On Jul 29, 7:44 pm, Mensanator <mensana... at aol.com> wrote:
> On Jul 29, 5:53 pm, defn noob <circularf... at yahoo.se> wrote:
>
> > How can I check how many cores my computer has?
> > Is it possible to do this in a Python-app?
>
> If you're using Windows, get PyWin32:
>
> win32api.GetSystemInfo
> tuple = GetSystemInfo()
>
> Retrieves information about the current system.
>
> Win32 API References
>
> Search for GetSystemInfo at msdn, google or google groups.
>
> Return Value
> The return value is a tuple of 9 values,
> which corresponds to the Win32 SYSTEM_INFO structure.
> The element names are:
> dwOemId
> dwPageSize
> lpMinimumApplicationAddress
> lpMaximumApplicationAddress
> dwActiveProcessorMask
> dwNumberOfProcessors
> dwProcessorType
> dwAllocationGranularity
> (wProcessorLevel,wProcessorRevision)
>
> >>> import win32api
> >>> win32api.GetSystemInfo()
>
> (0, 4096, 65536, 2147418111, 3L, 2, 586, 65536, (6, 3846))
>                                  |
>                                  processors

This: http://pyprocessing.berlios.de/ has a method that returns CPU
count.



More information about the Python-list mailing list