CLI "show cpu" command output explained

book

Article ID: 168126

calendar_today

Updated On:

Products

XOS

Issue/Introduction

This article describes how the CLI "show cpu" command output values are calculated.This article describes how the CLI "show cpu" command output values are calculated.

Cause

Goal: To provide information on how CPU utilization and load averages are derived.

Resolution

Understanding How CPU Utilization and Load Averages Are Calculated

Both CPU Utilization and Load averages are calculated by the health agent on the CPM.

Load Average

The load average calculation is derived from the value(s) contained in /proc/loadavg from each AP/CP module.


CPU Utilization

In versions XOS 8.0.x and prior, the CPU utilization calculation is derived from the values contained in /proc/uptime from each AP/CP module. The /proc/uptime has two numbers. The first value is the system time. The second value is the idle time.

The health agent takes samples of the values contained in /proc/uptime at intervals. Taking a delta of the system time with the delta of idle time over that interval results the CPU utilization value. The health agent will calculate the average of these values over 1 minute, 5 minute and 15 minute time periods. These values are represented by the CPU_Util1, CPU_Util5 and CPU_Util15 average output.

Note: Using /proc/uptime only represents CPU0, not per CPU/core.

This problem is corrected in versions XOS 8.1 and above, because the CPU utilization calculation is derived from the values contained in proc/stats from each AP/CP module.

The file /proc/stat contains detailed information on a per CPU/core basis, which allows for a more accurate representation of CPU utilization. In addition, the utilization is calculated by each AP/CP module's health agent, respectively, which then reports these values to the CPM's health agent.

The very first "cpu" line of /proc/stat aggregates the numbers in all of the other "cpuN" lines.

These numbers identify the amount of time the CPU has spent performing different kinds of work.

The meanings of the columns are as follows, from left to right:

* user: normal processes executing in user mode
* nice: niced processes executing in user mode
* system: processes executing in kernel mode
* idle: twiddling thumbs
* iowait: waiting for I/O to complete
* irq: servicing interrupts
* softirq: servicing softirqs

Workaround

N/A