How to calculate AIX CPU utilization using lparstat command

Could you please explain about calculate CPU utilization of aix server using lparstat command?

Here below i have provided example output from aix test server.

System configuration: type=Shared mode=Uncapped smt=On lcpu=4 mem=4096 psize=63 ent=0.50

%user  %sys  %wait  %idle physc %entc  lbusy  vcsw phint 
----- ----- ------ ------ ----- ----- ------ ----- -----   
0.2   0.8    0.0   98.9  0.01   1.8    2.3   152     0   
0.1   0.8    0.0   99.1  0.01   1.8    2.5   276     0
0.1   2.0    0.0   97.9  0.02   4.4    5.0   693     0

I am not sure what you want. There is nothing to "calculate":

You have the 4 values "user", "sys", "wait" and "idle". All these values are percentages and add up to 100.

"user" is the time the processor resources of the system spend executing user code.

"sys" is the time the processor(s) spend executing system code - system calls, etc.

"wait" and "idle" are basically the same thing - the processor doing nothing. The difference is: if there is a process waiting for I/O - say, it waits for data to load or a memory page to be be moved from paging space back to memory - the time will be added to "wait". If there is no such process in the run queue it will be added to "idle" instead.

All these percentages are taken from the alotted CPU resources of the LPAR. You have a 4 lcpu system. If you run a single-threaded process which consumes one CPU completely, has no I/O and nothing else you will see about 25% user, 1-2% system, wait% 0 and idle% at about 72-73%.

Why not exactly 25? Because the running system will generate some small tasks in user space too, so user% will not show the exact 25% but a bit more.

I hope this helps.

bakunin