9 Mapuslanon nga mga Sugo sa Pagkuha sa Impormasyon sa CPU sa Linux


Sa usa ka miaging artikulo, nagbutang kami usa ka lista sa 10 nga mapuslanon nga mga sugo aron makolekta ang impormasyon sa sistema ug hardware sa Linux. Sa kini nga giya, among ipunting ang CPU/processor, ug ipakita kanimo ang lainlaing mga paagi sa pagkuha sa detalyado nga kasayuran bahin sa CPU sa imong makina.

Para lang mahatagan ka ug overview, mangayo mig impormasyon sama sa CPU architecture, vendor_id, model, model name, gidaghanon sa CPU cores, speed sa matag core, ug daghan pa.
Sa esensya, ang /proc/cpuinfo naglangkob niining tanan nga impormasyon, ang matag uban nga command/utility makakuha sa iyang output gikan niini nga file.

Sa ingon niana, sa ubos mao ang 9 nga mga sugo alang sa pagkuha og impormasyon bahin sa imong Linux CPU.

1. Pagkuha og CPU Info Gamit ang iring Command

Mahimo nimong tan-awon ang kasayuran sa imong sistema sa CPU pinaagi sa pagtan-aw sa sulud sa /proc/cpuinfo file sa tabang sa cat command sama sa mosunod:

$ cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 69
model name	: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
stepping	: 1
microcode	: 0x1c
cpu MHz		: 1700.062
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts
bugs		:
bogomips	: 4788.92
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:
......

Aron makakuha og gamay nga espesipiko, mahimo nimong gamiton ang grep command - usa ka CLI nga himan alang sa pagpangita sa yano nga teksto nga datos alang sa mga linya nga katumbas sa usa ka regular nga ekspresyon. Makatabang kini kanimo nga magpagawas lamang sa ngalan sa vendor, ngalan sa modelo, gidaghanon sa mga processor, gidaghanon sa mga core, ug uban pa:

$ cat /proc/cpuinfo | grep 'vendor' | uniq		#view vendor name
$ cat /proc/cpuinfo | grep 'model name' | uniq		#display model name
$ cat /proc/cpuinfo | grep processor | wc -l		#count the number of processing units
$ cat /proc/cpuinfo | grep 'core id'			#show individual cores	

2. lscpu Command – Nagpakita sa CPU Architecture Info

Ang command lscpu nag-imprinta sa impormasyon sa arkitektura sa CPU gikan sa sysfs ug /proc/cpuinfo sama sa gipakita sa ubos:

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 69
Model name:            Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
Stepping:              1
CPU MHz:               1303.687
CPU max MHz:           2700.0000
CPU min MHz:           800.0000
BogoMIPS:              4788.92
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts

3. cpuid Command - Nagpakita x86 CPU

Ang command cpuid molabay sa kompletong impormasyon bahin sa (mga) CPU nga nakolekta gikan sa CPUID nga instruksiyon, ug makadiskobre usab sa eksaktong modelo sa x86 (mga) CPU gikan sa maong impormasyon.

Siguroha nga i-install kini sa dili pa kini modagan.

$ sudo apt install cpuid        #Debian/Ubuntu systems
$ sudo yum install cpuid	#RHEL/CentOS systems 
$ sudo dnf install cpuid	#Fedora 22+ 

Kung ma-install, pagdagan ang cpuid aron makolekta ang kasayuran bahin sa x86 CPU.

$ cpuid
CPU 0:
   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           = 0x5 (5)
      stepping id     = 0x1 (1)
      extended family = 0x0 (0)
      extended model  = 0x4 (4)
      (simple synth)  = Intel Mobile Core i3-4000Y / Mobile Core i5-4000Y / Mobile Core i7-4000Y / Mobile Pentium 3500U/3600U/3500Y / Mobile Celeron 2900U (Mobile U/Y) (Haswell), 22nm
   miscellaneous (1/ebx):
      process local APIC physical ID = 0x0 (0)
      cpu count                      = 0x10 (16)
      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
....

4. dmidecode Command – Nagpakita sa Linux Hardware Info

Ang dmidecode usa ka himan alang sa pagkuha sa impormasyon sa hardware sa bisan unsang sistema sa Linux. Gilabay niini ang mga sulod sa lamesa sa DMI (a.k.a SMBIOS) sa kompyuter sa pormat nga mabasa sa tawo para daling makuha. Ang detalye sa SMBIOS naghubit sa lain-laing mga matang sa DMI, alang sa CPU, gamita ang \processor ingon sa mosunod:

$ sudo dmidecode --type processor
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0004, DMI type 4, 42 bytes
Processor Information
	Socket Designation: U3E1
	Type: Central Processor
	Family: Core i5
	Manufacturer: Intel(R) Corporation
	ID: 51 06 04 00 FF FB EB BF
	Signature: Type 0, Family 6, Model 69, Stepping 1
	Flags:
		FPU (Floating-point unit on-chip)
		VME (Virtual mode extension)
		DE (Debugging extension)
		PSE (Page size extension)
		TSC (Time stamp counter)
		MSR (Model specific registers)
		PAE (Physical address extension)
		MCE (Machine check exception)
		CX8 (CMPXCHG8 instruction supported)
		APIC (On-chip APIC hardware supported)
		SEP (Fast system call)
		MTRR (Memory type range registers)
		PGE (Page global enable)
		MCA (Machine check architecture)
