2010-03-10 108 views

回答

5

读取伪文件/proc/cpuinfo。请参阅this link以了解其中包含的字段的解释。

+2

但是,这不是当前的CPU速度。或者不总是。 – 2010-03-10 17:17:18

+0

您的链接已关闭。 – qdii 2011-12-22 19:26:29

+0

有新链接。对于RHEL 4,解释请参见[参考指南](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Reference_Guide/s2-proc-cpuinfo.html)。对于RHEL 6,解释位于[部署指南](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-proc-cpuinfo.html) – Jaime 2017-09-16 17:01:55

1

该信息在sysfs中可用。特别是,请查看scaling_cur_freqcpuinfo_cur_freq/sys/devices/system/cpu/cpu*/cpufreq

+0

不是虚拟的机器 – 2013-01-16 12:49:42

1

当我有一台Compaq Athlon64笔记本电脑时,它的/ proc/cpuinfo总是报告它的最大速度。

我只从/sys/devices/system/cpu/*/cpufreq的文件中获得可靠的当前频率数字。

我想你的里程可能会有所不同。

1

尝试执行命令lscpu

+0

嗯,主题陈述“在C++”。 – qdii 2011-12-22 19:27:20