---
title: "CPU - CPU plugin under the hood: AIX"
description: "The CPU plugin on AIX collects data using OS commands and the native perfstat library. It calculates CPU usage, online status, and clockspeed based on perfstat\\cpu values and command outputs."
url: "https://docs.itrsgroup.com/docs/faq/geneos/360004144438-geneos-cpu-cpu-plugin-under-the-hood-aix/index.html"
---
The CPU plugin on AIX gets its values from OS level commands, as well as the native AIX `perfstat` library. The CPU count is parsed from the output of the commands from:

```
/usr/sbin/lscfg -l proc\*
/usr/sbin/lsattr -E -l sys0
```

The `percentUsertime`, `percentSystemtime`, `percentWaittime`, `percentIdletime` are taken from the computed average from `perfstat\_cpu` values:

|  |  |
| ------ | ------------------------------------------------------ |
| user | Number of clock ticks spent in user mode |
| sys | Number of clock ticks spent in system (kernel) mode |
| idle | Number of clock ticks spent idle with no I/O pending |
| wait | Number of clock ticks spent idle with I/O pending |

For more information, see [perfstat_cpu Subroutine](https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/p_bostechref/perfstat_cpu.html). To indicate if the CPU is online, the plugin checks the difference of values (`user`, `sys`, `idle`, `wait`) from the previous sample (ticks). If the computed value was 0 or less, that CPU will be set as `offline` and all usage stats are set to 0%.

```
if (dDiffTotal <= 0.0)
  {
      pCpu->bOnline = false;
      pCpu->dUser = pCpu->dSys = pCpu->dIdle = pCpu->dWait = 0.0;
  }
```

CPU `percentUlitilization` is computed as (100 - [perfstat\_cpu](https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/p_bostechref/perfstat_cpu.html) idle) value per cpu.

```
double dUtil = 100 - pCpu->dIdle;
```

CPU `clockspeed` is derived from [perfstat\_cpu\_total](https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html) then the value is divided by 1000000.0

```
double(tot.processorHZ) / 1000000.0
```


