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
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.