CPU信息查看的工具


背景

信创国产化如火如荼.
CPU的型号其实越来越多
lscpu出来的结果其实太抽象, 对CPU的缓存架构显示不充分
今天在看大佬的文章是看到了一个工具:
hwloc
感觉非常优秀.
想学习一下
https://plantegg.github.io/2023/12/23/几款不同的CPU一些数据--备查5/

第一步安装

yum install hwloc* -y 
注意于原文不太一样, 显示图片需要安装gui组件. 
另外这个软件包 base 包里面就有 安装还是比较简单的.

简单使用

lstopo
部分参数介绍

*PU P#*是处理单元处理器# - 这些是CPU核心内的处理元素,从图片中我们可以看到4个核心,每个核心有2个处理元素(超线程),总共有8个,但实际是4个。

L#i代表指令高速缓存。
L#d代表数据高速缓存。
L1代表1级缓存。
L2代表第2级高速缓存。
L3代表三级缓存。


链接:

可以使用 lstopo zhaobsh.png 直接转储成图片.

查看内存信息

dmidecode -t memory

其实可以如下处理:
dmidecode -t
dmidecode: option requires an argument -- 't'
Type number or keyword expected
Valid type keywords are:
  bios
  system
  baseboard
  chassis
  processor
  memory
  cache
  connector
  slot

其实可以根据类型进行查看
比如dmidecode -t cache 

查看缓存等信息

查看帮助

lstopo --help
Usage: lstopo [ options ] ... [ filename.format ]

See lstopo(1) for more details.

Default output is graphical (X11) if DISPLAY is set, console otherwise.
Supported output file formats: console, ascii, fig, pdf, ps, png, svg, xml, synthetic

Formatting options:
  -l --logical          Display hwloc logical object indexes
                        (default for console output)
  -p --physical         Display physical object indexes
                        (default for graphical output)
Output options:
  --output-format <format>
  --of <format>         Force the output to use the given format
  -f --force            Overwrite the output file if it exists
Textual output options:
  --only <type>         Only show objects of the given type in the textual output
  -v --verbose          Include additional details
  -s --silent           Reduce the amount of details to show
  -c --cpuset           Show the cpuset of each object
  -C --cpuset-only      Only show the cpuset of each object
  --taskset             Show taskset-specific cpuset strings
Object filtering options:
  --ignore <type>       Ignore objects of the given type
  --no-caches           Do not show caches
  --no-useless-caches   Do not show caches which do not have a hierarchical
                        impact
  --no-icaches          Do not show instruction caches
  --merge               Do not show levels that do not have a hierarchical
                        impact
  --no-collapse         Do not collapse identical PCI devices
  --restrict <cpuset>   Restrict the topology to processors listed in <cpuset>
  --restrict binding    Restrict the topology to the current process binding
  --restrict-flags <n>  Set the flags to be used during restrict
  --no-io               Do not show any I/O device or bridge
  --no-bridges          Do not any I/O bridge except hostbridges
  --whole-io            Show all I/O devices and bridges
Input options:
  --input <XML file>
  -i <XML file>         Read topology from XML file <path>
  --input <directory>
  -i <directory>        Read topology from chroot containing the /proc and /sys
                        of another system
  --input "node:2 2"
  -i "node:2 2"         Simulate a fake hierarchy, here with 2 NUMA nodes of 2
                        processors
  --input-format <format>
  --if <format>         Enforce input format among xml, fsroot, synthetic
  --thissystem          Assume that the input topology provides the topology
                        for the system on which we are running
  --pid <pid>           Detect topology as seen by process <pid>
  --whole-system        Do not consider administration limitations
Graphical output options:
  --fontsize 10         Set size of text font
  --gridsize 10         Set size of margin between elements
  --horiz[=<type,...>]  Horizontal graphical layout instead of nearly 4/3 ratio
  --vert[=<type,...>]   Vertical graphical layout instead of nearly 4/3 ratio
  --rect[=<type,...>]   Rectangular graphical layout with nearly 4/3 ratio
  --index=[<type,...>]  Display indexes for the given object types
  --no-index=[<type,.>] Do not display indexes for the given object types
  --attrs=[<type,...>]  Display attributes for the given object types
  --no-attrs=[<type,.>] Do not display attributes for the given object types
  --no-legend           Remove the text legend at the bottom
  --append-legend <s>   Append a new line of text at the bottom of the legend
Miscellaneous options:
  --export-synthetic-flags <n>
                        Set flags during the synthetic topology export
  --ps --top            Display processes within the hierarchy
  --version             Report version and exit

简单效果为:

CPU信息查看的工具_ide