• Understanding CPU Utilization

 
 
Print Friendly, PDF & Email

Introduction

This article explains the different values from the CPU utilization output, down to the per-thread CPU usage on an Arista EOS.

To this aim, we will cover the topics in different sections, as follows:

  1. How to view the CPU usage
  2. Understanding CPU Usage – Row 1
  3. Understanding CPU Usage – Row 2
  4. Understanding CPU Usage – Row 3
  5. Understanding CPU Usage – Row 4
  6. Understanding CPU Usage – Row 5
  7. How to view CPU usage on a multi core switch?
  8. Understanding CPU Processes

 

 

1) How to view the CPU usage

To view the CPU usage, use the top command from either CLI or Bash:

  • CLI: show process top
  • Bash: top

The following shows the CPU utilization on an Arista Switch:

switch# show process top
 
 ***Header***
 top - 15:52:02 up  6:55,  1 user,  load average: 0.08, 0.02, 0.01
 Tasks: 132 total,   1 running, 131 sleeping,   0 stopped,   0 zombie
 Cpu(s): 13.5%us,  0.5%sy,  0.0%ni, 86.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
 Mem:   2043420k total,  1296716k used,   746704k free,   107812k buffers
 Swap:        0k total,        0k used,        0k free,   768644k cached
 
 ***Processes***
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1469 root      20   0  460m  79m  33m S 12.0  4.0  53:54.75 FocalPoint
1483 root      20   0  167m  41m  15m S  2.3  2.1  15:04.18 PhyTn
1491 root      20   0  169m  42m  13m S  2.3  2.1  13:57.29 Mdio
1494 root      20   0  173m  43m  16m S  2.0  2.2   3:44.96 FruSnmp
1444 root      20   0  183m  78m  42m S  1.7  4.0   8:06.73 Sysdb
1442 root      20   0  161m  26m 2120 S  0.7  1.3   1:37.10 ProcMgr-worker
1474 root      20   0  163m  36m  11m S  0.7  1.8   1:49.16 PhyEthtool
1445 root      20   0  182m  65m  33m S  0.3  3.3   0:58.03 Fru
1461 root      20   0  186m  55m  27m S  0.3  2.8   0:50.46 Snmp
1468 root      20   0  183m  52m  25m S  0.3  2.6   0:29.40 Mlag
1470 root      20   0  175m  46m  19m S  0.3  2.3   0:58.93 Lag+LacpAgent
1475 root      20   0  164m  38m  12m S  0.3  1.9   1:04.16 Adt7462Agent
1479 root      20   0  172m  40m  15m S  0.3  2.0   1:22.02 MlagTunnel
1482 root      20   0  164m  37m  12m S  0.3  1.9   1:18.18 Smbus
1503 root      20   0  171m  39m  17m S  0.3  2.0   0:52.25 Sflow
1505 root      20   0  163m  35m  10m S  0.3  1.8   0:31.05 Thermostat
   1 root      20   0  2064  916  688 S  0.0  0.0   0:00.43 init

To break out of the output press CTRL + C
In bash mode, to see further options for the TOP command, you may visit this page :

http://linux.about.com/od/commands/l/blcmdl1_top.htm

 

 

2) Understanding CPU Usage – Row 1

 

Row 1 of “show process top” :

 top - 15:52:02 up  6:55,  1 user,  load average: 0.08, 0.02, 0.01

The following will now explain the first row of the header section:

 

up

System uptime.
In our example, the switch has been up for 15hrs 52 minutes and 2 seconds.

user

Number of users logged into the system.
In our example, only 1 user has logged into the switch.

load average

This is the average load for the last 1 minute, 5 minutes and 15 minutes.
In our example, the average is 8%, 2% and 1%.

 

 

3) Understanding CPU Usage – Row 2

 

Row 2 of “show process top” :

 Tasks: 132 total,   1 running, 131 sleeping,   0 stopped,   0 zombie

The following will now explain the second row of the header section:

 

Tasks

The number of processes running
In our example, there are 132 processes running

running.

The number of processes actively running.
In our example, only 1 process is actively running.

sleeping

The number of processes sleeping in the background.
In our example, 131 processes are sleeping.

stopped

The number of processes which have stopped.
In our example, no processes have been stopped.

zombie

The number of dead processes.
In our example, there are no dead processes.

See the S column below for the syntax for

 

 

4) Understanding CPU Usage – Row 3

 

Row 3 of “show process top” :

 Cpu(s): 13.5%us,  0.5%sy,  0.0%ni, 86.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

