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.

The syncd, X, and dtsession are all processes that have been active since IPL;<br />

that is why they have accumulated more total TIME than the test program.<br />

The %CPU column<br />

The %CPU column, generated by the -u or -v flag, shows the percentage of time<br />

that the process has used the CPU since the process started. The value is<br />

computed by dividing the time the process uses the CPU by the elapsed time of<br />

the process. In a multi-processor environment, the value is further divided by the<br />

number of available CPUs, since several threads in the same process can run on<br />

different CPUs at the same time. Because the time base over which this data is<br />

computed varies, the sum of all %CPU fields can exceed 100 percent. In the<br />

following example, there are two ways to sort the extracted output from a system.<br />

The first example includes kprocs, for example, PID 516, which is a wait process.<br />

The other, more complex command syntax excludes such kprocs:<br />

# ps auxwww |head -n 5<br />

USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND<br />

root 18802 25.0 1.0 4140 4160 pts/11 A 15:40:28 5:44 ./tctestprog<br />

root 516 25.0 5.0 8 15136 - A Jun 15 17246:34 kproc<br />

root 774 20.6 5.0 8 15136 - A Jun 15 14210:30 kproc<br />

root 1290 5.9 5.0 8 15136 - A Jun 15 4077:38 kproc<br />

# ps gu|head -n1; ps gu|egrep -v "CPU|kproc"|sort +2b -3 -n -r |head -n 5<br />

USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND<br />

root 18802 25.0 1.0 4140 4160 pts/11 A 15:40:28 7:11<br />

./tctestprog<br />

imnadm 12900 0.0 0.0 264 332 - A Jun 15 0:00 /usr/IMNSearch/ht<br />

root 0 0.0 5.0 12 15140 - A Jun 15 4:11 swapper<br />

root 1 0.0 0.0 692 764 - A Jun 15 0:28 /etc/init<br />

root 3398 0.0 1.0 1692 2032 - A Jun 15 1:48 /usr/dt/bin/dtses<br />

From the output, you can see that the test program, tctestprog, uses about 25<br />

percent of available CPU resources since the process started.<br />

Upon finding a run-away process, the next step in the analysis is to find out what<br />

exactly in the process uses the CPU. For this, a profiler is needed. The <strong>AIX</strong><br />

profiler of preference is tprof.<br />

10.1.4 The tprof command<br />

The tprof command can be used for application tuning and for information<br />

collection of overall CPU utilization. The tprof command can be run over a time<br />

period to trace the activity of the CPU.<br />

In the <strong>AIX</strong> operating system, an interrupt occurs periodically to allow a<br />

housekeeping kernel routine to run. This occurs 100 times per second. When the<br />

tprof command is invoked, it counts every such kernel interrupt as a tick. This<br />

Chapter 10. Performance problem determination 243

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

Saved successfully!

Ooh no, something went wrong!