日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > Ubuntu >内容正文

Ubuntu

ubantu获取信息_Ubuntu 下查看CPU 信息命令

發(fā)布時(shí)間:2024/7/23 Ubuntu 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubantu获取信息_Ubuntu 下查看CPU 信息命令 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

查看當(dāng)前操作系統(tǒng)內(nèi)核信息

uname -a

Linux redcat 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010 i686 GNU/Linux

查看當(dāng)前操作系統(tǒng)發(fā)行版信息

cat /etc/issue

Ubuntu 9.10 /n /l

查看cpu型號(hào)

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

2 Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz

(看到有2個(gè)邏輯CPU, 也知道了CPU型號(hào))

查看物理cpu顆數(shù)

cat /proc/cpuinfo | grep physical | uniq -c

2 physical id : 0

(說(shuō)明實(shí)際上是1顆2核的CPU)

查看cpu運(yùn)行模式

getconf LONG_BIT

32

(說(shuō)明當(dāng)前CPU運(yùn)行在32bit模式下, 但不代表CPU不支持64bit)

查看cpu是否支持64bit

cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l

2

(結(jié)果大于0, 說(shuō)明支持64bit計(jì)算. lm指long mode, 支持lm則是64bit)

查看cpu信息概要(昨天看aix的時(shí)候剛發(fā)現(xiàn)的,在ubuntu上竟然也有~):

lscpu

Architecture: i686 #架構(gòu)686

CPU(s): 2 #邏輯cpu顆數(shù)是2

Thread(s) per core: 1 #每個(gè)核心線(xiàn)程數(shù)是1

Core(s) per socket: 2 #每個(gè)cpu插槽核數(shù)/每顆物理cpu核數(shù)是2

CPU socket(s): 1 #cpu插槽數(shù)是1

Vendor ID: GenuineIntel #cpu廠(chǎng)商ID是GenuineIntel

CPU family: 6 #cpu系列是6

Model: 23 #型號(hào)23

Stepping: 10 #步進(jìn)是10

CPU MHz: 800.000 #cpu主頻是800MHz

Virtualization: VT-x #cpu支持的虛擬化技術(shù)VT-x(對(duì)此在下一博文中解釋下http://hi.baidu.com/sdusoul/blog/item/5d8e0488def3a998a5c272c0.html)

L1d cache: 32K #一級(jí)緩存32K(google了下,這具體表示表示cpu的L1數(shù)據(jù)緩存為32k)

L1i cache: 32K #一級(jí)緩存32K(具體為L(zhǎng)1指令緩存為32K)

L2 cache: 3072K #二級(jí)緩存3072K

最后來(lái)個(gè)大而全的:

cat /proc/cpuinfo

processor : 0

vendor_id : GenuineIntel

cpu family : 6

model : 23

model name : Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz

stepping : 10

cpu MHz : 800.000

cache size : 3072 KB

physical id : 0

siblings : 2

core id : 0

cpu cores : 2

apicid : 0

initial apicid : 0

fdiv_bug : no

hlt_bug : no

f00f_bug : no

coma_bug : no

fpu : yes

fpu_exception : yes

cpuid level : 13

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida tpr_shadow vnmi flexpriority

bogomips : 4788.60

clflush size : 64

power management:

processor : 1

vendor_id : GenuineIntel

cpu family : 6

model : 23

model name : Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz

stepping : 10

cpu MHz : 800.000

cache size : 3072 KB

physical id : 0

siblings : 2

core id : 1

cpu cores : 2

apicid : 1

initial apicid : 1

fdiv_bug : no

hlt_bug : no

f00f_bug : no

coma_bug : no

fpu : yes

fpu_exception : yes

cpuid level : 13

wp : yes

flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm ida tpr_shadow vnmi flexpriority

bogomips : 4787.96

clflush size : 64

power management:

補(bǔ)充,linux下通過(guò)c獲取CPU個(gè)數(shù)信息

#include

#include

int main()

{

int cpu_num;

cpu_num = sysconf(_SC_NPROCESSORS_CONF);

printf("_SC_NPROCESSORS_CONF=%d/n",cpu_num);

cpu_num = sysconf(_SC_NPROCESSORS_ONLN);

printf("_SC_NPROCESSORS_ONLN=%d/n",cpu_num);

return 0;

}

/*

* - _SC_NPROCESSORS_CONF

* The number of processors configured.

*

* - _SC_NPROCESSORS_ONLN

* The number of processors currently online (available).

*/

Linux下獲得CPU個(gè)數(shù)一個(gè)簡(jiǎn)單方法就是查看/proc/cpuinfo文件。看出現(xiàn)processor字樣的行數(shù)是多少條,即有多少個(gè)邏輯CPU(包括多核,超線(xiàn)程)。

因此cmd下輸入下面命令即可:

cat /proc/cpuinfo | grep processor | wc -l

因此c++程序中很自然的想到使用strstr函數(shù)查找processor關(guān)鍵詞出現(xiàn)次數(shù)即可。

總結(jié)

以上是生活随笔為你收集整理的ubantu获取信息_Ubuntu 下查看CPU 信息命令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。