Monitoring process and "ps -ef"


 
Thread Tools Search this Thread
Operating Systems AIX Monitoring process and "ps -ef"
# 1  
Old 08-23-2010
Monitoring process and "ps -ef"

Hello.
First, excuse my poor english.
I try to monitor a dysfonction process which cause an excessive cpu consumption with the ps -ef command on AIX 5.3 TL08.

The C column indicates the cpu recently used. But I don't know the units of that C column.

Is it the "Scheduled time" of the process cpu using or a total cpu percent ?

How can I convert this value in the " % CPU used " indicates by nmon or topas
or
How Can I obtain the nmon (or topas) value (I have already tried getprocs64)

Thanks for your help

Jeff
# 2  
Old 08-23-2010
The man page of ps says following for the C column:
Quote:
C
(-f, l, and -l flags) CPU utilization of process or thread, incremented each time the system clock ticks and the
process or thread is found to be running. The value is decayed by the scheduler by dividing it by 2 once per
second. For the sched_other policy, CPU utilization is used in determining process scheduling priority. Large
values indicate a CPU intensive process and result in lower process priority whereas small values indicate an I/O
intensive process and result in a more favorable priority.
I guess that value can just vary on different boxes with different applications running on them. It sounds for me as if this is just to be taken in relationship in it's own respect.
I just checked it on one of our busy boxes and all processes are 0 in that case. So maybe it is not the best way to judge if a process uses a lot of CPU time - you simply have to see if there is any difference when your defunct process shows up.
Maybe use something like:
Code:
#> ps aux
USER        PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
root      40980 49.1  0.0   40   40      - A      Aug 16 9691:53 wait
root       8196 49.0  0.0   40   40      - A      Aug 16 9671:20 wait
root          1  0.1  0.0  636  652      - A      Aug 16 16:51 /etc/init
root     204978  0.1  0.0  712  744      - A      Aug 16 13:09 /bin/ksh /opt/fr
root      53274  0.1  0.0   68   68      - A      Aug 16 12:50 wlmsched

.. and look for the %CPU column and the STAT column (ie. what nmon and topas show for process activity too).

If this doesn't help for your question and you don't get another more insightful answer how this value of the C column takes effect in calculating cpu times, maybe open up a parallel thread in the IBM Developer's community.
# 3  
Old 08-23-2010
"ps aux" versus "ps -ef"

Thank you for your reply Zaxxon.
cpu% shown by the "ps aux" is an average since the process started and the value is very low if the process is not restarted but suddenly malfunctions. That's what I'm trying to detect to issue an alert.

The top of unix, or topas or nmon Aix gives the instantaneous value of consumption cpu. But I can not configure it correctly on topas or nmon to get it and I thought that the ps command would be more appropriate.

Here's my worry.
# 4  
Old 08-23-2010
Quote:
cpu% shown by the "ps aux" is an average since the process started
I doubt that. It is a somewhat current snapshot of the value. Where did you read that?

---------- Post updated at 01:27 PM ---------- Previous update was at 01:24 PM ----------

Stupid me, sorry you are correct. The value does not change on repeating the command and the man page states it is the value since process start ie. average.
# 5  
Old 08-23-2010
Try

Code:
-o pcpu

# 6  
Old 08-23-2010
Tried that out too, but is the same as %CPU in aux; man page:
Code:
              pcpu
                   Indicates the ratio of CPU time used to CPU time available, expressed as a percentage. The default header for
                   this field is %CPU.



---------- Post updated at 01:55 PM ---------- Previous update was at 01:40 PM ----------

An update for the C column - not sure if you already found that; from the Performance Tools Handbook (Redbook):

