Python-核心速度 [英] Python - Core Speed
问题描述
我试图找出此值存储在 windows 和 osx 中的位置,以便进行一些计算以更好地分配任务.
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.
核心速度 Hz
谢谢.
使用 platform.process()命令仅返回名称,而不返回速度
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)
推荐答案
机器ID
目前没有跨平台的python方式来获取机器ID,但是之前已经有人问过:在Windows和Windows上使用Python获取唯一的计算机IDlinux
如果只希望使用计算机名称,请使用 platform.node()
if you just want the machine name use platform.node()
multiprocessing
模块包含 multiprocessing.cpu_count()
方法
当前没有获取cpu频率的跨平台python方法,但是之前已经有人问过:在Python中获取处理器信息
There is currently no cross platform python way of getting cpu frequency, however this has been asked before: Getting processor information in Python
这篇关于Python-核心速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!