I am creating a script in which needs to display/write current cpu/mem usage of a few processes started by my application. For this, I am looking for a command which can give me cpu and mem % if I have pid. I am aware of top command, but it keeps running and does not let me go ahead. I had a look at How can I get the CPU usage and memory usage of a single process on Linux (Ubuntu)? as well. But it is not giving me real time utilization but as mentioned on the thread giving avg utilization.
Is there any command which can give me run time details of the process?
Thanks
Amit