Reputation: 4632
In multi-threading programming, wanted to start threads only according to number to idle CPUs available.
How can I get number of idle CPUs in python windows.
In linux
import os
os.getloadavg()
seems helpful.
Is that anyway to get in python on windows env ?
Thanks in advance.
Upvotes: 1
Views: 423
Reputation: 168
This works for python with a version >= 2.6
import multiprocessing
multiprocessing.cpu_count()
http://docs.python.org/library/multiprocessing.html#multiprocessing.cpu_count
Upvotes: 0