The following explains the third row of the output in the header section:

 

us

Percentage of CPU time spent in user space.
In our example, the average CPU utilization is 13.5%.

sy

Percentage of CPU time spent in kernel space.
In our example, only 0.5% of CPU time is spent in kernel space.

ni

Percentage of CPU time spent on low priority processes.
In our example, CPU does not spend any time on low priority processes. 

id

Percentage of CPU time spent idle.
In our example, the CPU spends 86% of it's time being idle.

wa

Percentage of CPU time spent in wait (on disk).
In our example, CPU is not waiting on disk.

hi

Percentage of CPU time spent handling hardware interrupts.
In our example, the CPU is not spending any time on hardware interrupts.

si

Percentage of CPU time spent handling software interrupts.
In our example, the CPU is not spending any time on software interrupts.

st

Percentage of CPU time spent on stale processes.
In our example, the CPU is not spending any time on stale processes.

 

 

5) Understanding CPU Usage – Row 4

 

Row 4 of “show process top” :

 Mem:   2043420k total,  1296716k used,   746704k free,   107812k buffers

The following explains the fourth row of the output in the header section:

 

Total

Total available memory.
In our example, 2GB of total memory is available.

used

Total amount of used memory.
In our example, ~1.3GB of memory has been used.

free

Total free memory.
In our example, ~0.7GB of memory of free memory is available.

buffers

Memory used by buffers.
In our example, 107MB has been used by buffers.

 

 

6) Understanding CPU Usage – Row 5

 

Row 5 of “show process top” :

 Swap:        0k total,        0k used,        0k free,   768644k cached

The following explains the fifth row of the output in the header section:

 

Total

Total amount of swap space. 
In our example, 0k is available for swaps.

used

Total amount of used swapped space.
In our example, 0k has been used for swamped space.

free

Total free swap space.
In our example, total amount of free swap space.

cached

Total amount of cached swap space.
In our example, ~750MB is available for caching.

 

 

7) How to view CPU usage on a multi core switch?

 

Somes Arista switch models have a multi-core CPU. As such, it is possible to see the CPU utilization on each of the cores, individually. This can be simply done by issuing the top command (either in CLI or Bash) and pressing the numerical “1” (one) key. If  just typing “1” does not work for you, then try Shift + i  (makes an I, capital i) to change the Irix mode.

The following will display the CPU utilization on each of the cores:

 top - 12:32:18 up 48 days, 16:42,  1 user,  load average: 0.08, 0.05, 0.00
 Tasks: 143 total,   1 running, 142 sleeping,   0 stopped,   0 zombie
 Cpu0  :  8.9%us,  5.0%sy,  0.0%ni, 86.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
 Cpu1  :  6.0%us,  4.3%sy,  0.0%ni, 88.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
 Mem:   4039012k total,  1367008k used,  2672004k free,   113264k buffers
 Swap:        0k total,        0k used,        0k free,   837476k cached

8) Understanding CPU Processes

 

 ***Processes***
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1469 root      20   0  460m  79m  33m S 12.0  4.0  53:54.75 FocalPoint
1483 root      20   0  167m  41m  15m S  2.3  2.1  15:04.18 PhyTn
1491 root      20   0  169m  42m  13m S  2.3  2.1  13:57.29 Mdio
1494 root      20   0  173m  43m  16m S  2.0  2.2   3:44.96 FruSnmp
1444 root      20   0  183m  78m  42m S  1.7  4.0   8:06.73 Sysdb
 (output truncated....)

This provides the following information, some of which is for the whole process, and other information relevant to the particular thread:

PID

The thread ID. 
In our example, line 1 has a process id of 1469.

USER

The user ID of the user that started the process.
In our example, root is using the process.

PR

The priority of the thread.
In our example, line 1 has a process id of 1469.

NI

The "nice" value for the process.

VIRT

The virtual memory (allocated) usage of the process.

RES

The resident memory (committed) usage of the process.

SHR

The shared memory usage of the process.

S

The state of the thread. This can be one of the following:
R - Running
S - Sleeping
D - Uninterruptible sleep
T - Traced
Z - Zombie

%CPU

The percentage of a single CPU usage by the thread.
In our example, Process 1469 is using 12% of CPU.

%MEM

The percentage of the memory used by the process.

TIME+

The amount of CPU time used by the thread.

COMMAND

The name of the process executable.
In our example, Process 1469 is the FocalPoint Agent.

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: