C/C++教程

有用的几个得到cpu信息的命令

本文主要是介绍有用的几个得到cpu信息的命令,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

前言:

intel 系列(Family Code)指的是处理器家族
intel现在一共有7个:
0=8086/8088 processor
2=Intel 286 processor
3=Intel386(TM) family processor
4=Intel486(TM) family processor
5=Pentium(R) family processor
6=P6 family of processors 
F=Pentium 4 family of processors

 


/proc/cpuinfo 输出中的flgs解释,详细请看: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/include/asm/cpufeatures.h
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_CPUFEATURES_H #define _ASM_X86_CPUFEATURES_H #ifndef _ASM_X86_REQUIRED_FEATURES_H #include <asm/required-features.h> #endif #ifndef _ASM_X86_DISABLED_FEATURES_H #include <asm/disabled-features.h> #endif /* * Defines x86 CPU feature bits */ #define NCAPINTS 20 /* N 32-bit words worth of info */ #define NBUGINTS 1 /* N 32-bit bug flags */ /* * Note: If the comment begins with a quoted string, that string is used * in /proc/cpuinfo instead of the macro name. If the string is "", * this feature bit is not displayed in /proc/cpuinfo at all. * * When adding new features here that depend on other features, * please update the table in kernel/cpu/cpuid-deps.c as well. */ /* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */ #define X86_FEATURE_FPU ( 0*32+ 0) /* Onboard FPU */
//FPU:(Float Point Unit,浮点运算单元)FPU是专用于浮点运算的处理器,以前的FPU是一种单独芯片,在486之后,英特尔把FPU集成在CPU之内。
#define X86_FEATURE_VME            ( 0*32+ 1) /* Virtual Mode Extensions */ 
//vme是通用的总线,它定义了一个在紧密耦合(closely coupled)硬件构架中可进行互连数据处理、数据存储和连接外围控制器件的系统
#define X86_FEATURE_DE            ( 0*32+ 2) /* Debugging Extensions */
#define X86_FEATURE_PSE            ( 0*32+ 3) /* Page Size Extensions */
#define X86_FEATURE_TSC            ( 0*32+ 4) /* Time Stamp Counter */
//TSC即(Time Stamp Counter或Time Source Cycles),在80x86微处理器中,有一个CLK输入引线接收外部振荡器的时钟信号。TSC在每个时钟信号到来时加1.
TSC是一个64位的时间戳计数器寄存器,汇编指令rdtsc读这个寄存器。linux系统启动时会初始化tsc时钟源
#define X86_FEATURE_MSR            ( 0*32+ 5) /* Model-Specific Registers */
//MSR是CPU的一组64位寄存器,可以分别通过RDMSR和WRMSR 两条指令进行读和写的操作,前提要在ECX中写入MSR的地址
#define X86_FEATURE_PAE            ( 0*32+ 6) /* Physical Address Extensions */
//物理地址扩展(PAE)是一种将计算机内存(包括随机存取内存(RAM)和所有其他虚拟内存)转换为通用系统内存的方法
#define X86_FEATURE_MCE            ( 0*32+ 7) /* Machine Check Exception */
//MCE(Machine Check Exception)是由CPU侦测出来的错误,它错误包含两种主要类型:notice(提示)/warning(警告),和fatal exception(致命性的错误)
#define X86_FEATURE_CX8            ( 0*32+ 8) /* CMPXCHG8 instruction */
#define X86_FEATURE_APIC        ( 0*32+ 9) /* Onboard APIC */高级可编程中断控制器
#define X86_FEATURE_SEP            ( 0*32+11) /* SYSENTER/SYSEXIT */
//SYSENTER和SYSEXIT指令是从Pentium II开始新加入到IA32位架构中来的。这两个指令在处理器上是否有效要看CPUID指令返回的EDX寄存器中SEP标记(SYSENTER/SYSEXIT存在标记)是否置上
#define X86_FEATURE_MTRR        ( 0*32+12) /* Memory Type Range Registers */
//存储器型态范围寄存器(MemoryTypeRangeRegisters)
//,现在的CPU使用MSR机制的MTRR允许在物理内存中定义96个内存范围(不同CPU可能不一样)
//跟内存还有关的有
存储器缓冲寄存器(Memorybufferregister)
存储器数据寄存器(Memorydataregister)
存储器地址寄存器(Memoryaddressregister)
#define X86_FEATURE_PGE            ( 0*32+13) /* Page Global Enable */ 
//支持全局页面启用
#define X86_FEATURE_MCA            ( 0*32+14) /* Machine Check Architecture */
//机制用来对服务器硬件进行自检,并在发现硬件错误的时候发出中断或异常
Intel在Xeon,Atom,P6等中,都开始支持MCA特性。
通过MCA,系统可以探测硬件错误,如系统总线错误,ECC错误,奇偶校验错误,cache错误,TLB错误等。
#define X86_FEATURE_CMOV        ( 0*32+15) /* CMOV instructions (plus FCMOVcc, FCOMI with FPU) */
#define X86_FEATURE_PAT            ( 0*32+16) /* Page Attribute Table 页面属性表,X86的页面属性表(PAT)能够在页面级的粒度上设置内存属性*/
#define X86_FEATURE_PSE36        ( 0*32+17) /* 36-bit PSEs  */
#define X86_FEATURE_PN            ( 0*32+18) /* Processor serial number 处理器序列号*/
//作用相当于处理器和系统的标识符
#define X86_FEATURE_CLFLUSH        ( 0*32+19) /* CLFLUSH instruction */ //CLFLUSH指令(instruction指令的意思)
#define X86_FEATURE_DS            ( 0*32+21) /* "dts" Debug Store */
#define X86_FEATURE_ACPI        ( 0*32+22) /* ACPI via MSR */
//MSR(Model Specific Register)是x86架构中的概念,指的是在x86架构处理器中,一系列用于控制CPU运行、功能开关、调试、跟踪程序执行、监测CPU性能等方面的寄存器
MSR是“Model Specific Registers” (直译为”模型特定寄存器“)的缩写
MSR是CPU的一组64位寄存器,可以分别通过RDMSR和WRMSR 两条指令进行读和写的操作,前提要在ECX中写入MSR的地址
 使用rdmsr读取到的64比特数据分别放到edx和eax (分别为高低32比特)
#define X86_FEATURE_MMX            ( 0*32+23) /* Multimedia Extensions  多媒体扩展*/
#define X86_FEATURE_FXSR        ( 0*32+24) /* FXSAVE/FXRSTOR, CR4.OSFXSR */
#define X86_FEATURE_XMM            ( 0*32+25) /* "sse" */
#define X86_FEATURE_XMM2        ( 0*32+26) /* "sse2" */
//SSE2(Streaming SIMD Extensions 2,Intel官方称为单指令多数据流技术扩展 2或单指令多数据流扩展指令集 2)指令集是Intel公司在SSE指令集的基础上发展起来的。
#define X86_FEATURE_SELFSNOOP        ( 0*32+27) /* "ss" CPU self snoop */
#define X86_FEATURE_HT            ( 0*32+28) /* Hyper-Threading */
#define X86_FEATURE_ACC            ( 0*32+29) /* "tm" Automatic clock control */
#define X86_FEATURE_IA64        ( 0*32+30) /* IA-64 processor */
#define X86_FEATURE_PBE            ( 0*32+31) /* Pending Break Enable */

/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
/* Don't duplicate feature flags which are redundant with Intel! */
#define X86_FEATURE_SYSCALL        ( 1*32+11) /* SYSCALL/SYSRET  */ //cpu syscall指令
#define X86_FEATURE_MP            ( 1*32+19) /* MP Capable */
#define X86_FEATURE_NX            ( 1*32+20) /* Execute Disable */
//NX(CPU的一种技术) NX,全名为“No eXecute”,即「禁止执行」,是套用在CPU的一种技术,用作把记忆体区域分隔为只供储存处理器指令集,或只供数据使用
#define X86_FEATURE_MMXEXT        ( 1*32+22) /* AMD MMX extensions */
//MMX是一个多媒体指令集,是整合在CPU内部的方便CPU调用的指令集
#define X86_FEATURE_FXSR_OPT        ( 1*32+25) /* FXSAVE/FXRSTOR optimizations */
#define X86_FEATURE_GBPAGES        ( 1*32+26) /* "pdpe1gb" GB pages */
#define X86_FEATURE_RDTSCP        ( 1*32+27) /* RDTSCP */
#define X86_FEATURE_LM            ( 1*32+29) /* Long Mode (x86-64, 64-bit support) */
#define X86_FEATURE_3DNOWEXT        ( 1*32+30) /* AMD 3DNow extensions */
#define X86_FEATURE_3DNOW        ( 1*32+31) /* 3DNow */

/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */
#define X86_FEATURE_RECOVERY        ( 2*32+ 0) /* CPU in recovery mode */
//cpu复位模式, CPU归位是windows的一个省电策略,即windows会关掉它自己认为当前不需要用到的CPU核心,以便达到最低功耗
#define X86_FEATURE_LONGRUN        ( 2*32+ 1) /* Longrun power control  //术语节能技术*/
//被用来降低芯片整体功耗,减少待机功耗,减少burn-in功耗,并且提升芯片潜在性能,降低生产成本
#define X86_FEATURE_LRTI        ( 2*32+ 3) /* LongRun table interface */
/* Other features, Linux-defined mapping, word 3 */
/* This range is used for feature bits which conflict or are synthesized */
#define X86_FEATURE_CXMMX        ( 3*32+ 0) /* Cyrix MMX extensions */
#define X86_FEATURE_K6_MTRR        ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */
#define X86_FEATURE_CYRIX_ARR        ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */
#define X86_FEATURE_CENTAUR_MCR        ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */

/* CPU types for specific tunings:  安装调试*/
#define X86_FEATURE_K8            ( 3*32+ 4) /* "" Opteron, Athlon64 */
/* FREE, was #define X86_FEATURE_K7            ( 3*32+ 5) "" Athlon */
#define X86_FEATURE_P3            ( 3*32+ 6) /* "" P3 */
#define X86_FEATURE_P4            ( 3*32+ 7) /* "" P4 */
#define X86_FEATURE_CONSTANT_TSC    ( 3*32+ 8) /* TSC ticks at a constant rate */
#define X86_FEATURE_UP            ( 3*32+ 9) /* SMP kernel running on UP */ 
//对称多处理器. 顾名思义, 在SMP中所有的处理器都是对等的, 它们通过总线连接共享同一块物理内存,这也就导致了系统中所有资源(CPU、内存、I/O等)都是共享的
#define X86_FEATURE_ART            ( 3*32+10) /* Always running timer (ART) */  //ART加速器
#define X86_FEATURE_ARCH_PERFMON    ( 3*32+11) /* Intel Architectural PerfMon */  //性能监视器
#define X86_FEATURE_PEBS        ( 3*32+12) /* Precise-Event Based Sampling */ 
//可以使用intel的Precise Event-Based Sampling (PEBS)机制,采集cache读写地址信息,获取RTH(sampled reuse time histogram),进而获取缓存的MRC模型
//http://hpctest.cs.tsinghua.edu.cn/papers/tc11.pdf
#define X86_FEATURE_BTS            ( 3*32+13) /* Branch Trace Store */
//Branch Trace Store(BTS)是目前广泛被intel CPU所提供的一种硬件辅助调试功能
#define X86_FEATURE_SYSCALL32        ( 3*32+14) /* "" syscall in IA32 userspace */
#define X86_FEATURE_SYSENTER32        ( 3*32+15) /* "" sysenter in IA32 userspace */
//intel 32位架构(英语:Intel Architecture, 32-bit,缩写为IA-32)
#define X86_FEATURE_REP_GOOD        ( 3*32+16) /* REP microcode works well */

