top
Once in top.. hit 'z' to colourize, '1' to show individual cpu cores, '?' for other optionshtop
htop
dstat -c --top-cpu
topas
tprof -skeu -x sleep 10
tprof -skex sleep 10
Load average generally display three figures representing the average load over the last 1 minute, 5 minutes, and 15 minutes. The load average is displayed by various tools (w,top, htop), but this is probably the simplest...
uptime
On Linux, system load includes threads in Runnable (R) and in Uninterruptible sleep (D) states (typically disk I/O). On other flavours of UNIX this is usually just R (not D).Load should be less than the number of cores in your system. i.e. On a single core machine you would want load to be less than 1. On a quad core machine you would want load to be less than 4.
We can see which users are contributing to system load using...
ps -eo s,user | grep ^[RD] | sort | uniq -c | sort -nbr | head -20
On Linux, system load includes threads in Runnable (R) and in Uninterruptible sleep (D) states (typically disk I/O). On other flavours of UNIX this is usually just R (not D).To see what they are running use...
ps -eo s,user,cmd | grep ^[RD] | sort | uniq -c | sort -nbr | head -20
On Linux, system load includes threads in Runnable (R) and in Uninterruptible sleep (D) states (typically disk I/O). On other flavours of UNIX this is usually just R (not D).The vmstat command also gives some useful information. The first two columns under "procs" on Linux or "kthr" on AIX show runnable (r) and blocked (b) processes/threads. The value of "r" should generally be less than or equal to the number of logical CPUs. The value of "b" should generally be zero.
vmstat -wWI 2 10
sysbench --test=cpu run
Screenshot is from hardinfo. This tends to be available in Ubuntu as "System Profiler and Benchmark"
TODO
nproc --all
getconf _NPROCESSORS_ONLN
lscpu
cat /proc/cpuinfo
sudo dmidecode -t 4
sudo lshw -class processor
sudo dmidecode -t 4 | egrep -i 'core (count|enabled)|thread count|Version'
hwinfo --cpu --short
hwinfo --cpu
inxi -Cx -c 5
cpuid -1
The -1 flag stops cpuid returning duplicate information (if you know all CPUs are the same)CPU SMT Type...
lparstat -i | grep ^Type
LPAR CPU usage Mode...
lparstat -i | grep ^Mode
LPAR CPU Entitlement...
lparstat -i | grep Entitled | grep -v of
Online Virtual CPUs...
lparstat -i | grep "Online Virtual"
Shared Pool ID...
lparstat -i | grep "Shared Pool ID"
Active CPUs in Pool...
lparstat -i | grep "Active CPUs in Pool"
CPU Type/Speed...
prtconf | grep "Processor Type"
prtconf -s
prtconf -c
arch
uname -m
getconf LONG_BIT
lscpu | grep Architecture
hwinfo --cpu | grep Arch | uniq
inxi -Cx | grep bits
You can see details of SMT using the smtctl command (but this is only executable by 'root' and can be a bad thing if run with the wrong arguments... i.e. it can turn off SMT).
smtctl
This system is SMT capable.
This system supports up to 4 SMT threads per processor.
SMT is currently enabled.
SMT boot mode is not set.
SMT threads are bound to the same virtual processor.
proc0 has 4 SMT threads.
Bind processor 0 is bound with proc0
Bind processor 1 is bound with proc0
Bind processor 2 is bound with proc0
Bind processor 3 is bound with proc0
Things like OEM and topas see each thread as a cpu and therefore show 4 cpus, when in fact they are all just simultaneous threads on the same core... which can be very misleading... to make matters worse 4 threads cannot do the same work as 4 dedicated cores... so even cpu utilisation figures can be skewed... i.e. if you are running 1 transaction in 1 second on 1 thread, you won't be able to run 2 transactions in 1 second using 2 threads (but you might get 2 transactions in 1.5 seconds using 2 threads instead of the 2 transactions in 2 seconds that you would expect from a single thread... i.e. it makes better use of the cores than single threading but there are still bottlenecks that stop 2 transactions running at full speed through the same cpu core at the same time)... if you looked at topas whilst your hypothetical 1 transaction in 1 second was running on 1 thread you would see cpu utilisation of 25% on a core with 4 threads (which just isn't true).