To get only the cpu info from the topas command terminal

Tags
aix, ksh, monitoring

 
Thread Tools Search this Thread
# 1  
Old 02-10-2014
Lightbulb To get only the cpu info from the topas command terminal

To get only the cpu info from the topas command terminal.

Code:
CPU  User%  Kern%  Wait%  Idle%  Physc   Entc   
  ALL    2.3    4.4    0.0   93.3   0.07    7.7

I tried some thing like this but did not work

Code:
topas << done
  grep "ALL"
  q
  done

Can someone help me in this.
# 2  
Old 02-10-2014
The topas tool is a full-screen tool and its output is not well suited for filtering it in a pipeline. I suggest you use vmstat instead, which presents the same information (albeit in different form, but well suited for filtering).

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
rpm120 (02-11-2014)
# 3  
Old 02-11-2014
Lightbulb

Can you please help me to match these two outputs?

Theses were captured one after other

topas command o/p (Only CPU)

Code:
CPU  User%  Kern%  Wait%  Idle%  Physc   Entc   
ALL    3.1    4.9    0.0   92.0   0.08    9.0


vmstat o/p


Code:
System configuration: lcpu=4 mem=4608MB ent=0.85

kthr    memory              page              faults              cpu
----- ----------- ------------------------ ------------ -----------------------
 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa    pc    ec
 1  1 447273 571345   0   0   0   9   25   0  21 3802 472  0  0 99  0  0.00   0.0

# 4  
Old 02-11-2014
Quote:
Originally Posted by rpm120
Can you please help me to match these two outputs?
No problem. Have a look at vmstats "CPU" part:

us=user(%)
sy=system(=kernel)(%)
id=idle(%)
wa=wait(%)

ec=entitled capacity consumed

"us" is what your running programs need
"sy" are system calls and kernel internals needed to keep the system running
"id"/"wa" is what is left over. Together these 4 values add up to 100% (rounding errors notwithstanding).

The difference between "id" and "wa" is: if the processor is idle and there is an I/O operation outstanding it counts towards "wa", otherwise it counts towards "id".

Entitled capacity consumed is: compare the entitled processing power in the LPAR profile against what in reality is allocated right now and express this as a percentage. "50", for instance, means that half of what the LPAR is entitled to use is in fact used right now.

I hope this helps.

bakunin

/ps: i suggest you try the "-w" and the "-t" options of vmstat: one makes for neater columns and the other includes a time stamp for each line which makes it easier to assess.

/pps: another suggestion: vmstat always displays a summary info as the first output line (not counting headers), so disregard this first line if you want to know something about the system right now.

Last edited by bakunin; 02-11-2014 at 12:51 PM..
This User Gave Thanks to bakunin For This Post:
rpm120 (02-13-2014)
# 5  
Old 02-13-2014
Lightbulb

Thanks a lot bakunin!

The doubt I have is in the results of the commands output.

For Instance,

Let's take the "User%" from the output of the topas command and compare it with
"us" in the vmstat command

It is 3.1 and 0 respectively. They are not matching though they gauge the same.

In the same way all the values such as Kern%,Wait%,Idle%,Physc and Entc from topas and sy,wa,id,pc &ec are not matching.

Infact the sample output's given were captured one after the other in the same server but the results seems to be not matching.
# 6  
Old 02-13-2014
Quote:
Originally Posted by rpm120
In the same way all the values such as Kern%,Wait%,Idle%,Physc and Entc from topas and sy,wa,id,pc &ec are not matching.

Infact the sample output's given were captured one after the other in the same server but the results seems to be not matching.
First, the first line of output of "vmstat" should always be ignored, as i said. Because you only have shown one line you should not use this output at all to base any assumption on it. IIRC it displays an average since last reboot or so, which is meaningless.

Second, the system is next to idle. Between 3.1% and 0% there is not much difference and the "load" could well change that much within one or two seconds (the time you needed to stop one and start the other process).

Third, both tools, "topas" and "vmstat" use a certain sampling interval, which is probably not the same per default. I use "topas" only rarely, so i could be wrong, but i believe the default sampling rate to be 2 sec. With "vmstat" there is no default, you have to provide a sampling rate (in secs). I usually start with 1 sec (my internal clock is counting that way) for intensive monitoring and (up to) 60 seconds for long-term observation.

Both, "topas" and "vmstat" get their data from the same OS interfaces, but because they treat these data differently they might end up displaying different values. I have never attempted to search for it, but i am sure you could find the OS calls both are using documented somewhere and you could write your own monitoring tool if you are determined enough. I always found that "vmstat" is giving me the data i need and in a form i can easily manipulate with the abundant UNIX text filters there are (grep, awk, sed, ksh, ....). This is why i myself use "vmstat" and hardly ever "topas": personal preference rather than technical reasons.

I hope this clears it up.

bakunin
This User Gave Thanks to bakunin For This Post:
rpm120 (02-16-2014)

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Topas - CPU count inconsistent across LPARs maraixadm AIX 3 1 Week Ago 04:24 PM
Best ways to get clear info about CPU and Memory umen UNIX for Dummies Questions & Answers 2 01-15-2015 09:16 AM
Alternative command for topas sumanthupar AIX 3 10-08-2013 07:32 AM
Need help on topas command sumanthupar AIX 2 10-07-2013 01:44 PM
Help with topas command NarayanaPrakash Shell Programming and Scripting 1 07-27-2013 08:52 AM
topas and mpstat disagree on CPU count petervg AIX 1 01-11-2012 09:23 AM
Advanced info on CPU Emulators theKbStockpiler UNIX for Dummies Questions & Answers 12 06-26-2011 07:40 AM
TOPAS command in Unix Maddy123 UNIX for Dummies Questions & Answers 3 05-24-2011 11:31 AM
Help with TOPAS command ginnyr1 UNIX for Dummies Questions & Answers 3 12-13-2009 04:30 AM
Generic command for CPU info sgoiffon Shell Programming and Scripting 5 12-05-2009 06:16 AM
CPU Info yoavbe HP-UX 3 09-12-2009 12:45 PM
How to access process and cpu info on AIX? DarthVader77 AIX 5 06-06-2009 05:13 AM
command topas tokienlua UNIX for Dummies Questions & Answers 6 03-03-2009 10:06 AM
cpu info vijayca HP-UX 1 08-27-2007 09:51 AM
bus speed and CPU info ihot UNIX for Dummies Questions & Answers 3 06-19-2007 11:32 PM