/* FREE!                                ( 3*32+17) */
#define X86_FEATURE_LFENCE_RDTSC    ( 3*32+18) /* "" LFENCE synchronizes RDTSC */
//rdtsc指令, 该指令返回CPU自启动以来的时钟周期数
#define X86_FEATURE_ACC_POWER        ( 3*32+19) /* AMD Accumulated Power Mechanism */
#define X86_FEATURE_NOPL        ( 3*32+20) /* The NOPL (0F 1F) instructions */
//https://stackoverflow.com/questions/12559475/what-does-nopl-do-in-x86-system
#define X86_FEATURE_ALWAYS        ( 3*32+21) /* "" Always-present feature */
#define X86_FEATURE_XTOPOLOGY        ( 3*32+22) /* CPU topology enum extensions */
#define X86_FEATURE_TSC_RELIABLE    ( 3*32+23) /* TSC is known to be reliable */
#define X86_FEATURE_NONSTOP_TSC        ( 3*32+24) /* TSC does not stop in C states */
#define X86_FEATURE_CPUID        ( 3*32+25) /* CPU has CPUID instruction itself */
#define X86_FEATURE_EXTD_APICID        ( 3*32+26) /* Extended APICID (8 bits) */
#define X86_FEATURE_AMD_DCM        ( 3*32+27) /* AMD multi-node processor */
#define X86_FEATURE_APERFMPERF        ( 3*32+28) /* P-State hardware coordination feedback capability (APERF/MPERF MSRs) */
#define X86_FEATURE_RAPL        ( 3*32+29) /* AMD/Hygon RAPL interface */
#define X86_FEATURE_NONSTOP_TSC_S3    ( 3*32+30) /* TSC doesn't stop in S3 state */
#define X86_FEATURE_TSC_KNOWN_FREQ    ( 3*32+31) /* TSC has known frequency */

/* Intel-defined CPU features, CPUID level 0x00000001 (ECX), word 4  针对ECX寄存器(数据寄存器) */
#define X86_FEATURE_XMM3        ( 4*32+ 0) /* "pni" SSE-3 */
//SSE3 指令集(pni是以前的总称)
#define X86_FEATURE_PCLMULQDQ        ( 4*32+ 1) /* PCLMULQDQ instruction 指令集*/
#define X86_FEATURE_DTES64        ( 4*32+ 2) /* 64-bit Debug Store */
#define X86_FEATURE_MWAIT        ( 4*32+ 3) /* "monitor" MONITOR/MWAIT support */
#define X86_FEATURE_DSCPL        ( 4*32+ 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */
#define X86_FEATURE_VMX            ( 4*32+ 5) /* Hardware virtualization */
#define X86_FEATURE_SMX            ( 4*32+ 6) /* Safer Mode eXtensions */
#define X86_FEATURE_EST            ( 4*32+ 7) /* Enhanced SpeedStep */
#define X86_FEATURE_TM2            ( 4*32+ 8) /* Thermal Monitor 2 */
#define X86_FEATURE_SSSE3        ( 4*32+ 9) /* Supplemental SSE-3 */
#define X86_FEATURE_CID            ( 4*32+10) /* Context ID */
#define X86_FEATURE_SDBG        ( 4*32+11) /* Silicon Debug */
#define X86_FEATURE_FMA            ( 4*32+12) /* Fused multiply-add */
#define X86_FEATURE_CX16        ( 4*32+13) /* CMPXCHG16B instruction */
#define X86_FEATURE_XTPR        ( 4*32+14) /* Send Task Priority Messages */
#define X86_FEATURE_PDCM        ( 4*32+15) /* Perf/Debug Capabilities MSR */
#define X86_FEATURE_PCID        ( 4*32+17) /* Process Context Identifiers */
#define X86_FEATURE_DCA            ( 4*32+18) /* Direct Cache Access */
#define X86_FEATURE_XMM4_1        ( 4*32+19) /* "sse4_1" SSE-4.1 */
#define X86_FEATURE_XMM4_2        ( 4*32+20) /* "sse4_2" SSE-4.2 */
#define X86_FEATURE_X2APIC        ( 4*32+21) /* X2APIC */
#define X86_FEATURE_MOVBE        ( 4*32+22) /* MOVBE instruction */
#define X86_FEATURE_POPCNT        ( 4*32+23) /* POPCNT instruction */
#define X86_FEATURE_TSC_DEADLINE_TIMER    ( 4*32+24) /* TSC deadline timer */
#define X86_FEATURE_AES            ( 4*32+25) /* AES instructions */
#define X86_FEATURE_XSAVE        ( 4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV instructions */
#define X86_FEATURE_OSXSAVE        ( 4*32+27) /* "" XSAVE instruction enabled in the OS */
#define X86_FEATURE_AVX            ( 4*32+28) /* Advanced Vector Extensions */
#define X86_FEATURE_F16C        ( 4*32+29) /* 16-bit FP conversions */
#define X86_FEATURE_RDRAND        ( 4*32+30) /* RDRAND instruction */
#define X86_FEATURE_HYPERVISOR        ( 4*32+31) /* Running on a hypervisor */

/* VIA(威盛)/Cyrix(廉价的cpu)/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
#define X86_FEATURE_XSTORE        ( 5*32+ 2) /* "rng" RNG present (xstore) */
#define X86_FEATURE_XSTORE_EN        ( 5*32+ 3) /* "rng_en" RNG enabled */
#define X86_FEATURE_XCRYPT        ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */
#define X86_FEATURE_XCRYPT_EN        ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */
#define X86_FEATURE_ACE2        ( 5*32+ 8) /* Advanced Cryptography Engine v2 */
#define X86_FEATURE_ACE2_EN        ( 5*32+ 9) /* ACE v2 enabled */
#define X86_FEATURE_PHE            ( 5*32+10) /* PadLock Hash Engine */
#define X86_FEATURE_PHE_EN        ( 5*32+11) /* PHE enabled */
#define X86_FEATURE_PMM            ( 5*32+12) /* PadLock Montgomery Multiplier */
#define X86_FEATURE_PMM_EN        ( 5*32+13) /* PMM enabled */

/* More extended AMD flags: CPUID level 0x80000001, ECX, word 6  ECX寄存器*/
#define X86_FEATURE_LAHF_LM        ( 6*32+ 0) /* LAHF/SAHF in long mode */
#define X86_FEATURE_CMP_LEGACY        ( 6*32+ 1) /* If yes HyperThreading not valid */
#define X86_FEATURE_SVM            ( 6*32+ 2) /* Secure Virtual Machine */
#define X86_FEATURE_EXTAPIC        ( 6*32+ 3) /* Extended APIC space */
#define X86_FEATURE_CR8_LEGACY        ( 6*32+ 4) /* CR8 in 32-bit mode */
#define X86_FEATURE_ABM            ( 6*32+ 5) /* Advanced bit manipulation */
#define X86_FEATURE_SSE4A        ( 6*32+ 6) /* SSE-4A */
#define X86_FEATURE_MISALIGNSSE        ( 6*32+ 7) /* Misaligned SSE mode */
#define X86_FEATURE_3DNOWPREFETCH    ( 6*32+ 8) /* 3DNow prefetch instructions */
#define X86_FEATURE_OSVW        ( 6*32+ 9) /* OS Visible Workaround */
#define X86_FEATURE_IBS            ( 6*32+10) /* Instruction Based Sampling */
#define X86_FEATURE_XOP            ( 6*32+11) /* extended AVX instructions */
#define X86_FEATURE_SKINIT        ( 6*32+12) /* SKINIT/STGI instructions */
#define X86_FEATURE_WDT            ( 6*32+13) /* Watchdog timer */
#define X86_FEATURE_LWP            ( 6*32+15) /* Light Weight Profiling */
#define X86_FEATURE_FMA4        ( 6*32+16) /* 4 operands MAC instructions */
#define X86_FEATURE_TCE            ( 6*32+17) /* Translation Cache Extension */
#define X86_FEATURE_NODEID_MSR        ( 6*32+19) /* NodeId MSR */
#define X86_FEATURE_TBM            ( 6*32+21) /* Trailing Bit Manipulations */
#define X86_FEATURE_TOPOEXT        ( 6*32+22) /* Topology extensions CPUID leafs */
#define X86_FEATURE_PERFCTR_CORE    ( 6*32+23) /* Core performance counter extensions */
#define X86_FEATURE_PERFCTR_NB        ( 6*32+24) /* NB performance counter extensions */
#define X86_FEATURE_BPEXT        ( 6*32+26) /* Data breakpoint extension */
#define X86_FEATURE_PTSC        ( 6*32+27) /* Performance time-stamp counter */
#define X86_FEATURE_PERFCTR_LLC        ( 6*32+28) /* Last Level Cache performance counter extensions */
#define X86_FEATURE_MWAITX        ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX instructions) */

/*
 * Auxiliary flags: Linux defined - For features scattered in various
   辅助的特性标识:  linux 已定义的 - 分散在不同寄存器的功能
 * CPUID levels like 0x6, 0xA etc, word 7.
 * 
 * Reuse free bits when adding new feature flags!
 */
#define X86_FEATURE_RING3MWAIT        ( 7*32+ 0) /* Ring 3 MONITOR/MWAIT instructions */
#define X86_FEATURE_CPUID_FAULT        ( 7*32+ 1) /* Intel CPUID faulting */
#define X86_FEATURE_CPB            ( 7*32+ 2) /* AMD Core Performance Boost */
#define X86_FEATURE_EPB            ( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
#define X86_FEATURE_CAT_L3        ( 7*32+ 4) /* Cache Allocation Technology L3 */
#define X86_FEATURE_CAT_L2        ( 7*32+ 5) /* Cache Allocation Technology L2 */
#define X86_FEATURE_CDP_L3        ( 7*32+ 6) /* Code and Data Prioritization L3 */
#define X86_FEATURE_INVPCID_SINGLE    ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */
#define X86_FEATURE_HW_PSTATE        ( 7*32+ 8) /* AMD HW-PState */
#define X86_FEATURE_PROC_FEEDBACK    ( 7*32+ 9) /* AMD ProcFeedbackInterface */
/* FREE!                                ( 7*32+10) */
#define X86_FEATURE_PTI            ( 7*32+11) /* Kernel Page Table Isolation enabled */
#define X86_FEATURE_RETPOLINE        ( 7*32+12) /* "" Generic Retpoline mitigation for Spectre variant 2 */
#define X86_FEATURE_RETPOLINE_LFENCE    ( 7*32+13) /* "" Use LFENCE for Spectre variant 2 */
#define X86_FEATURE_INTEL_PPIN        ( 7*32+14) /* Intel Processor Inventory Number */
#define X86_FEATURE_CDP_L2        ( 7*32+15) /* Code and Data Prioritization L2 */
#define X86_FEATURE_MSR_SPEC_CTRL    ( 7*32+16) /* "" MSR SPEC_CTRL is implemented */
#define X86_FEATURE_SSBD        ( 7*32+17) /* Speculative Store Bypass Disable */
#define X86_FEATURE_MBA            ( 7*32+18) /* Memory Bandwidth Allocation */
#define X86_FEATURE_RSB_CTXSW        ( 7*32+19) /* "" Fill RSB on context switches */
/* FREE!                                ( 7*32+20) */
#define X86_FEATURE_USE_IBPB        ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */
#define X86_FEATURE_USE_IBRS_FW        ( 7*32+22) /* "" Use IBRS during runtime firmware calls */
#define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE    ( 7*32+23) /* "" Disable Speculative Store Bypass. */
#define X86_FEATURE_LS_CFG_SSBD        ( 7*32+24)  /* "" AMD SSBD implementation via LS_CFG MSR */
#define X86_FEATURE_IBRS        ( 7*32+25) /* Indirect Branch Restricted Speculation */
#define X86_FEATURE_IBPB        ( 7*32+26) /* Indirect Branch Prediction Barrier */
#define X86_FEATURE_STIBP        ( 7*32+27) /* Single Thread Indirect Branch Predictors */
#define X86_FEATURE_ZEN            ( 7*32+28) /* "" CPU is AMD family 0x17 or above (Zen) */
#define X86_FEATURE_L1TF_PTEINV        ( 7*32+29) /* "" L1TF workaround PTE inversion */
#define X86_FEATURE_IBRS_ENHANCED    ( 7*32+30) /* Enhanced IBRS */
#define X86_FEATURE_MSR_IA32_FEAT_CTL    ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */

/* Virtualization flags: Linux defined, word 8 */
#define X86_FEATURE_TPR_SHADOW        ( 8*32+ 0) /* Intel TPR Shadow */
#define X86_FEATURE_VNMI        ( 8*32+ 1) /* Intel Virtual NMI */
#define X86_FEATURE_FLEXPRIORITY    ( 8*32+ 2) /* Intel FlexPriority */
#define X86_FEATURE_EPT            ( 8*32+ 3) /* Intel Extended Page Table */
#define X86_FEATURE_VPID        ( 8*32+ 4) /* Intel Virtual Processor ID */

#define X86_FEATURE_VMMCALL        ( 8*32+15) /* Prefer VMMCALL to VMCALL */
#define X86_FEATURE_XENPV        ( 8*32+16) /* "" Xen paravirtual guest */
#define X86_FEATURE_EPT_AD        ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
#define X86_FEATURE_VMCALL        ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */
#define X86_FEATURE_VMW_VMMCALL        ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */
#define X86_FEATURE_PVUNLOCK        ( 8*32+20) /* "" PV unlock function */
#define X86_FEATURE_VCPUPREEMPT        ( 8*32+21) /* "" PV vcpu_is_preempted function */

/* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9  EBX寄存器*/
#define X86_FEATURE_FSGSBASE        ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
#define X86_FEATURE_TSC_ADJUST        ( 9*32+ 1) /* TSC adjustment MSR 0x3B */
#define X86_FEATURE_SGX            ( 9*32+ 2) /* Software Guard Extensions */
#define X86_FEATURE_BMI1        ( 9*32+ 3) /* 1st group bit manipulation extensions */
#define X86_FEATURE_HLE            ( 9*32+ 4) /* Hardware Lock Elision */
#define X86_FEATURE_AVX2        ( 9*32+ 5) /* AVX2 instructions */
#define X86_FEATURE_FDP_EXCPTN_ONLY    ( 9*32+ 6) /* "" FPU data pointer updated only on x87 exceptions */
#define X86_FEATURE_SMEP        ( 9*32+ 7) /* Supervisor Mode Execution Protection */
#define X86_FEATURE_BMI2        ( 9*32+ 8) /* 2nd group bit manipulation extensions */
#define X86_FEATURE_ERMS        ( 9*32+ 9) /* Enhanced REP MOVSB/STOSB instructions */
#define X86_FEATURE_INVPCID        ( 9*32+10) /* Invalidate Processor Context ID */
#define X86_FEATURE_RTM            ( 9*32+11) /* Restricted Transactional Memory */
#define X86_FEATURE_CQM            ( 9*32+12) /* Cache QoS Monitoring */
#define X86_FEATURE_ZERO_FCS_FDS    ( 9*32+13) /* "" Zero out FPU CS and FPU DS */
#define X86_FEATURE_MPX            ( 9*32+14) /* Memory Protection Extension */
#define X86_FEATURE_RDT_A        ( 9*32+15) /* Resource Director Technology Allocation */
#define X86_FEATURE_AVX512F        ( 9*32+16) /* AVX-512 Foundation */
#define X86_FEATURE_AVX512DQ        ( 9*32+17) /* AVX-512 DQ (Double/Quad granular) Instructions */
#define X86_FEATURE_RDSEED        ( 9*32+18) /* RDSEED instruction */
#define X86_FEATURE_ADX            ( 9*32+19) /* ADCX and ADOX instructions */
#define X86_FEATURE_SMAP        ( 9*32+20) /* Supervisor Mode Access Prevention */
#define X86_FEATURE_AVX512IFMA        ( 9*32+21) /* AVX-512 Integer Fused Multiply-Add instructions */
#define X86_FEATURE_CLFLUSHOPT        ( 9*32+23) /* CLFLUSHOPT instruction */
#define X86_FEATURE_CLWB        ( 9*32+24) /* CLWB instruction */
#define X86_FEATURE_INTEL_PT        ( 9*32+25) /* Intel Processor Trace */
#define X86_FEATURE_AVX512PF        ( 9*32+26) /* AVX-512 Prefetch */
#define X86_FEATURE_AVX512ER        ( 9*32+27) /* AVX-512 Exponential and Reciprocal */
#define X86_FEATURE_AVX512CD        ( 9*32+28) /* AVX-512 Conflict Detection */
#define X86_FEATURE_SHA_NI        ( 9*32+29) /* SHA1/SHA256 Instruction Extensions */
#define X86_FEATURE_AVX512BW        ( 9*32+30) /* AVX-512 BW (Byte/Word granular) Instructions */
#define X86_FEATURE_AVX512VL        ( 9*32+31) /* AVX-512 VL (128/256 Vector Length) Extensions */

/* Extended state features, CPUID level 0x0000000d:1 (EAX), word 10 */
#define X86_FEATURE_XSAVEOPT        (10*32+ 0) /* XSAVEOPT instruction */
#define X86_FEATURE_XSAVEC        (10*32+ 1) /* XSAVEC instruction */
#define X86_FEATURE_XGETBV1        (10*32+ 2) /* XGETBV with ECX = 1 instruction */
#define X86_FEATURE_XSAVES        (10*32+ 3) /* XSAVES/XRSTORS instructions */
#define X86_FEATURE_XFD            (10*32+ 4) /* "" eXtended Feature Disabling */

/*
 * Extended auxiliary flags: Linux defined - for features scattered in various
 * CPUID levels like 0xf, etc.
 * 
 * Reuse free bits when adding new feature flags!
 */
#define X86_FEATURE_CQM_LLC        (11*32+ 0)   /* LLC QoS if 1 */
#define X86_FEATURE_CQM_OCCUP_LLC    (11*32+ 1) /* LLC occupancy monitoring */
#define X86_FEATURE_CQM_MBM_TOTAL    (11*32+ 2) /* LLC Total MBM monitoring */
#define X86_FEATURE_CQM_MBM_LOCAL    (11*32+ 3) /* LLC Local MBM monitoring */
#define X86_FEATURE_FENCE_SWAPGS_USER    (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
#define X86_FEATURE_FENCE_SWAPGS_KERNEL    (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
#define X86_FEATURE_SPLIT_LOCK_DETECT    (11*32+ 6) /* #AC for split lock */
#define X86_FEATURE_PER_THREAD_MBA    (11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */
#define X86_FEATURE_SGX1        (11*32+ 8) /* "" Basic SGX */
#define X86_FEATURE_SGX2        (11*32+ 9) /* "" SGX Enclave Dynamic Memory Management (EDMM) */

/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 intel EAX寄存器*/
#define X86_FEATURE_AVX_VNNI        (12*32+ 4) /* AVX VNNI instructions */
#define X86_FEATURE_AVX512_BF16        (12*32+ 5) /* AVX512 BFLOAT16 instructions */

/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13  AMD EBX寄存器*/
#define X86_FEATURE_CLZERO        (13*32+ 0) /* CLZERO instruction */
#define X86_FEATURE_IRPERF        (13*32+ 1) /* Instructions Retired Count */
#define X86_FEATURE_XSAVEERPTR        (13*32+ 2) /* Always save/restore FP error pointers */
#define X86_FEATURE_RDPRU        (13*32+ 4) /* Read processor register at user level */
#define X86_FEATURE_WBNOINVD        (13*32+ 9) /* WBNOINVD instruction */
#define X86_FEATURE_AMD_IBPB        (13*32+12) /* "" Indirect Branch Prediction Barrier */
#define X86_FEATURE_AMD_IBRS        (13*32+14) /* "" Indirect Branch Restricted Speculation */
#define X86_FEATURE_AMD_STIBP        (13*32+15) /* "" Single Thread Indirect Branch Predictors */
#define X86_FEATURE_AMD_STIBP_ALWAYS_ON    (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */
#define X86_FEATURE_AMD_PPIN        (13*32+23) /* Protected Processor Inventory Number */
#define X86_FEATURE_AMD_SSBD        (13*32+24) /* "" Speculative Store Bypass Disable */
#define X86_FEATURE_VIRT_SSBD        (13*32+25) /* Virtualized Speculative Store Bypass Disable */
#define X86_FEATURE_AMD_SSB_NO        (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */
#define X86_FEATURE_CPPC        (13*32+27) /* Collaborative Processor Performance Control */

/* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */
#define X86_FEATURE_DTHERM        (14*32+ 0) /* Digital Thermal Sensor */
#define X86_FEATURE_IDA            (14*32+ 1) /* Intel Dynamic Acceleration */
#define X86_FEATURE_ARAT        (14*32+ 2) /* Always Running APIC Timer */
#define X86_FEATURE_PLN            (14*32+ 4) /* Intel Power Limit Notification */
#define X86_FEATURE_PTS            (14*32+ 6) /* Intel Package Thermal Status */
#define X86_FEATURE_HWP            (14*32+ 7) /* Intel Hardware P-states */
#define X86_FEATURE_HWP_NOTIFY        (14*32+ 8) /* HWP Notification */
#define X86_FEATURE_HWP_ACT_WINDOW    (14*32+ 9) /* HWP Activity Window */
#define X86_FEATURE_HWP_EPP        (14*32+10) /* HWP Energy Perf. Preference */
#define X86_FEATURE_HWP_PKG_REQ        (14*32+11) /* HWP Package Level Request */
#define X86_FEATURE_HFI            (14*32+19) /* Hardware Feedback Interface */

/* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */
#define X86_FEATURE_NPT            (15*32+ 0) /* Nested Page Table support */
#define X86_FEATURE_LBRV        (15*32+ 1) /* LBR Virtualization support */
#define X86_FEATURE_SVML        (15*32+ 2) /* "svm_lock" SVM locking MSR */
#define X86_FEATURE_NRIPS        (15*32+ 3) /* "nrip_save" SVM next_rip save */
#define X86_FEATURE_TSCRATEMSR        (15*32+ 4) /* "tsc_scale" TSC scaling support */
#define X86_FEATURE_VMCBCLEAN        (15*32+ 5) /* "vmcb_clean" VMCB clean bits support */
#define X86_FEATURE_FLUSHBYASID        (15*32+ 6) /* flush-by-ASID support */
#define X86_FEATURE_DECODEASSISTS    (15*32+ 7) /* Decode Assists support */
#define X86_FEATURE_PAUSEFILTER        (15*32+10) /* filtered pause intercept */
#define X86_FEATURE_PFTHRESHOLD        (15*32+12) /* pause filter threshold */
#define X86_FEATURE_AVIC        (15*32+13) /* Virtual Interrupt Controller */
#define X86_FEATURE_V_VMSAVE_VMLOAD    (15*32+15) /* Virtual VMSAVE VMLOAD */
#define X86_FEATURE_VGIF        (15*32+16) /* Virtual GIF */
#define X86_FEATURE_V_SPEC_CTRL        (15*32+20) /* Virtual SPEC_CTRL */
#define X86_FEATURE_SVME_ADDR_CHK    (15*32+28) /* "" SVME addr check */

/* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16  intel ECX寄存器*/
//https://superuser.com/questions/134297/what-does-cpuid-level-mean
#define X86_FEATURE_AVX512VBMI        (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions 指令集*/
#define X86_FEATURE_UMIP        (16*32+ 2) /* User Mode Instruction Protection  用户保护模式*/
#define X86_FEATURE_PKU            (16*32+ 3) /* Protection Keys for Userspace  */  // 用户模式指令防护
//UMIP(用户模式指令防护)是Intel Cannon Lake,Goldmont Plus和AMD Zen 2微体系结构中引入的x86安全功能
#define X86_FEATURE_OSPKE        (16*32+ 4) /* OS Protection Keys Enable  系统保护指令启用*/
//CPU保护说的是OS需要防止用户程序陷入死循环或者不调用系统服务且不将控制权返回到OS
#define X86_FEATURE_WAITPKG        (16*32+ 5) /* UMONITOR/UMWAIT/TPAUSE Instructions UMONITOR/UMWAIT/TPAUSE指令*/
#define X86_FEATURE_AVX512_VBMI2    (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions 指令*/
#define X86_FEATURE_GFNI        (16*32+ 8) /* Galois Field New Instructions Galois Field指令是密码学的一些元素中的基本构建块*/
#define X86_FEATURE_VAES        (16*32+ 9) /* Vector AES vector AES加密算法指令*/
#define X86_FEATURE_VPCLMULQDQ        (16*32+10) /* Carry-Less Multiplication Double Quadword 指令 */
#define X86_FEATURE_AVX512_VNNI        (16*32+11) /* Vector Neural Network Instructions */
#define X86_FEATURE_AVX512_BITALG    (16*32+12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB instructions */
#define X86_FEATURE_TME            (16*32+13) /* Intel Total Memory Encryption */
#define X86_FEATURE_AVX512_VPOPCNTDQ    (16*32+14) /* POPCNT for vectors of DW/QW */
#define X86_FEATURE_LA57        (16*32+16) /* 5-level page tables 5级页表*/
#define X86_FEATURE_RDPID        (16*32+22) /* RDPID instruction  */
#define X86_FEATURE_BUS_LOCK_DETECT    (16*32+24) /* Bus Lock detect */
//https://www.kernel.org/doc/html/latest/x86/buslock.html
#define X86_FEATURE_CLDEMOTE        (16*32+25) /* CLDEMOTE instruction  指令*/
#define X86_FEATURE_MOVDIRI        (16*32+27) /* MOVDIRI instruction 指令*/
#define X86_FEATURE_MOVDIR64B        (16*32+28) /* MOVDIR64B instruction 指令 */
#define X86_FEATURE_ENQCMD        (16*32+29) /* ENQCMD and ENQCMDS instructions */
//共享虚拟地址用ENQCMD and ENQCMDS
#define X86_FEATURE_SGX_LC        (16*32+30) /* Software Guard Extensions Launch Control */
/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
#define X86_FEATURE_OVERFLOW_RECOV    (17*32+ 0) /* MCA overflow recovery support */
//硬件错误检测机制架构
#define X86_FEATURE_SUCCOR        (17*32+ 1) /* Uncorrectable error containment and recovery */
//无法纠正的错误控制和恢复
#define X86_FEATURE_SMCA        (17*32+ 3) /* Scalable MCA */
//
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
//EDX部分
#define X86_FEATURE_AVX512_4VNNIW    (18*32+ 2) /* AVX-512 Neural Network Instructions */
#define X86_FEATURE_AVX512_4FMAPS    (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
#define X86_FEATURE_FSRM        (18*32+ 4) /* Fast Short Rep Mov */
#define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
#define X86_FEATURE_SRBDS_CTRL        (18*32+ 9) /* "" SRBDS mitigation MSR available */
#define X86_FEATURE_MD_CLEAR        (18*32+10) /* VERW clears CPU buffers */
#define X86_FEATURE_RTM_ALWAYS_ABORT    (18*32+11) /* "" RTM transaction always aborts */
#define X86_FEATURE_TSX_FORCE_ABORT    (18*32+13) /* "" TSX_FORCE_ABORT */
#define X86_FEATURE_SERIALIZE        (18*32+14) /* SERIALIZE instruction */
#define X86_FEATURE_HYBRID_CPU        (18*32+15) /* "" This part has CPUs of more than one type */
#define X86_FEATURE_TSXLDTRK        (18*32+16) /* TSX Suspend Load Address Tracking */
#define X86_FEATURE_PCONFIG        (18*32+18) /* Intel PCONFIG */
#define X86_FEATURE_ARCH_LBR        (18*32+19) /* Intel ARCH LBR */
#define X86_FEATURE_IBT            (18*32+20) /* Indirect Branch Tracking */
#define X86_FEATURE_AMX_BF16        (18*32+22) /* AMX bf16 Support */
#define X86_FEATURE_AVX512_FP16        (18*32+23) /* AVX512 FP16 */
#define X86_FEATURE_AMX_TILE        (18*32+24) /* AMX tile Support */
#define X86_FEATURE_AMX_INT8        (18*32+25) /* AMX int8 Support */
#define X86_FEATURE_SPEC_CTRL        (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
#define X86_FEATURE_INTEL_STIBP        (18*32+27) /* "" Single Thread Indirect Branch Predictors */
#define X86_FEATURE_FLUSH_L1D        (18*32+28) /* Flush L1D cache */
#define X86_FEATURE_ARCH_CAPABILITIES    (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */
#define X86_FEATURE_CORE_CAPABILITIES    (18*32+30) /* "" IA32_CORE_CAPABILITIES MSR */
#define X86_FEATURE_SPEC_CTRL_SSBD    (18*32+31) /* "" Speculative Store Bypass Disable */

/* AMD-defined memory encryption features, CPUID level 0x8000001f (EAX), word 19 */
#define X86_FEATURE_SME            (19*32+ 0) /* AMD Secure Memory Encryption */
#define X86_FEATURE_SEV            (19*32+ 1) /* AMD Secure Encrypted Virtualization */
#define X86_FEATURE_VM_PAGE_FLUSH    (19*32+ 2) /* "" VM Page Flush MSR is supported */
#define X86_FEATURE_SEV_ES        (19*32+ 3) /* AMD Secure Encrypted Virtualization - Encrypted State */
#define X86_FEATURE_SME_COHERENT    (19*32+10) /* "" AMD hardware-enforced cache coherency */

/*
 * BUG word(s)
 */
#define X86_BUG(x)            (NCAPINTS*32 + (x))

#define X86_BUG_F00F            X86_BUG(0) /* Intel F00F */
#define X86_BUG_FDIV            X86_BUG(1) /* FPU FDIV */
#define X86_BUG_COMA            X86_BUG(2) /* Cyrix 6x86 coma */
#define X86_BUG_AMD_TLB_MMATCH        X86_BUG(3) /* "tlb_mmatch" AMD Erratum 383 */
#define X86_BUG_AMD_APIC_C1E        X86_BUG(4) /* "apic_c1e" AMD Erratum 400 */
#define X86_BUG_11AP            X86_BUG(5) /* Bad local APIC aka 11AP */
#define X86_BUG_FXSAVE_LEAK        X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */
#define X86_BUG_CLFLUSH_MONITOR        X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
#define X86_BUG_SYSRET_SS_ATTRS        X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
#ifdef CONFIG_X86_32
/*
 * 64-bit kernels don't use X86_BUG_ESPFIX.  Make the define conditional
 * to avoid confusion.
 */
#define X86_BUG_ESPFIX            X86_BUG(9) /* "" IRET to 16-bit SS corrupts ESP/RSP high bits */
#endif
#define X86_BUG_NULL_SEG        X86_BUG(10) /* Nulling a selector preserves the base */
#define X86_BUG_SWAPGS_FENCE        X86_BUG(11) /* SWAPGS without input dep on GS */
#define X86_BUG_MONITOR            X86_BUG(12) /* IPI required to wake up remote CPU */
#define X86_BUG_AMD_E400        X86_BUG(13) /* CPU is among the affected by Erratum 400 */
#define X86_BUG_CPU_MELTDOWN        X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */
#define X86_BUG_SPECTRE_V1        X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */
#define X86_BUG_SPECTRE_V2        X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */
#define X86_BUG_SPEC_STORE_BYPASS    X86_BUG(17) /* CPU is affected by speculative store bypass attack */
#define X86_BUG_L1TF            X86_BUG(18) /* CPU is affected by L1 Terminal Fault */
#define X86_BUG_MDS            X86_BUG(19) /* CPU is affected by Microarchitectural data sampling */
#define X86_BUG_MSBDS_ONLY        X86_BUG(20) /* CPU is only affected by the  MSDBS variant of BUG_MDS */
#define X86_BUG_SWAPGS            X86_BUG(21) /* CPU is affected by speculation through SWAPGS */
#define X86_BUG_TAA            X86_BUG(22) /* CPU is affected by TSX Async Abort(TAA) */
#define X86_BUG_ITLB_MULTIHIT        X86_BUG(23) /* CPU may incur MCE during certain page attribute changes */
#define X86_BUG_SRBDS            X86_BUG(24) /* CPU may leak RNG bits if not mitigated */

#endif /* _ASM_X86_CPUFEATURES_H */

//这里看一下 
//https://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
//https://www.felixcloutier.com/x86/cmpxchg
//https://wenku.baidu.com/view/cfea95c04028915f804dc2d7.html

1.使用cat命令

[root@ht8 ~]# cat /proc/cpuinfo
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 63
model name    : Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
stepping    : 2
microcode    : 0x38
cpu MHz        : 2593.993
cache size    : 25600 KB
physical id    : 0
siblings    : 4
core id        : 0
cpu cores    : 4
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 15
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 
ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf 
eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand 
hypervisor lahf_lm abm epb invpcid_single fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
//可查看 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/include/asm/cpufeatures.h
//从文件看出都是基本针对寄存器来说
bogomips    : 5187.98
//MIPS是millions of instructions per second(百万条指令每秒)的缩写,其代表CPU的运算速度,是cpu性能的重要指标。
那BogoMIPS是什么意思呢?
Bogomips是Linux操作系统中衡量计算机处理器运行速度的的一种尺度,是由Linux主要开发者linus Torvalds写的。是通过calibrate_delay()函数计算出来的。
只能用来粗略计算处理器的性能,并不十分精确。
clflush size    : 64 //系统cache line(从主存一次复制数据的大小)的大小,单位为bytes,一般为32/64 bytes,这个是硬件决定的,和操作系统位数无关。
cache_alignment    : 64  //内存对齐
address sizes    : 42 bits physical, 48 bits virtual
power management: 电源管理
processor    : 1
vendor_id    : GenuineIntel  
cpu family    : 6
model        : 63
model name    : Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
stepping    : 2
microcode    : 0x38   //一条机器指令,将被拆解成数个类似RISC的精简微操作:微码 Microcode。而这些Microcode,则可以完全被硬件执行
cpu MHz        : 2593.993
cache size    : 25600 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 4
apicid        : 1
initial apicid    : 1
fpu        : yes
fpu_exception    : yes
cpuid level    : 15
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm epb invpcid_single fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
bogomips    : 5187.98
clflush size    : 64
cache_alignment    : 64
address sizes    : 42 bits physical, 48 bits virtual
power management:
.....  具体请参考  https://www.cnblogs.com/aozhejin/p/15860451.html
//得到供应商信息
[root@ht8 ~]# cat /proc/cpuinfo | grep 'vendor' | uniq
vendor_id    : GenuineIntel
//得到CPU属于的名字及其编号、标称主频 
[root@ht8 ~]# cat /proc/cpuinfo | grep 'model name' | uniq
model name    : Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
//计算处理器单元数量
[root@ht8 ~]# cat /proc/cpuinfo | grep processor | wc -l
8
//显示独立的核数    
[root@ht8 ~]# cat /proc/cpuinfo | grep 'core id'
core id    : 0
core id    : 1
core id    : 2
core id    : 3
core id    : 0
core id    : 1
core id    : 2
core id    : 3
查看 https://www.scss.tcd.ie/Jeremy.Jones/CS4021/processor-identification-cpuid-instruction-note.pdf  
//cpuid指令,cpuid指令是intelIA32架构下获得CPU信息的汇编指令

2.lscpu命令(显示架构信息)
lscpu是util-linux软件包的一部分

[root@ht2 src]# lscpu
Architecture:          x86_64  #x86架构下的64位
 //cpu的这个位数指的是CPU GPRs(General-Purpose Registers,通用寄存器)的数据宽度为xx位,64位指令集就是运行64位数据的指令,也就是说处理器一次可以运行64bit数据。
CPU op-mode(s):        32-bit, 64-bit  #表示支持运行模式,getconf LONG_BIT 命令可以得到当前CPU运行在什么模式下,如果是64,但不代表CPU不支持32bi
Byte Order:            Little Endian #Intel的机器(X86平台)一般都采用小端,Little Endian代表小段字节对齐
CPU(s):                80  #逻辑cpu颗数
On-line CPU(s) list:   0-79 #正在运行的cpu逻辑内核
Thread(s) per core:    2   #每个核的线程数(每个 Core 的硬件线程数)
Core(s) per socket:    10  #多少核
Socket(s):             4   #服务器面板上有4个cpu槽位
NUMA node(s):          4   #numa nodes的数量
Vendor ID:             GenuineIntel    #cpu厂商ID
CPU family:            6   #CPU产品系列代号,6系列(第六代)  //下面有注解
Model:                 62  #CPU属于其系列中的哪一代的代号
Model name:            Intel(R) Xeon(R) CPU  #cpu型号
E7-4830 v2 @ 2.20GHz  //处理器编号(Intel 至强 E7-4830)
Stepping:              7           #步长   //https://www.techpowerup.com/articles/overclocking/29
CPU MHz:               2180.664      #CPU的时钟频率(主频),是指CPU运算时的工作的频率,决定计算技术的运行速度,单位是Hz
CPU max MHz:           2700.0000     #cpu时钟最大频率
CPU min MHz:           1200.0000     #cpu时钟最小频率
BogoMIPS:              4389.73      #BogoMips 是衡量 CPU 速度的方法,它衡量的是“ CPU 每秒钟什么都不能做的百万次数”
Virtualization:        VT-x         #cpu支持的虚拟化技术,需要进入进入bios设置
//要结合着理解L1d cache和L1i cache,他们两个差一个字母d和i
L1d cache:             32K          #ld cache 内容缓存
L1i cache:             32K         #li cache 指令缓存,L1是最靠近CPU核心的缓存。
L2 cache: 256K                         #CPU未命中L1的情况下继续在L2寻求命中,L2二级缓存比L1一级缓存的容量要更大,但是L2的速率要更慢,离cpu远
L3 cache:              20480K       #  
#这里看到,cpu是采用numa硬件体系架构,首先确认看到cpu硬件是否支持numa的.
#通过lscpu 、numactl  --hardware、grep -i numa  /var/log/dmesg等命令可以看到相关配置。
#缓存速度上 L1 > L2 > L3 > DDR
NUMA node0 CPU(s):     0-9,40-49     #0-9和40-49 是由numa node0 来管理的
NUMA node1 CPU(s):     10-19,50-59   #...
NUMA node2 CPU(s):     20-29,60-69   #...
NUMA node3 CPU(s):     30-39,70-79   #...
Flags: fpu .....                     #cpu支持的技术特征 这里省略了.另外章节介绍
具体可查看 https://ark.intel.com/content/www/cn/zh/ark/products/75247/intel-xeon-processor-e74830-v2-20m-cache-2-20-ghz.html

 6系列(第六代)包括众多处理器,如Celeron,Pentium 2,Pentium 3,Core i5&i7,Atom系列(E3000t系列、Z3600系列、C2000系列,等等)。 
 1表示为8086和80186级芯片;
 2表示为286级芯片;
 3表示为386级芯片;
 4表示为486级芯片(SX、DX、:DX2、DX4);
 5表示为P5级芯片(Pentium处理器和含MMX技术的Pentium处理器);
 6表示为P6级芯片(包括Celeron、Pentium II、PenfiumIII系列);
 F代表Xeon处理器、Pentium 4处理器。

 有些资料也可以从 https://en.wikichip.org/wiki/intel 获取