.....

5. Tool sa Inxi – Nagpakita sa Impormasyon sa Sistema sa Linux

Ang Inxi usa ka gamhanan nga command-line system information script nga gituyo alang sa console ug IRC (Internet Relay Chat). Mahimo nimong gamiton kini aron makuha dayon ang impormasyon sa hardware.

Mahimo nimong i-install sama niini:

$ sudo apt install inxi 	#Debian/Ubuntu systems
$ sudo yum install inxi		#RHEL/CentOS systems 
$ sudo dnf install inxi		#Fedora 22+ 

Aron ipakita ang kompletong impormasyon sa CPU, lakip ang kada CPU clock-speed ug CPU max speed (kon anaa), gamita ang -C flag sama sa mosunod:

$ inxi -C
CPU:       Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KB 
           clock speeds: max: 2700 MHz 1: 1958 MHz 2: 1993 MHz 3: 1775 MHz 4: 1714 MHz

6. lshw Tool – Ilista ang Hardware Configuration

Ang lshw usa ka gamay nga himan alang sa pagkolekta sa lawom nga kasayuran sa pag-configure sa hardware sa usa ka kompyuter. Mahimo nimong gamiton ang -C nga kapilian aron mapili ang klase sa hardware, CPU niini nga kaso:

$ sudo lshw -C CPU
*-cpu                   
       description: CPU
       product: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
       vendor: Intel Corp.
       physical id: 4
       bus info: [email 
       version: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
       serial: To Be Filled By O.E.M.
       slot: U3E1
       size: 2626MHz
       capacity: 2700MHz
       width: 64 bits
       clock: 100MHz
       capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts cpufreq
       configuration: cores=2 enabledcores=2 threads=4

7. hardiinfo – Nagpakita sa Impormasyon sa Hardware sa GTK+ Window

Ang hardifo nagpakita sa impormasyon sa hardware sa GTK + nga bintana, mahimo nimo kining i-install sama sa mosunod:

$ sudo apt install hardinfo 	#Debian/Ubuntu systems
$ sudo yum install hardinfo	#RHEL/CentOS systems 
$ sudo dnf install hardinfo	#Fedora 22+ 

Kung na-install na nimo kini, i-type ang:

$ hardinfo 

Makahimo usab kini kanimo nga makamugna og report sa impormasyon sa sistema sa hardware pinaagi sa pag-klik sa buton nga \Pagmugna og Report. Timan-i nga mahimo nimong pilion ang kategorya sa impormasyon sa hardware nga mahimo.

Kung nahimo na nimo ang report sa html nga pormat, mahimo nimo kining tan-awon gikan sa web browser sama sa gipakita sa ubos.

8. hwinfo – Nagpakita Karon nga Impormasyon sa Hardware

Ang hwinfo gigamit sa pagkuha sa impormasyon mahitungod sa hardware nga anaa sa usa ka Linux system. Para ipakita ang impormasyon bahin sa imong CPU, gamita ang --cpu

$ hwinfo --cpu
01: None 00.0: 10103 CPU                                        
  [Created at cpu.460]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.69.1 "Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz"
  Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,pdpe1gb,rdtscp,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,nopl,xtopology,nonstop_tsc,aperfmperf,eagerfpu,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,est,tm2,ssse3,sdbg,fma,cx16,xtpr,pdcm,pcid,sse4_1,sse4_2,movbe,popcnt,tsc_deadline_timer,aes,xsave,avx,f16c,rdrand,lahf_lm,abm,epb,tpr_shadow,vnmi,flexpriority,ept,vpid,fsgsbase,tsc_adjust,bmi1,avx2,smep,bmi2,erms,invpcid,xsaveopt,dtherm,ida,arat,pln,pts
  Clock: 2080 MHz
  BogoMips: 4788.92
  Cache: 3072 kb
  Units/Processor: 16
  Config Status: cfg=new, avail=yes, need=no, active=unknown
....

9. nproc – I-print nga Gidaghanon sa Processing Units

Ang nproc command gigamit aron ipakita ang gidaghanon sa processing unit nga anaa sa imong computer:

$ nproc

Alang sa dugang nga impormasyon sa paggamit ug mga kapilian, basaha ang mga panid sa tawo niining mga sugo sama niini:

$ man commandname

Usab, tan-awa:

  1. Cpustat – Nagmonitor sa Paggamit sa CPU pinaagi sa Pagdagan sa mga Proseso sa Linux
  2. CoreFreq – Usa ka Gamhanan nga Himan sa Pag-monitor sa CPU alang sa Linux Systems
  3. Pangitaa ang Nanguna nga Mga Proseso sa Pagdagan pinaagi sa Labing Taas nga Memorya ug Paggamit sa CPU sa Linux
  4. Unsaon Pagpahamtang ug Taas nga CPU Load ug Stress Test sa Linux Gamit ang 'Stress-ng' Tool

Mao na sa pagkakaron! Mahimo nimong ipaambit kanamo ang dugang nga mga paagi sa pagkuha sa impormasyon sa CPU sa Linux pinaagi sa feedback nga porma sa ubos.