Python - Core Speed [duplicate]
Asked Answered
C

1

7

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)

Constantin answered 19/9, 2015 at 19:48 Comment(3)
If you have a vague idea, share your code or do not ask for these first two points. It is always recommended to show what you have already tried before posting here.Dreamland
i did it some years ago, i would have to search trough all my scripts to find where and howConstantin
Not a duplicate. The question linked is asking specifically about processor name, not speed. Upvote in defiance.Chinoiserie
F
8

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

Falconer answered 19/9, 2015 at 20:15 Comment(2)
thanks Atsch, yet about the speed, the platform.processor() only returns the name not the speedConstantin
@Nightmareslnd yes, indeed. IIRC one of the lower answers shows you how to parse the system information for the frequency though.Falconer

© 2022 - 2024 — McMap. All rights reserved.