Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

CPU

CPU

Some applications will spread cpu load evenly on a multi-core system, others will peg one CPU and ignore the others. Look at top, P or commands like: ps to see top CPU hogs.

ps -e -o pcpu,pmem,args --sort=-pcpu | head -n 11
%CPU %MEM COMMAND
 0.2  8.0 /usr/sbin/mariadbd
 0.1  6.3 /usr/sbin/apache2 -k start
 0.1  6.3 /usr/sbin/apache2 -k start
 0.0  6.2 /usr/sbin/apache2 -k start
 0.0  6.1 /usr/sbin/apache2 -k start
 0.0  6.1 /usr/sbin/apache2 -k start
 0.0  6.1 /usr/sbin/apache2 -k start
 0.0  5.4 /lib/systemd/systemd-journald
 0.0  2.0 /usr/sbin/apache2 -k start
 0.0  1.7 /usr/lib/snapd/snapd

You can see all CPU and their loads by running the top command and then hitting the “1” key:

WhatDescription
ussome user model process is doing pure computational work, like maybe that python script you just wrote
sykernel level things such as memory management, console, network devices
ididle time. CPU is just doing nothing

what type of cpu do I have?

lscpu

└─$ lscpu
Architecture:        	x86_64
  CPU op-mode(s):    	32-bit, 64-bit
  Address sizes:     	39 bits physical, 48 bits virtual
  Byte Order:        	Little Endian
CPU(s):              	24
  On-line CPU(s) list:   0-23
Vendor ID:           	GenuineIntel
  Model name:        	13th Gen Intel(R) Core(TM) i7-13700HX
	CPU family:      	6
	Model:           	191
	Thread(s) per core:  2
	Core(s) per socket:  16
	Socket(s):       	1
	Stepping:        	2
	CPU(s) scaling MHz:  20%
	CPU max MHz:     	5000.0000
	CPU min MHz:     	800.0000
	BogoMIPS:        	4608.00
	Flags:           	fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology
                      	nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm a
                     	bm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xs
                     	aveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm
                      	md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualization features:
  Virtualization:    	VT-x
Caches (sum of all):	 
  L1d:               	640 KiB (16 instances)
  L1i:               	768 KiB (16 instances)
  L2:                	14 MiB (10 instances)
  L3:                	30 MiB (1 instance)
NUMA:               	 
  NUMA node(s):      	1
  NUMA node0 CPU(s): 	0-23
Vulnerabilities:    	 
  Gather data sampling:  Not affected
  Itlb multihit:     	Not affected
  L1tf:              	Not affected
  Mds:               	Not affected
  Meltdown:          	Not affected
  Mmio stale data:   	Not affected
  Retbleed:          	Not affected
  Spec rstack overflow:  Not affected
  Spec store bypass: 	Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:        	Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:        	Mitigation; Enhanced / Automatic IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
  Srbds:             	Not affected
  Tsx async abort:   	Not affected

inxi

inxi -CfxCa

CPU:
  Info: model: 13th Gen Intel Core i7-13700HX bits: 64 type: MST AMCP
    arch: Raptor Lake gen: core 13 level: v3 note: check built: 2022+
    process: Intel 7 (10nm) family: 6 model-id: 0xBF (191) stepping: 2
    microcode: 0x32
  Topology: cpus: 1x cores: 16 mt: 8 tpc: 2 st: 8 threads: 24 smt: enabled
    cache: L1: 1.4 MiB desc: d-8x32 KiB, 8x48 KiB; i-8x32 KiB, 8x64 KiB
    L2: 14 MiB desc: 8x1.2 MiB, 2x2 MiB L3: 30 MiB desc: 1x30 MiB
  Speed (MHz): avg: 899 high: 1357 min/max: 800/4800:5000:3700 scaling:
    driver: intel_pstate governor: powersave cores: 1: 1274 2: 800 3: 800 4: 800
    5: 1038 6: 800 7: 953 8: 800 9: 800 10: 800 11: 1357 12: 1095 13: 1097
    14: 800 15: 917 16: 800 17: 800 18: 909 19: 800 20: 800 21: 800 22: 881
    23: 866 24: 800 bogomips: 110592
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_lbr arch_perfmon art avx avx2 avx_vnni bmi1 bmi2
    bts clflush clflushopt clwb cmov constant_tsc cpuid cpuid_fault cx16 cx8
    de ds_cpl dtes64 dtherm dts epb ept ept_ad erms est f16c flexpriority
    flush_l1d fma fpu fsgsbase fsrm fxsr gfni hfi ht hwp hwp_act_window
    hwp_epp hwp_notify hwp_pkg_req ibpb ibrs ibrs_enhanced ibt ida intel_pt
    invpcid lahf_lm lm mca mce md_clear mmx monitor movbe movdir64b movdiri
    msr mtrr nonstop_tsc nopl nx ospke pae pat pbe pclmulqdq pdcm pdpe1gb
    pebs pge pku pln pni popcnt pse pse36 pts rdpid rdrand rdseed rdtscp
    rep_good sdbg sep serialize sha_ni smap smep ss ssbd sse sse2 sse4_1
    sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust
    tsc_deadline_timer tsc_known_freq umip vaes vme vmx vnmi vpclmulqdq vpid
    waitpkg x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB
    filling, PBRSB-eIBRS: SW sequence
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected

CPU Benchmarks

└─$ sysbench --test=cpu --cpu-max-prime=20000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
	events per second:  1260.00

General statistics:
	total time:                      	10.0004s
	total number of events:          	12602

Latency (ms):
     	min:                                	0.79
     	avg:                                	0.79
     	max:                                	0.87
     	95th percentile:                    	0.80
     	sum:                             	9998.97

Threads fairness:
	events (avg/stddev):       	12602.0000/0.00
	execution time (avg/stddev):   9.9990/0.00