Run ps aux continuously in AIX

Requirement is to monitor cpu usage /process for a user given time and record the output.

topas,topasout,topasrec,tprof

not seems to be working for me. so what i am looking for is to run below command continously till the time limit given by the user who runs the script.since below command is a one iteration , i would like this to run every 2/3 seconds and till the user supplied time. looking for options other than watch.

ps aux | head -10

Why isn't it possible to put the command into a while-loop, like, i.e. this:

while : ; do
     ps aux | head -10
     sleep 3
done

Restrict the while-loop somehow if you want it to terminate after some time instead of running forever like now.

I hope this helps.

bakunin

The problem with ps is, that it will show the average CPU-usage since the start of the process. So if it runs already several days and you get a nasty peak for let's say 30 minutes, this will not have the value for CPU-usage rise noticably or maybe even at all.

We had a discussion about this here:

and this could be a way to try:

@zaxxon

so in general what are the difference b/w ps o/p and

topas (top or prstat)

in terms of %cpu.

also in an AIX machine what is the better way to monitor cpu utilization for all the process and record this for a time period if needed.

As often in performance related threads/posts in the AIX forum here, it usually tends to have nmon installed and monitor the stuff you need. It monitors more than just CPU and processes, but the other info is usually very helpful too.
Checkout nmon - easy to find via Google on the official IBM sites. In later versions of AIX it is installed by default.

so in general what are the difference b/w ps o/p and

Code:
topas (top or prstat)

In ps output the cpu percentage is the average percentage since process has started..but the topas output gives the insatantaneous output means at present what is the cpu usage of particular process

Could you pls. wrt. in cmpl. wd.s, not abbr.s? It is quite hard to read and even harder to understand what you mean on one hand and if we all would try to save on keystrokes nobody would even answer you on the other. Thank you for your consideration.

Part of the answer you gave already yourself. "In general" the difference is that they show different things. Sorry for the non-answer, but if you want to get specific information you have to ask specific questions.

What exactly do you want to know and how can i help you?

bakunin