Quote:
8.2.3 Displaying the processes in order of being penalized
The following command line is useful for determining which processes are being
penalized by the Virtual Memory Manager. See 1.2.2, “Processes and threads”
on page 6 for details about penalizing processes. The maximum value for the C
column is 120. The report in Example 8-6 displays the C column sorted in reverse
numerical order.
Example 8-6 Displaying the processes in order of being penalized
# ps -eakl | head -1 ; ps -eakl | sort -rn +5
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
303 A 0 1290 0 120 255 -- b016 8 - 8570:28 wait
303 A 0 1032 0 120 255 -- a815 8 - 8540:22 wait
303 A 0 774 0 120 255 -- a014 8 - 8568:09 wait
303 A 0 516 0 120 255 -- 9813 8 - 8590:49 wait
303 A 0 0 0 120 16 -- 9012 12 - 3:53 swapper
240001 A 0 25828 1 34 187 24 2040 1172 30bf6fd8 - 27:25 xmwlm
200001 A 0 36434 25250 4 181 20 da3e 460 pts/4 0:00 ps
240001 A 0 25250 29830 2 181 20 59ef 1020 pts/4 0:01 ksh
200001 A 0 36682 25250 2 181 20 69c9 300 30b4a6fc pts/4 0:00 sort
200001 A 0 34898 25250 2 181 20 4b6a 236 3098fce0 pts/4 0:00 head
...(lines omitted)...
Ignoring the wait processes, which will always show 120, the xmwlm process is
being penalized by the CPU. When this occurs, the process is awarded less CPU
time, thereby stopping xmwlm from monopolizing the CPU and giving more time
to the other processes.


---------- Post updated at 03:27 PM ---------- Previous update was at 01:55 PM ----------

Another update - you could check if any of the following produces any usable output for you:

Code:
/usr/bin/proccred
/usr/bin/procfiles
/usr/bin/procflags
/usr/bin/procldd
/usr/bin/procmap
/usr/bin/procrun
/usr/bin/procsig
/usr/bin/procstack
/usr/bin/procstack64
/usr/bin/procstop
/usr/bin/proctree
/usr/bin/procwait
/usr/bin/procwdx

Or try running pprof but problem is, that it runs for a given time like a trace - not sure if that is ok for you.
# 7  
Old 08-23-2010
Quote:
Originally Posted by Jeff-Generali
The C column indicates the cpu recently used. But I don't know the units of that C column.
To quote from Demystifying IOWAIT:

"The system contains a hardware timer which generates 100 interrupts/second. This interrupt will then dispatch the kernel scheduler process which runs at a fixed priority of 16. The scheduler will first charge the running thread with the 10 millisecond time slice and then dispatch another thread (context switch) of equal or higher priority on that CPU assuming there are other runnable threads. This short term CPU usage is reported in the “C” column when including a -l option with the ps command."

I hope this helps, although i think this disqualifies "ps -l" as a feasible source for your purposes.

Here is another link you might be interested in to read:

Process priority and control on AIX

bakunin

PS: To monitor the CPU consumption over time you might write a script which takes a snapshot of the "%CPU" value at fixed intervals and computes the actual consumption as a function over the time of the process running - some tricky calculations, but maybe worth a try.

Another idea is to run the process in question with the "time"-utility, which tells you the time spent in real-, user- and system-mode.

Last edited by bakunin; 11-01-2010 at 07:20 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Fedora

"integer expression expected" error with drive space monitoring script

Hi guys, I am still kinda new to Linux. Script template I found on the net and adapted for our environment: #!/bin/sh #set -x ADMIN="admin@mydomain.com" ALERT=10 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output ... (2 Replies)
Discussion started by: wbdevilliers
2 Replies

7. Red Hat

"service" , "process" and " daemon" ?

Friends , Anybody plz tell me what is the basic difference between "service" , "process" and " daemon" ? Waiting for kind reply .. .. (1 Reply)
Discussion started by: shipon_97
1 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. UNIX for Dummies Questions & Answers

Process seen in "ps aux" but not "top"

Hi, I have a process that can be seen after "ps aux" command. However when I do "top" command. This process cannot be seen. How can this happen? Is there anything wrong with my code? (3 Replies)
Discussion started by: monkfan
3 Replies
Login or Register to Ask a Question