Search code examples
pythoncpucpu-speedcpu-cores

Python - Core Speed


I'm trying to find out where this value is stored in both windows and osx, in order to do some calculations to make a better task distribution.

Core speed in Hz

Thanks in advance.

Using the platform.process() command only returns the name not the speed

I only managed to get it trough this:

import subprocess  
info=subprocess.check_output(["wmic","cpu","get", "name"])  
print info.split('@')[1].split(' ')[1]

But for the moment i have no way to tell if it will always return the same result in every machine (no access to other computers right now)


Solution

  • Machine ID

    There is currently no cross platform python way of getting a Machine ID, however this has been asked before: Get a unique computer ID in Python on windows and linux

    if you just want the machine name use platform.node()

    Number of cores

    The multiprocessing module contains the multiprocessing.cpu_count() method

    Cores speed in Hz

    There is currently no cross platform python way of getting cpu frequency, however this has been asked before: Getting processor information in Python