How to record process time

How to record process time

am 17.10.2007 15:06:19 von struggle

Hi,
I have a server with more than 2000 at web and 2000 at telnet.
Indeed, it is bbs system with web support. And the load average is
very high. Now, I want to find that how much time some CGI process
takes on average and how much in user space, how much in system space,
how much I/O it use as well as network. Is there such a tool in Unix
for this purpose? Something worth notice is that the CGI is running by
apache, and I can't trace it because it start and do some I/O and then
return. I should never pause some and trace some.

Any advice will be appreciated very much!
Thanks in advance!

Regards!
Bo