Wickkiey
Wickkiey

Reputation: 4632

Get number of idle CPU counts in python windows

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

Answers (1)

Shahab Niaz
Shahab Niaz

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

Related Questions