linux命令 lscpu详解
引言:今天的命令是用来看cpu信息的lscpu
lscpu
我们先看man lscpu
display information about the CPU architecture 翻译:显示cpu架构信息
具体的描述如下:
lscpu gathers CPU architecture information from sysfs, /proc/cpuinfo and any applicable architecture-specific libraries (e.g. librtas on Powerpc). The command output can be optimized for parsing or for easy readability by humans. The information includes, for example, the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes. There is also information about the CPU caches and cache sharing, family, model, bogoMIPS, byte order, and stepping. In virtualized environments, the CPU architecture information dis‐ played reflects the configuration of the guest operating system which is typically different from the physical (host) system. On architec‐ tures that support retrieving physical topology information, lscpu also displays the number of physical sockets, chips, cores in the host system. Options that result in an output table have a list argument. Use this argument to customize the command output. Specify a comma-sepa‐ rated list of column labels to limit the output table to only the specified columns, arranged in the specified order. See COLUMNS for a list of valid column labels. The column labels are not case sensi‐ tive. Not all columns are supported on all architectures. If an unsup‐ ported column is specified, lscpu prints the column but does not pro‐ vide any data for it. 翻译如下:
lscpu命令从sysfs、/proc/cpuinfo、或者某些适用于特定架构的库中收集数据。命令的输出会以人类易读的方式展示如下信息:cpu、线程、核心、插槽和Non-Uniform MemoryAccess (NUMA)节点的数量,也有cpu共享缓存,cpu的族号,运行模式,处理指令的速度,大小端,步进等信息
在虚拟环境下,系统架构信息展示映射着客户操作系统的设置,这和物理主机是有明显差异的。在架构上支持检索物理拓扑信息,lscpu命令也显示主机系统中的物理插槽数量,芯片,内核数。
Options可以提供一些参数,用这些参数可以自定义命令输出。指定一个列表分隔符,指定一个逗号分隔的列标签列表,以将输出表限制为按指定的顺序排列的指定的列。按指定顺序排列。 有效列标签请参考COLUMNS的列表。列标签不区分大小写。(man的输出中有各种参数太多这里就不放出来了。可以自己去查看)
我们再来看一下命令执行结果
Architecture: x86_64 //架构--这里的64指的位处理器 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian //小端法 CPU(s): 4 //cpu数量 On-line CPU(s) list: 0-3 //在线的cpu数量 有些时候为了省电或者过热的时候,某些CPU会停止运行 Thread(s) per core: 1 //每个核心的线程数 Core(s) per socket: 4 //每个插槽上有几个核心 座: 1 NUMA 节点: 1 //NUMA 这个太复杂,所以他的解释在下面 厂商 ID: GenuineIntel CPU 系列: 6 型号: 94 型号名称: Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz 步进: 3 //这个可以简单理解为版本号 也有A0这样的标识方式 CPU MHz: 900.023 CPU max MHz: 3700.0000 CPU min MHz: 800.0000 BogoMIPS: 6624.00 // MIPS是每秒百万条指令,Bogo是Bogus(伪)的意思,这里是估算MIPS值 虚拟化: VT-x //虚拟化技术,这个我不太懂,不敢乱说 L1d 缓存: 32K //一级高速缓存 dcache 用来存储数据 L1i 缓存: 32K //一级高速缓存 icache 用来存储指令 L2 缓存: 256K L3 缓存: 8192K //缓存速度上 L1 > L2 > L3 > DDR(内存) 内存的理论速度在几十g一秒 NUMA 节点0 CPU: 0-3 //四个cpu在一个numa节点上 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb invpcid_single intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp //Flags是标识了一些cpu的特征 具体可以查看https://blog.csdn.net/nemo2011/article/details/7531212 man中还有更多的描述,对大家来说意义也不大,接下来我们直接看选项了
选项: -a, --all 同时打印在线和离线 CPU (-e 选项默认值) 此选项只能与选项-e 或-p 一起指定 -b, --online 只打印在线 CPU (-p 选项默认值) 此选项只能与选项-e 或-p 一起指定 -c, --offline 只打印离线 CPU 此选项只能与选项-e 或-p 一起指定。 -e, --extended[=<列表>] 打印扩展的可读格式 (类似表格的形式) 如果省略该列表参数, 则在命令输出中包括所有可用数据的列 指定列表参数时, 选项字符串、等号 (=) 和列表不能包含任何空格或其他空白。 结果如下: CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ 0 0 0 0 0:0:0:0 是 3700.0000 800.0000 1 0 0 1 1:1:1:0 是 3700.0000 800.0000 2 0 0 2 2:2:2:0 是 3700.0000 800.0000 3 0 0 3 3:3:3:0 是 3700.0000 800.0000 带list示例: lscpu -e=cpu,node -p, --parse[=<列表&g
