21.02.2013 Views

AIX 5L Problem Determination - IBM Redbooks

AIX 5L Problem Determination - IBM Redbooks

AIX 5L Problem Determination - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

second. Large values indicate a CPU-intensive process and result in a lower<br />

process priority, while small values indicate an I/O-intensive process and result<br />

in a more favorable priority. In the following example, tctestprog is running, which<br />

is a CPU-intensive program. The vmstat command output shows that about 25<br />

percent of the CPU is used by usr processes.<br />

# vmstat 2 3<br />

kthr memory page faults cpu<br />

----- ----------- ------------------------ ------------ ----------r<br />

b avm fre re pi po fr sr cy in sy cs us sy id wa<br />

0 0 26468 51691 0 0 0 0 0 0 100 91 6 47 0 53 0<br />

1 1 26468 51691 0 0 0 0 0 0 415 35918 237 26 2 71 0<br />

1 1 26468 51691 0 0 0 0 0 0 405 70 26 25 0 75 0<br />

The ps command is useful in this situation. The following formatting sorts the<br />

output so that the third column has the biggest value at the top, and shows only<br />

five lines from the total output.<br />

# ps -ef | sort +3 -r |head -n 5<br />

UID PID PPID C STIME TTY TIME CMD<br />

root 22656 27028 101 15:18:31 pts/11 7:43 ./tctestprog<br />

root 14718 24618 5 15:26:15 pts/17 0:00 ps -ef<br />

root 4170 1 3 Jun 15 - 12:00 /usr/sbin/syncd 60<br />

root 21442 24618 2 15:26:15 pts/17 0:00 sort +3 -r<br />

From the previous example, you can tell that tctestprog is the process with the<br />

most-used CPU in recent history.<br />

The TIME column<br />

The second value mentioned is the TIME value. This value is generated with all<br />

flags, and it shows the total execution time for the process. This calculation does<br />

not take into account when the process was started, as seen in the following<br />

output. The same test program is used again, and event, though the C column<br />

shows that the process gets a lot of CPU time, is not yet on top in the TIME<br />

column:<br />

# ps -ef | sort +3 -r |head -n 5<br />

UID PID PPID C STIME TTY TIME CMD<br />

root 18802 27028 120 15:40:28 pts/11 1:10 ./tctestprog<br />

root 9298 24618 3 15:41:38 pts/17 0:00 ps -ef<br />

root 15782 24618 2 15:41:38 pts/17 0:00 head -n 5<br />

root 24618 26172 2 Jun 21 pts/17 0:03 ksh<br />

# ps -e |head -n 1 ; ps -e|egrep -v "TIME|0:"|sort +2b -3 -n -r|head -n 10<br />

PID TTY TIME CMD<br />

4170 - 12:01 syncd<br />

4460 - 2:07 X<br />

3398 - 1:48 dtsession<br />

18802 pts/11 1:14 tctestprog<br />

242 <strong>IBM</strong> ^ Certification Study Guide - <strong>AIX</strong> <strong>5L</strong> <strong>Problem</strong> <strong>Determination</strong> Tools and Techniques

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!