3.cpuid (该命令需要安装)-这个命令的底层是通过cpuid指令来获取相关cpu信息

//由于是8核,所以我只取了一个作为样例来说明

  [root@ht8 ~]# cat /etc/redhat-release
  CentOS Linux release 7.9.2009 (Core)

  [root@ht8 ~]# uname -r
  3.10.0-1160.45.1.el7.x86_64

  [root@ht8 ~]# cpuid
  ...... 省略

 CPU 7:
   vendor_id = "GenuineIntel"  //厂商id
   version information (1/eax):  //eax寄存器,eax, ebx, ecx, edx, esi, edi, ebp, esp等都是X86 汇编语言中CPU上的通用寄存器的名称,是32位的寄存器
      processor type  = primary processor (0) //主处理器
      family          = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
      //Intel Pentium PRO是一种微处理器,工作频率有150、166、180和200MHz四种,采用总线接口Socket 8技术制作
      //VIA C3是一款x86处理器,全名为「VIA Cyrix III」,由台湾的威盛电子公司制造
      //Cyrix mii是Cyrix公司独自研发的最后一款微处理器
      //AMD Duron是一款微处理器,采用Socket A接口,拥有64KB全速L2 cache
      //Intel Atom(中文名:凌动,开发代号:Silverthorne)是Intel的一个处理器系列,处理器采用45纳米工艺制造,集成4700万个晶体管。L2缓存为512KB,支持SSE3指令集,和VT虚拟化技术(部分型号)
      model           = 0xf (15)
      stepping id     = 0x2 (2)
      extended family = 0x0 (0)
      extended model  = 0x3 (3)
      (simple synth)  = Intel Core i7-5000 Extreme Edition (Haswell R2) / Xeon E5-x600 v3 (Haswell-EP C1/M1/R2), 22nm
   miscellaneous (1/ebx):
      process local APIC physical ID = 0x7 (7)
      cpu count                      = 0x4 (4)
      CLFLUSH line size              = 0x8 (8)
      brand index                    = 0x0 (0)
   brand id = 0x00 (0): unknown
   feature information (1/edx):
      x87 FPU on chip                        = true
      virtual-8086 mode enhancement          = true
      debugging extensions                   = true
      page size extensions                   = true
      time stamp counter                     = true
      RDMSR and WRMSR support                = true
      physical address extensions            = true
      machine check exception                = true
      CMPXCHG8B inst.                        = true
      APIC on chip                           = true
      SYSENTER and SYSEXIT                   = true
      memory type range registers            = true
      PTE global bit                         = true
      machine check architecture             = true
      conditional move/compare instruction   = true
      page attribute table                   = true
      page size extension                    = true
      processor serial number                = false
      CLFLUSH instruction                    = true
      debug store                            = true
      thermal monitor and clock ctrl         = false
      MMX Technology                         = true
      FXSAVE/FXRSTOR                         = true
      SSE extensions                         = true
      SSE2 extensions                        = true
      self snoop                             = true
      hyper-threading / multi-core supported = true
      therm. monitor                         = false
      IA64                                   = false
      pending break event                    = false
   feature information (1/ecx):
      PNI/SSE3: Prescott New Instructions     = true
      PCLMULDQ instruction                    = true
      64-bit debug store                      = false
      MONITOR/MWAIT                           = false
      CPL-qualified debug store               = false
      VMX: virtual machine extensions         = false
      SMX: safer mode extensions              = false
      Enhanced Intel SpeedStep Technology     = false
      thermal monitor 2                       = false
      SSSE3 extensions                        = true
      context ID: adaptive or shared L1 data  = false
      FMA instruction                         = true
      CMPXCHG16B instruction                  = true
      xTPR disable                            = false
      perfmon and debug                       = false
      process context identifiers             = true
      direct cache access                     = false
      SSE4.1 extensions                       = true
      SSE4.2 extensions                       = true
      extended xAPIC support                  = true
      MOVBE instruction                       = true
      POPCNT instruction                      = true
      time stamp counter deadline             = true
      AES instruction                         = true
      XSAVE/XSTOR states                      = true
      OS-enabled XSAVE/XSTOR                  = true
      AVX: advanced vector extensions         = true
      F16C half-precision convert instruction = true
      RDRAND instruction                      = true
      hypervisor guest status                 = true
   cache and TLB information (2):
      0x63: data TLB: 1G pages, 4-way, 4 entries
      0x03: data TLB: 4K pages, 4-way, 64 entries
      0x76: instruction TLB: 2M/4M pages, fully, 8 entries
      0xff: cache data is in CPUID 4
      0xb5: instruction TLB: 4K, 8-way, 64 entries
      0xf0: 64 byte prefetching
      0xc1: L2 TLB: 4K/2M pages, 8-way, 1024 entries
   processor serial number: 0003-06F2-0000-0000-0000-0000
   deterministic cache parameters (4):
      --- cache 0 ---
      cache type                           = data cache (1)
      cache level                          = 0x1 (1)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 63
      --- cache 1 ---
      cache type                           = instruction cache (2)
      cache level                          = 0x1 (1)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 63
      --- cache 2 ---
      cache type                           = unified cache (3)
      cache level                          = 0x2 (2)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 511
      --- cache 3 ---
      cache type                           = unified cache (3)
      cache level                          = 0x3 (3)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x13 (19)
      ways of associativity                = 0x6 (6)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = true
      complex cache indexing               = true
      number of sets - 1 (s)               = 20479
   MONITOR/MWAIT (5):
      smallest monitor-line size (bytes)       = 0x0 (0)
      largest monitor-line size (bytes)        = 0x0 (0)
      enum of Monitor-MWAIT exts supported     = false
      supports intrs as break-event for MWAIT  = false
      number of C0 sub C-states using MWAIT    = 0x0 (0)
      number of C1 sub C-states using MWAIT    = 0x0 (0)
      number of C2 sub C-states using MWAIT    = 0x0 (0)
      number of C3 sub C-states using MWAIT    = 0x0 (0)
      number of C4 sub C-states using MWAIT    = 0x0 (0)
      number of C5 sub C-states using MWAIT    = 0x0 (0)
      number of C6 sub C-states using MWAIT    = 0x0 (0)
      number of C7 sub C-states using MWAIT    = 0x0 (0)
   Thermal and Power Management Features (6):
      digital thermometer                     = true
      Intel Turbo Boost Technology            = true
      ARAT always running APIC timer          = true
      PLN power limit notification            = true
      ECMD extended clock modulation duty     = true
      PTM package thermal management          = true
      HWP base registers                      = false
      HWP notification                        = false
      HWP activity window                     = false
      HWP energy performance preference       = false
      HWP package level request               = false
      HDC base registers                      = false
      digital thermometer thresholds          = 0x2 (2)
      ACNT/MCNT supported performance measure = true
      ACNT2 available                         = false
      performance-energy bias capability      = true
   extended feature flags (7):
      FSGSBASE instructions                    = true
      IA32_TSC_ADJUST MSR supported            = true
      SGX: Software Guard Extensions supported = false
      BMI instruction                          = true
      HLE hardware lock elision                = false
      AVX2: advanced vector extensions 2       = true
      FDP_EXCPTN_ONLY                          = false
      SMEP supervisor mode exec protection     = true
      BMI2 instructions                        = true
      enhanced REP MOVSB/STOSB                 = true
      INVPCID instruction                      = true
      RTM: restricted transactional memory     = false
      QM: quality of service monitoring        = false
      deprecated FPU CS/DS                     = true
      intel memory protection extensions       = false
      PQE: platform quality of service enforce = false
      AVX512F: AVX-512 foundation instructions = false
      AVX512DQ: double & quadword instructions = false
      RDSEED instruction                       = false
      ADX instructions                         = false
      SMAP: supervisor mode access prevention  = false
      AVX512IFMA: fused multiply add           = false
      CLFLUSHOPT instruction                   = false
      CLWB instruction                         = false
      Intel processor trace                    = false
      AVX512PF: prefetch instructions          = false
      AVX512ER: exponent & reciprocal instrs   = false
      AVX512CD: conflict detection instrs      = false
      SHA instructions                         = false
      AVX512BW: byte & word instructions       = false
      AVX512VL: vector length                  = false
      PREFETCHWT1                              = false
      AVX512VBMI: vector byte manipulation     = false
      UMIP: user-mode instruction prevention   = false
      PKU protection keys for user-mode        = false
      OSPKE CR4.PKE and RDPKRU/WRPKRU          = false
      BNDLDX/BNDSTX MAWAU value in 64-bit mode = 0x0 (0)
      RDPID: read processor D supported        = false
      SGX_LC: SGX launch config supported      = false
      AVX512_4VNNIW: neural network instrs     = false
      AVX512_4FMAPS: multiply acc single prec  = false
   Direct Cache Access Parameters (9):
      PLATFORM_DCA_CAP MSR bits = 0
   Architecture Performance Monitoring Features (0xa/eax):
      version ID                               = 0x1 (1)
      number of counters per logical processor = 0x4 (4)
      bit width of counter                     = 0x30 (48)
      length of EBX bit vector                 = 0x7 (7)
   Architecture Performance Monitoring Features (0xa/ebx):
      core cycle event not available           = true
      instruction retired event not available  = true
      reference cycles event not available     = true
      last-level cache ref event not available = true
      last-level cache miss event not avail    = true
      branch inst retired event not available  = true
      branch mispred retired event not avail   = true
   Architecture Performance Monitoring Features (0xa/edx):
      number of fixed counters    = 0x0 (0)
      bit width of fixed counters = 0x0 (0)
   x2APIC features / processor topology (0xb):
      --- level 0 (thread) ---
      bits to shift APIC ID to get next = 0x0 (0)
      logical processors at this level  = 0x1 (1)
      level number                      = 0x0 (0)
      level type                        = thread (1)
      extended APIC ID                  = 7
      --- level 1 (core) ---
      bits to shift APIC ID to get next = 0x2 (2)
      logical processors at this level  = 0x4 (4)
      level number                      = 0x1 (1)
      level type                        = core (2)
      extended APIC ID                  = 7
   XSAVE features (0xd/0):
      XCR0 lower 32 bits valid bit field mask = 0x00000007
      XCR0 upper 32 bits valid bit field mask = 0x00000000
         XCR0 supported: x87 state            = true
         XCR0 supported: SSE state            = true
         XCR0 supported: AVX state            = true
         XCR0 supported: MPX BNDREGS          = false
         XCR0 supported: MPX BNDCSR           = false
         XCR0 supported: AVX-512 opmask       = false
         XCR0 supported: AVX-512 ZMM_Hi256    = false
         XCR0 supported: AVX-512 Hi16_ZMM     = false
         IA32_XSS supported: PT state         = false
         XCR0 supported: PKRU state           = false
      bytes required by fields in XCR0        = 0x00000340 (832)
      bytes required by XSAVE/XRSTOR area     = 0x00000340 (832)
   XSAVE features (0xd/1):
      XSAVEOPT instruction                        = true
      XSAVEC instruction                          = false
      XGETBV instruction                          = false
      XSAVES/XRSTORS instructions                 = false
      SAVE area size in bytes                     = 0x00000000 (0)
      IA32_XSS lower 32 bits valid bit field mask = 0x00000000
      IA32_XSS upper 32 bits valid bit field mask = 0x00000000
   AVX/YMM features (0xd/2):
      AVX/YMM save state byte size             = 0x00000100 (256)
      AVX/YMM save state byte offset           = 0x00000240 (576)
      supported in IA32_XSS or XCR0            = XCR0 (user state)
      64-byte alignment in compacted XSAVE     = false
   Quality of Service Monitoring Resource Type (0xf/0):
      Maximum range of RMID = 0
      supports L3 cache QoS monitoring = false
   hypervisor_id = "VMwareVMware"
   0x40000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000002 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000004 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000b 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000c 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000d 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000e 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000f 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   hypervisor generic timing information (0x40000010):
      TSC frequency (Hz) = 2593993
      bus frequency (Hz) = 66000
   extended feature flags (0x80000001/edx):
      SYSCALL and SYSRET instructions        = true
      execution disable                      = true
      1-GB large page support                = true
      RDTSCP                                 = true
      64-bit extensions technology available = true
   Intel feature flags (0x80000001/ecx):
      LAHF/SAHF supported in 64-bit mode     = true
      LZCNT advanced bit manipulation        = true
      3DNow! PREFETCH/PREFETCHW instructions = false  //由AMD开发的一套SIMD多媒体指令集
   brand = "Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz"
   L1 TLB/cache information: 2M/4M pages & L1 TLB (0x80000005/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 TLB/cache information: 4K pages & L1 TLB (0x80000005/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 data cache information (0x80000005/ecx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L1 instruction cache information (0x80000005/edx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L2 TLB/cache information: 2M/4M pages & L2 TLB (0x80000006/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 TLB/cache information: 4K pages & L2 TLB (0x80000006/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 unified cache information (0x80000006/ecx):
      line size (bytes) = 0x40 (64)
      lines per tag     = 0x0 (0)
      associativity     = 8-way (6)
      size (KB)         = 0x100 (256)
   L3 cache information (0x80000006/edx):
      line size (bytes)     = 0x0 (0)
      lines per tag         = 0x0 (0)
      associativity         = L2 off (0)
      size (in 512KB units) = 0x0 (0)
   Advanced Power Management Features (0x80000007/edx):
      temperature sensing diode      = false
      frequency ID (FID) control     = false
      voltage ID (VID) control       = false
      thermal trip (TTP)             = false
      thermal monitor (TM)           = false
      software thermal control (STC) = false
      100 MHz multiplier control     = false
      hardware P-State control       = false
      TscInvariant                   = true
   Physical Address and Linear Address Size (0x80000008/eax):
      maximum physical address bits         = 0x2a (42)
      maximum linear (virtual) address bits = 0x30 (48)
      maximum guest physical address bits   = 0x0 (0)
   Logical CPU cores (0x80000008/ecx):
      number of CPU cores - 1 = 0x0 (0)
      ApicIdCoreIdSize        = 0x0 (0)
   (multi-processing synth): multi-core (c=4)
   (multi-processing method): Intel leaf 0xb
   (APIC widths synth): CORE_width=2 SMT_width=0  //SMT,同时多线程Simultaneous multithreading,简称SMT
   (APIC synth): PKG_ID=1 CORE_ID=3 SMT_ID=0
   (synth) = Intel Core i7-5000 Extreme Edition (Haswell R2) / Xeon E5-x600 v3 (Haswell-EP C1/M1/R2), 22nm
//https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/hskdteyh(v=vs.90)?redirectedfrom=MSDN

4.获得cpu id信息

[root@ht8 ~]# dmidecode -t 4 | grep ID |sort -u |awk -F': ' '{print $2}'
F2 06 00 00 FF FB AB 1F
F2 06 03 00 FF FB AB 1F
[root@ht8 ~]# dmidecode -t 4 | more
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.4 present.

Handle 0x0004, DMI type 4, 35 bytes
Processor Information
    Socket Designation: CPU socket #0
    Type: Central Processor
    Family: Unknown
    Manufacturer: GenuineIntel
    ID: F2 06 03 00 FF FB AB 1F
    Version: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
    Voltage: 3.3 V
    External Clock: Unknown
    Max Speed: 30000 MHz
    Current Speed: 2600 MHz
    Status: Populated, Enabled
    Upgrade: ZIF Socket
    L1 Cache Handle: 0x0094
    L2 Cache Handle: 0x0095
    L3 Cache Handle: Not Provided
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified

Handle 0x0005, DMI type 4, 35 bytes
Processor Information
    Socket Designation: CPU socket #1
    Type: Central Processor
    Family: Unknown
    Manufacturer: GenuineIntel
    ID: F2 06 00 00 FF FB AB 1F
    Version: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
    Voltage: 3.3 V
    External Clock: Unknown
    Max Speed: 30000 MHz
    Current Speed: 2600 MHz
    Status: Populated, Enabled
    Upgrade: ZIF Socket
    L1 Cache Handle: 0x0096
    L2 Cache Handle: 0x0097
    L3 Cache Handle: Not Provided
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified

Handle 0x0006, DMI type 4, 35 bytes
.....省略

[root@ht8 ~]# dmidecode -t 4 | grep ID

 

5.利用inxi工具

[root@ht8 ~]# yum install epel-release //里面有inix包
如果有问题,你再 yum install inxi

  [root@ht8 ~]# inxi
  CPU: 2x 4-core Intel Xeon E5-2660 v3 (-MCP SMP-) speed: 2594 MHz
  Kernel: 3.10.0-1160.45.1.el7.x86_64 x86_64 Up: 92d 13h 40m Mem: 1400.5/16027.8 MiB (8.7%)
  Storage: 300 GiB 8.8% used) Procs: 339 Shell: Bash inxi: 3.3.12

 [root@ht8 ~]# inxi -C
  CPU:
 Info: 2x 4-core model: Intel Xeon E5-2660 v3 bits: 64 type: MCP SMP cache:
 L2: 2x 256 KiB (512 KiB)
 Speed (MHz): avg: 2594 min/max: N/A cores: 1: 2594 2: 2594 3: 2594 4: 2594 5: 2594 6: 2594
 7: 2594 8: 2594

6.使用lshw 命令

[root@ht8 ~]#  lshw -C CPU | more
  *-cpu:0                   
       description: CPU
       product: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
       vendor: Intel Corp.
       vendor_id: GenuineIntel
       physical id: 4
       bus info: cpu@0
       version: 6.63.2
       slot: CPU socket #0
       size: 2600MHz
       capacity: 4230MHz
       width: 64 bits
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb r
dtscp x86-64 constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic mov
be popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm epb invpcid_single fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida a
rat pln pts
       configuration: microcode=0
  *-cpu:1
       description: CPU
       product: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
       vendor: Intel Corp.
       vendor_id: GenuineIntel
       physical id: 5
       bus info: cpu@1
       version: 6.63.2
       slot: CPU socket #1
       size: 2600MHz
       capacity: 4230MHz
       width: 64 bits
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb r
dtscp x86-64 constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic mov
be popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm epb invpcid_single fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida a
rat pln pts
       configuration: microcode=0
  *-cpu:2
       description: CPU
       vendor: GenuineIntel
       physical id: 6
       bus info: cpu@2
       version: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
       slot: CPU socket #2
       size: 2600MHz
       capacity: 4230MHz
  *-cpu:3
       description: CPU
       vendor: GenuineIntel
       physical id: 7
       bus info: cpu@3
       version: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
       slot: CPU socket #3
       size: 2600MHz
       capacity: 4230MHz
  *-cpu:4
       description: CPU
       vendor: GenuineIntel
       physical id: 8
       bus info: cpu@4
       version: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
       slot: CPU socket #4
       size: 2600MHz
       capacity: 4230MHz
  *-cpu:5
       description: CPU
       vendor: GenuineIntel
       physical id: 9
       bus info: cpu@5
       version: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
       slot: CPU socket #5
       size: 2600MHz
       capacity: 4230MHz
...省略

7.cpuid命令

[root@ht8 ~]# yum install cpuid  //需要安装

  cpuid命令输出的信息非常多.

http://www.bitsavers.org/components/intel/80386/230985-001_80386_Programmers_Reference_Manual_1986.pdf

 

[root@ht8 ~]# cpuid | more
Disclaimer: cpuid may not support decoding of all cpuid registers.
CPU 0:
   vendor_id = "GenuineIntel"
   version information (1/eax):  //eax寄存器
      processor type  = primary processor (0)
      family          = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
      model           = 0xf (15)
      stepping id     = 0x2 (2)
      extended family = 0x0 (0)
      extended model  = 0x3 (3)
      (simple synth)  = Intel Core i7-5000 Extreme Edition (Haswell R2) / Xeon E5-x600 v3 (Haswell-EP C1/M1/R2), 22nm
   miscellaneous (1/ebx):      //ebx寄存器
      process local APIC physical ID = 0x0 (0)
      cpu count                      = 0x4 (4)
      CLFLUSH line size              = 0x8 (8)
      brand index                    = 0x0 (0)
   brand id = 0x00 (0): unknown
   feature information (1/edx):   //edx寄存器
      x87 FPU on chip                        = true
      virtual-8086 mode enhancement          = true
      debugging extensions                   = true
      page size extensions                   = true
      time stamp counter                     = true
      RDMSR and WRMSR support                = true
      physical address extensions            = true
      machine check exception                = true
      CMPXCHG8B inst.                        = true
      APIC on chip                           = true  //芯片上的高级程序中断控制器
      SYSENTER and SYSEXIT                   = true
      memory type range registers            = true
      PTE global bit                         = true
      machine check architecture             = true
      conditional move/compare instruction   = true
      page attribute table                   = true
      page size extension                    = true
      processor serial number                = false
      CLFLUSH instruction                    = true
      debug store                            = true
      thermal monitor and clock ctrl         = false
      MMX Technology                         = true  //缩写是 Matrix Math eXtensions
      FXSAVE/FXRSTOR                         = true  //缩写Fast Floating Point Save
      SSE extensions                         = true
      SSE2 extensions                        = true
      self snoop                             = true
      hyper-threading / multi-core supported = true
      therm. monitor                         = false
      IA64                                   = false
      pending break event                    = false
   feature information (1/ecx):   //ecx寄存器
      PNI/SSE3: Prescott New Instructions     = true
      PCLMULDQ instruction                    = true
      64-bit debug store                      = false
      MONITOR/MWAIT                           = false
      CPL-qualified debug store               = false
      VMX: virtual machine extensions         = false
      SMX: safer mode extensions              = false
      Enhanced Intel SpeedStep Technology     = false
      thermal monitor 2                       = false
      SSSE3 extensions                        = true
      context ID: adaptive or shared L1 data  = false
      FMA instruction                         = true
      CMPXCHG16B instruction                  = true
      xTPR disable                            = false
      perfmon and debug                       = false
      process context identifiers             = true
      direct cache access                     = false
      SSE4.1 extensions                       = true
      SSE4.2 extensions                       = true
      extended xAPIC support                  = true
      MOVBE instruction                       = true
      POPCNT instruction                      = true
      time stamp counter deadline             = true
      AES instruction                         = true
      XSAVE/XSTOR states                      = true
      OS-enabled XSAVE/XSTOR                  = true
      AVX: advanced vector extensions         = true
      F16C half-precision convert instruction = true
      RDRAND instruction                      = true
      hypervisor guest status                 = true
   cache and TLB information (2):  //TLB的作用是在处理器访问内存数据的时候做快速地址转换,否则处理器需要做两次访存操作。
//TLB的全称是Translation Lookaside Buffer,可以翻译做旁路缓冲。TLB中存放了一些页表文件,文件中记录了虚拟地址和物理地址的映射关系
      0x63: data TLB: 1G pages, 4-way, 4 entries
      0x03: data TLB: 4K pages, 4-way, 64 entries
      0x76: instruction TLB: 2M/4M pages, fully, 8 entries
      0xff: cache data is in CPUID 4
      0xb5: instruction TLB: 4K, 8-way, 64 entries
      0xf0: 64 byte prefetching
      0xc1: L2 TLB: 4K/2M pages, 8-way, 1024 entries
   processor serial number: 0003-06F2-0000-0000-0000-0000
   deterministic cache parameters (4):
      --- cache 0 ---
      cache type                           = data cache (1)  //数据缓存
      cache level                          = 0x1 (1)
      self-initializing cache level        = true  //自置初值缓存级别
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)//
      extra processor cores on this die    = 0x3 (3)//cpu die请参考相关资料很多.
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 63
      --- cache 1 ---
      cache type                           = instruction cache (2)  //指令缓存
      cache level                          = 0x1 (1)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 63
      --- cache 2 ---
      cache type                           = unified cache (3)  ///共享(统一)缓存
      cache level                          = 0x2 (2)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 511
      --- cache 3 ---
      cache type                           = unified cache (3)  //共享(统一)缓存
      cache level                          = 0x3 (3)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x13 (19)
      ways of associativity                = 0x6 (6)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = true
      complex cache indexing               = true
      number of sets - 1 (s)               = 20479
   MONITOR/MWAIT (5):   //指令
      smallest monitor-line size (bytes)       = 0x0 (0)
      largest monitor-line size (bytes)        = 0x0 (0)
      enum of Monitor-MWAIT exts supported     = false
      supports intrs as break-event for MWAIT  = false
      number of C0 sub C-states using MWAIT    = 0x0 (0)
      number of C1 sub C-states using MWAIT    = 0x0 (0)
      number of C2 sub C-states using MWAIT    = 0x0 (0)
      number of C3 sub C-states using MWAIT    = 0x0 (0)
      number of C4 sub C-states using MWAIT    = 0x0 (0)
      number of C5 sub C-states using MWAIT    = 0x0 (0)
      number of C6 sub C-states using MWAIT    = 0x0 (0)
      number of C7 sub C-states using MWAIT    = 0x0 (0)
   Thermal and Power Management Features (6):  //电源管理
      digital thermometer                     = true
      Intel Turbo Boost Technology            = true
      ARAT always running APIC timer          = true
      PLN power limit notification            = true
      ECMD extended clock modulation duty     = true
      PTM package thermal management          = true
      HWP base registers                      = false
      HWP notification                        = false
      HWP activity window                     = false
      HWP energy performance preference       = false
      HWP package level request               = false
      HDC base registers                      = false
      digital thermometer thresholds          = 0x2 (2)
      ACNT/MCNT supported performance measure = true
      ACNT2 available                         = false
      performance-energy bias capability      = true
   extended feature flags (7):
      FSGSBASE instructions                    = true
      IA32_TSC_ADJUST MSR supported            = true
      SGX: Software Guard Extensions supported = false
      BMI instruction                          = true
      HLE hardware lock elision                = false
      AVX2: advanced vector extensions 2       = true
      FDP_EXCPTN_ONLY                          = false
      SMEP supervisor mode exec protection     = true
      BMI2 instructions                        = true
      enhanced REP MOVSB/STOSB                 = true
      INVPCID instruction                      = true
      RTM: restricted transactional memory     = false
      QM: quality of service monitoring        = false
      deprecated FPU CS/DS                     = true
      intel memory protection extensions       = false
      PQE: platform quality of service enforce = false
      AVX512F: AVX-512 foundation instructions = false
      AVX512DQ: double & quadword instructions = false
      RDSEED instruction                       = false
      ADX instructions                         = false
      SMAP: supervisor mode access prevention  = false
      AVX512IFMA: fused multiply add           = false
      CLFLUSHOPT instruction                   = false
      CLWB instruction                         = false
      Intel processor trace                    = false
      AVX512PF: prefetch instructions          = false
      AVX512ER: exponent & reciprocal instrs   = false
      AVX512CD: conflict detection instrs      = false
      SHA instructions                         = false
      AVX512BW: byte & word instructions       = false
      AVX512VL: vector length                  = false
      PREFETCHWT1                              = false
      AVX512VBMI: vector byte manipulation     = false
      UMIP: user-mode instruction prevention   = false
      PKU protection keys for user-mode        = false
      OSPKE CR4.PKE and RDPKRU/WRPKRU          = false
      BNDLDX/BNDSTX MAWAU value in 64-bit mode = 0x0 (0)
      RDPID: read processor D supported        = false
      SGX_LC: SGX launch config supported      = false
      AVX512_4VNNIW: neural network instrs     = false
      AVX512_4FMAPS: multiply acc single prec  = false
   Direct Cache Access Parameters (9):
      PLATFORM_DCA_CAP MSR bits = 0
   Architecture Performance Monitoring Features (0xa/eax):

      version ID                               = 0x1 (1)
      number of counters per logical processor = 0x4 (4)
      bit width of counter                     = 0x30 (48)
      length of EBX bit vector                 = 0x7 (7)
   Architecture Performance Monitoring Features (0xa/ebx):
      core cycle event not available           = true
      instruction retired event not available  = true
      reference cycles event not available     = true
      last-level cache ref event not available = true
      last-level cache miss event not avail    = true
      branch inst retired event not available  = true
      branch mispred retired event not avail   = true
   Architecture Performance Monitoring Features (0xa/edx):
      number of fixed counters    = 0x0 (0)
      bit width of fixed counters = 0x0 (0)
   x2APIC features / processor topology (0xb):
      --- level 0 (thread) ---
      bits to shift APIC ID to get next = 0x0 (0)
      logical processors at this level  = 0x1 (1)
      level number                      = 0x0 (0)
      level type                        = thread (1)
      extended APIC ID                  = 0
      --- level 1 (core) ---
      bits to shift APIC ID to get next = 0x2 (2)
      logical processors at this level  = 0x4 (4)
      level number                      = 0x1 (1)
      level type                        = core (2)
      extended APIC ID                  = 0
   XSAVE features (0xd/0):
      XCR0 lower 32 bits valid bit field mask = 0x00000007
      XCR0 upper 32 bits valid bit field mask = 0x00000000

         XCR0 supported: x87 state            = true
         XCR0 supported: SSE state            = true
         XCR0 supported: AVX state            = true
         XCR0 supported: MPX BNDREGS          = false
         XCR0 supported: MPX BNDCSR           = false
         XCR0 supported: AVX-512 opmask       = false
         XCR0 supported: AVX-512 ZMM_Hi256    = false
         XCR0 supported: AVX-512 Hi16_ZMM     = false
         IA32_XSS supported: PT state         = false
         XCR0 supported: PKRU state           = false
      bytes required by fields in XCR0        = 0x00000340 (832)
      bytes required by XSAVE/XRSTOR area     = 0x00000340 (832)
   XSAVE features (0xd/1):
      XSAVEOPT instruction                        = true
      XSAVEC instruction                          = false
      XGETBV instruction                          = false
      XSAVES/XRSTORS instructions                 = false
      SAVE area size in bytes                     = 0x00000000 (0)
      IA32_XSS lower 32 bits valid bit field mask = 0x00000000
      IA32_XSS upper 32 bits valid bit field mask = 0x00000000
   AVX/YMM features (0xd/2):
      AVX/YMM save state byte size             = 0x00000100 (256)
      AVX/YMM save state byte offset           = 0x00000240 (576)
      supported in IA32_XSS or XCR0            = XCR0 (user state)
      64-byte alignment in compacted XSAVE     = false
   Quality of Service Monitoring Resource Type (0xf/0):
      Maximum range of RMID = 0
      supports L3 cache QoS monitoring = false
   hypervisor_id = "VMwareVMware"
   0x40000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000002 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000004 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000b 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000c 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000d 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000e 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000f 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   hypervisor generic timing information (0x40000010):
      TSC frequency (Hz) = 2593993
      bus frequency (Hz) = 66000
   extended feature flags (0x80000001/edx):
      SYSCALL and SYSRET instructions        = true
      execution disable                      = true
      1-GB large page support                = true
      RDTSCP                                 = true
      64-bit extensions technology available = true
   Intel feature flags (0x80000001/ecx):
      LAHF/SAHF supported in 64-bit mode     = true
      LZCNT advanced bit manipulation        = true
      3DNow! PREFETCH/PREFETCHW instructions = false
   brand = "Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz"
   L1 TLB/cache information: 2M/4M pages & L1 TLB (0x80000005/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 TLB/cache information: 4K pages & L1 TLB (0x80000005/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 data cache information (0x80000005/ecx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L1 instruction cache information (0x80000005/edx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L2 TLB/cache information: 2M/4M pages & L2 TLB (0x80000006/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 TLB/cache information: 4K pages & L2 TLB (0x80000006/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 unified cache information (0x80000006/ecx):
      line size (bytes) = 0x40 (64)
      lines per tag     = 0x0 (0)
      associativity     = 8-way (6)
      size (KB)         = 0x100 (256)
   L3 cache information (0x80000006/edx):
      line size (bytes)     = 0x0 (0)
      lines per tag         = 0x0 (0)
      associativity         = L2 off (0)
      size (in 512KB units) = 0x0 (0)
   Advanced Power Management Features (0x80000007/edx):
      temperature sensing diode      = false
      frequency ID (FID) control     = false
      voltage ID (VID) control       = false
      thermal trip (TTP)             = false
      thermal monitor (TM)           = false
      software thermal control (STC) = false
      100 MHz multiplier control     = false
      hardware P-State control       = false
      TscInvariant                   = true
   Physical Address and Linear Address Size (0x80000008/eax):
      maximum physical address bits         = 0x2a (42)
      maximum linear (virtual) address bits = 0x30 (48)
      maximum guest physical address bits   = 0x0 (0)
   Logical CPU cores (0x80000008/ecx):
      number of CPU cores - 1 = 0x0 (0)
      ApicIdCoreIdSize        = 0x0 (0)
   (multi-processing synth): multi-core (c=4)
   (multi-processing method): Intel leaf 0xb
   (APIC widths synth): CORE_width=2 SMT_width=0
   (APIC synth): PKG_ID=0 CORE_ID=0 SMT_ID=0
   (synth) = Intel Core i7-5000 Extreme Edition (Haswell R2) / Xeon E5-x600 v3 (Haswell-EP C1/M1/R2), 22nm
CPU 1:
   vendor_id = "GenuineIntel"
   version information (1/eax):
      processor type  = primary processor (0)
      family          = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
      model           = 0xf (15)
      stepping id     = 0x2 (2)
      extended family = 0x0 (0)
      extended model  = 0x3 (3)
      (simple synth)  = Intel Core i7-5000 Extreme Edition (Haswell R2) / Xeon E5-x600 v3 (Haswell-EP C1/M1/R2), 22nm
   miscellaneous (1/ebx):
      process local APIC physical ID = 0x1 (1)
      cpu count                      = 0x4 (4)
      CLFLUSH line size              = 0x8 (8)
      brand index                    = 0x0 (0)
   brand id = 0x00 (0): unknown
   feature information (1/edx):
      x87 FPU on chip                        = true
      virtual-8086 mode enhancement          = true
      debugging extensions                   = true
      page size extensions                   = true
      time stamp counter                     = true
      RDMSR and WRMSR support                = true
      physical address extensions            = true
      machine check exception                = true
      CMPXCHG8B inst.                        = true
      APIC on chip                           = true
      SYSENTER and SYSEXIT                   = true
      memory type range registers            = true
      PTE global bit                         = true
      machine check architecture             = true
      conditional move/compare instruction   = true
      page attribute table                   = true
      page size extension                    = true
      processor serial number                = false
      CLFLUSH instruction                    = true
      debug store                            = true
      thermal monitor and clock ctrl         = false
      MMX Technology                         = true
      FXSAVE/FXRSTOR                         = true
      SSE extensions                         = true
      SSE2 extensions                        = true
      self snoop                             = true
      hyper-threading / multi-core supported = true
      therm. monitor                         = false
      IA64                                   = false
      pending break event                    = false
   feature information (1/ecx):
      PNI/SSE3: Prescott New Instructions     = true
      PCLMULDQ instruction                    = true
      64-bit debug store                      = false
      MONITOR/MWAIT                           = false
      CPL-qualified debug store               = false
      VMX: virtual machine extensions         = false
      SMX: safer mode extensions              = false
      Enhanced Intel SpeedStep Technology     = false
      thermal monitor 2                       = false
      SSSE3 extensions                        = true
      context ID: adaptive or shared L1 data  = false
      FMA instruction                         = true
      CMPXCHG16B instruction                  = true
      xTPR disable                            = false
      perfmon and debug                       = false
      process context identifiers             = true
      direct cache access                     = false
      SSE4.1 extensions                       = true
      SSE4.2 extensions                       = true
      extended xAPIC support                  = true
      MOVBE instruction                       = true
      POPCNT instruction                      = true
      time stamp counter deadline             = true
      AES instruction                         = true
      XSAVE/XSTOR states                      = true
      OS-enabled XSAVE/XSTOR                  = true
      AVX: advanced vector extensions         = true
      F16C half-precision convert instruction = true
      RDRAND instruction                      = true
      hypervisor guest status                 = true
   cache and TLB information (2):
      0x63: data TLB: 1G pages, 4-way, 4 entries
      0x03: data TLB: 4K pages, 4-way, 64 entries
      0x76: instruction TLB: 2M/4M pages, fully, 8 entries
      0xff: cache data is in CPUID 4
      0xb5: instruction TLB: 4K, 8-way, 64 entries
      0xf0: 64 byte prefetching
      0xc1: L2 TLB: 4K/2M pages, 8-way, 1024 entries
   processor serial number: 0003-06F2-0000-0000-0000-0000
   deterministic cache parameters (4):
      --- cache 0 ---
      cache type                           = data cache (1)
      cache level                          = 0x1 (1)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 63
      --- cache 1 ---
      cache type                           = instruction cache (2)
      cache level                          = 0x1 (1)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
     WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 63
      --- cache 2 ---
      cache type                           = unified cache (3)
      cache level                          = 0x2 (2)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x7 (7)
      ways of associativity                = 0x0 (0)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = false
      complex cache indexing               = false
      number of sets - 1 (s)               = 511
      --- cache 3 ---
      cache type                           = unified cache (3)
      cache level                          = 0x3 (3)
      self-initializing cache level        = true
      fully associative cache              = false
      extra threads sharing this cache     = 0x3 (3)
      extra processor cores on this die    = 0x3 (3)
      system coherency line size           = 0x3f (63)
      physical line partitions             = 0x0 (0)
      ways of associativity                = 0x13 (19)
      ways of associativity                = 0x6 (6)
      WBINVD/INVD behavior on lower caches = false
      inclusive to lower caches            = true
      complex cache indexing               = true
      number of sets - 1 (s)               = 20479
   MONITOR/MWAIT (5):
      smallest monitor-line size (bytes)       = 0x0 (0)
      largest monitor-line size (bytes)        = 0x0 (0)
      enum of Monitor-MWAIT exts supported     = false
      supports intrs as break-event for MWAIT  = false
      number of C0 sub C-states using MWAIT    = 0x0 (0)
      number of C1 sub C-states using MWAIT    = 0x0 (0)
      number of C2 sub C-states using MWAIT    = 0x0 (0)
      number of C3 sub C-states using MWAIT    = 0x0 (0)
      number of C4 sub C-states using MWAIT    = 0x0 (0)
      number of C5 sub C-states using MWAIT    = 0x0 (0)
      number of C6 sub C-states using MWAIT    = 0x0 (0)
      number of C7 sub C-states using MWAIT    = 0x0 (0)
   Thermal and Power Management Features (6):
      digital thermometer                     = true
      Intel Turbo Boost Technology            = true
      ARAT always running APIC timer          = true
      PLN power limit notification            = true
      ECMD extended clock modulation duty     = true
      PTM package thermal management          = true
      HWP base registers                      = false
      HWP notification                        = false
      HWP activity window                     = false
      HWP energy performance preference       = false
      HWP package level request               = false
      HDC base registers                      = false
      digital thermometer thresholds          = 0x2 (2)
      ACNT/MCNT supported performance measure = true
      ACNT2 available                         = false
      performance-energy bias capability      = true
   extended feature flags (7):
      FSGSBASE instructions                    = true
      IA32_TSC_ADJUST MSR supported            = true
      SGX: Software Guard Extensions supported = false
      BMI instruction                          = true
      HLE hardware lock elision                = false
      AVX2: advanced vector extensions 2       = true
      FDP_EXCPTN_ONLY                          = false
      SMEP supervisor mode exec protection     = true
      BMI2 instructions                        = true
      enhanced REP MOVSB/STOSB                 = true
      INVPCID instruction                      = true
      RTM: restricted transactional memory     = false
      QM: quality of service monitoring        = false
      deprecated FPU CS/DS                     = true
      intel memory protection extensions       = false
      PQE: platform quality of service enforce = false
      AVX512F: AVX-512 foundation instructions = false
      AVX512DQ: double & quadword instructions = false
      RDSEED instruction                       = false
      ADX instructions                         = false
      SMAP: supervisor mode access prevention  = false
      AVX512IFMA: fused multiply add           = false
      CLFLUSHOPT instruction                   = false
      CLWB instruction                         = false
      Intel processor trace                    = false
      AVX512PF: prefetch instructions          = false
      AVX512ER: exponent & reciprocal instrs   = false
      AVX512CD: conflict detection instrs      = false
      SHA instructions                         = false
      AVX512BW: byte & word instructions       = false
      AVX512VL: vector length                  = false
      PREFETCHWT1                              = false
      AVX512VBMI: vector byte manipulation     = false
      UMIP: user-mode instruction prevention   = false
      PKU protection keys for user-mode        = false
      OSPKE CR4.PKE and RDPKRU/WRPKRU          = false
      BNDLDX/BNDSTX MAWAU value in 64-bit mode = 0x0 (0)
      RDPID: read processor D supported        = false
      SGX_LC: SGX launch config supported      = false
      AVX512_4VNNIW: neural network instrs     = false
      AVX512_4FMAPS: multiply acc single prec  = false
   Direct Cache Access Parameters (9):
      PLATFORM_DCA_CAP MSR bits = 0
   Architecture Performance Monitoring Features (0xa/eax):
      version ID                               = 0x1 (1)
      number of counters per logical processor = 0x4 (4)
      bit width of counter                     = 0x30 (48)
      length of EBX bit vector                 = 0x7 (7)
   Architecture Performance Monitoring Features (0xa/ebx):
      core cycle event not available           = true
      instruction retired event not available  = true
      reference cycles event not available     = true
      last-level cache ref event not available = true
      last-level cache miss event not avail    = true
      branch inst retired event not available  = true
      branch mispred retired event not avail   = true
   Architecture Performance Monitoring Features (0xa/edx):
      number of fixed counters    = 0x0 (0)
      bit width of fixed counters = 0x0 (0)
   x2APIC features / processor topology (0xb):
      --- level 0 (thread) ---
      bits to shift APIC ID to get next = 0x0 (0)
      logical processors at this level  = 0x1 (1)
      level number                      = 0x0 (0)
      level type                        = thread (1)
      extended APIC ID                  = 1
      --- level 1 (core) ---
      bits to shift APIC ID to get next = 0x2 (2)
      logical processors at this level  = 0x4 (4)
      level number                      = 0x1 (1)
      level type                        = core (2)
      extended APIC ID                  = 1
   XSAVE features (0xd/0):
      XCR0 lower 32 bits valid bit field mask = 0x00000007
      XCR0 upper 32 bits valid bit field mask = 0x00000000
         XCR0 supported: x87 state            = true
         XCR0 supported: SSE state            = true
         XCR0 supported: AVX state            = true
         XCR0 supported: MPX BNDREGS          = false
         XCR0 supported: MPX BNDCSR           = false
         XCR0 supported: AVX-512 opmask       = false
         XCR0 supported: AVX-512 ZMM_Hi256    = false
         XCR0 supported: AVX-512 Hi16_ZMM     = false
         IA32_XSS supported: PT state         = false
         XCR0 supported: PKRU state           = false
      bytes required by fields in XCR0        = 0x00000340 (832)
      bytes required by XSAVE/XRSTOR area     = 0x00000340 (832)
   XSAVE features (0xd/1):
      XSAVEOPT instruction                        = true
      XSAVEC instruction                          = false
      XGETBV instruction                          = false
      XSAVES/XRSTORS instructions                 = false
      SAVE area size in bytes                     = 0x00000000 (0)
      IA32_XSS lower 32 bits valid bit field mask = 0x00000000
      IA32_XSS upper 32 bits valid bit field mask = 0x00000000
   AVX/YMM features (0xd/2):
      AVX/YMM save state byte size             = 0x00000100 (256)
      AVX/YMM save state byte offset           = 0x00000240 (576)
      supported in IA32_XSS or XCR0            = XCR0 (user state)
      64-byte alignment in compacted XSAVE     = false
   Quality of Service Monitoring Resource Type (0xf/0):
      Maximum range of RMID = 0
      supports L3 cache QoS monitoring = false
   hypervisor_id = "VMwareVMware"
   0x40000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000002 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000004 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x40000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000a 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000b 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000c 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000d 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000e 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x4000000f 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   hypervisor generic timing information (0x40000010):
      TSC frequency (Hz) = 2593993
      bus frequency (Hz) = 66000
   extended feature flags (0x80000001/edx):
      SYSCALL and SYSRET instructions        = true
      execution disable                      = true
      1-GB large page support                = true
      RDTSCP                                 = true
      64-bit extensions technology available = true
   Intel feature flags (0x80000001/ecx):
      LAHF/SAHF supported in 64-bit mode     = true
      LZCNT advanced bit manipulation        = true
      3DNow! PREFETCH/PREFETCHW instructions = false
   brand = "Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz"
   L1 TLB/cache information: 2M/4M pages & L1 TLB (0x80000005/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 TLB/cache information: 4K pages & L1 TLB (0x80000005/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 data cache information (0x80000005/ecx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L1 instruction cache information (0x80000005/edx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L2 TLB/cache information: 2M/4M pages & L2 TLB (0x80000006/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 TLB/cache information: 4K pages & L2 TLB (0x80000006/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 unified cache information (0x80000006/ecx):
      line size (bytes) = 0x40 (64)
      lines per tag     = 0x0 (0)
      associativity     = 8-way (6)
      size (KB)         = 0x100 (256)
   L3 cache information (0x80000006/edx):
      line size (bytes)     = 0x0 (0)
      lines per tag         = 0x0 (0)
      associativity         = L2 off (0)
      size (in 512KB units) = 0x0 (0)
   Advanced Power Management Features (0x80000007/edx):
      temperature sensing diode      = false
      frequency ID (FID) control     = false
      voltage ID (VID) control       = false
      thermal trip (TTP)             = false
      thermal monitor (TM)           = false
      software thermal control (STC) = false
      100 MHz multiplier control     = false
      hardware P-State control       = false
      TscInvariant                   = true
   Physical Address and Linear Address Size (0x80000008/eax):
      maximum physical address bits         = 0x2a (42)
      maximum linear (virtual) address bits = 0x30 (48)
      maximum guest physical address bits   = 0x0 (0)
   Logical CPU cores (0x80000008/ecx):
      number of CPU cores - 1 = 0x0 (0)
      ApicIdCoreIdSize        = 0x0 (0)
   (multi-processing synth): multi-core (c=4)
   (multi-processing method): Intel leaf 0xb
   (APIC widths synth): CORE_width=2 SMT_width=0
   (APIC synth): PKG_ID=0 CORE_ID=1 SMT_ID=0
   (synth) = Intel Core i7-5000 Extreme Edition (Haswell R2) / Xeon E5-x600 v3 (Haswell-EP C1/M1/R2), 22nm
CPU 2: .....省略

7.hardinfo工具
  

https://www.hwinfo.com/ 下载

 8.nproc命令

[root@ht8 ~]# nproc
8  //nproc - print the number of processing units available

9.dmidecode -t 4

 

CPU和IO debug工具

 uptime命令

[root@ht8 acpi]# uptime
 17:15:35 up 92 days, 20:37,  1 user,  load average: 1.00, 0.77, 0.73

stress命令

yum install stress
[root@ht8 acpi]# stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s
stress: info: [117017] dispatching hogs: 8 cpu, 4 io, 2 vm, 0 hdd
stress: info: [117017] successful run completed in 10s

--cpu 8:8个进程不停的执行sqrt()计算操作
--io 4:4个进程不同的执行sync()io操作(刷盘)
--vm 2:2个进程不停的执行malloc()内存申请操作
--vm-bytes 128M:限制1个执行malloc的进程申请内存大小

[root@ht8 acpi]#stress -i 1  //来模拟 IO 瓶颈问题,即死循环执行 sync 刷盘操作

使用uptime查看此时系统负载

[root@ht8 acpi]# watch -d uptime
//-d 参数表示高亮显示变化的区域
mpstat
[root@ht8 acpi]# mpstat
Linux 3.10.0-1160.45.1.el7.x86_64 (ht8.node)     04/08/2022     _x86_64_    (8 CPU)

05:18:45 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
05:18:45 PM  all    0.33    0.00    0.17    0.00    0.00    0.00    0.00    0.00    0.00   99.49

[root@ht8 acpi]# mpstat -P ALL 1则可以查看每一秒的 CPU 每一核变化信息

pidstat

[root@ht8 acpi]# pidstat -w -u -t 1
-w表示查看进程切换信息,-u查看CPU信息,-t查看线程切换信息

观察中断情况

[root@ht8 acpi]#  watch -d cat /proc/softirqs

 

 

 

pni
这篇关于有用的几个得到cpu信息的命令的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!