Python - Core Speed [duplicate]

痞子三分冷 提交于 2021-01-22 06:59:53

问题


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)


回答1:


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



来源:https://stackoverflow.com/questions/32672533/python-core-speed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!