0

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

Community
  • 1
  • 1
Amit
  • 379
  • 5
  • 15
  • Please do let me know the link of the same. as i tried searching but could not find any relevant answer – Amit Jan 07 '15 at 11:35
  • The answer given is not for my usage. As I have already mentioned the same link. The link is giving output either in average or giving top command which is not returning single row value. – Amit Jan 07 '15 at 11:39
  • The answer I was looking for is close to answer given here:http://stackoverflow.com/a/15184514/1184230. So, the answer is: top -b -n 2 -p . – Amit Jan 07 '15 at 12:15

0 Answers0