Process Resource Usage

Hi There,

I'm trying to find a way to gather resource usage information (CPU, Memory & Virtual Memory) for a single process in a scripted way.

I've looked at vmstat & top but I can't figure out how to use them to get the information for a single process.

can any one help with this?

Thanks

If you are using Linux then look at the /proc filesystem. The most useful file in there will probably be /proc/<PID>/status, but /proc/<PID>/{stat,cmdline,exe} may also be useful.

sorry should have mentioned. I need this for all flavours of UNIX.