Find scripts related to PIDs

Hi,

does anyone know, how I could find out, why a PID needs so much CPU?
Is there a way to find out for example, if these are PHP scripts (and which), that need a lot CPU?

Here the example:


PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
20376 wwwrun    20   0  558m  49m 7272 R  102  2.6   5:34.02 httpd2-prefork

So what is this PID doing
?
Is there a way to also find out more some time later - realtime checking might get difficult :wink:

Thanx
Flözen

Running ‘strace -p PID’ would show you exactly what the daemon is doing. It will also report any errors that are occurring (i.e. permissions) that may lock up the CPU or slow the code execution.

As for retrieving the information later, your best bet is likely to review the error logs. You can play around with the flags you use with strace (hint: -o) and have it log the trace to a file. I wouldn’t recommend doing this for an extended period of time though.

Visit http://httpd.apache.org/dev/debugging.html for more information on debugging your application’s CPU issues.