Reputation: 1501
I have developed a c++ app that runs on debian jessie server. Since I'm quite new in linux distros and specially the server ones that provide only terminal, I 'd like to find out if there is a way to watch the %CPU and %MEM on the same time that the c++ app runs. I tried to run
./C++_APP & ps -aux | grep .C++_APP
but ps ran only at the beginning. Is this possible somehow either with ps or with another command?
Upvotes: 0
Views: 63
Reputation: 397
You can use/install htop. Set filter to match your executable name.
Upvotes: 1
Reputation: 1516
You may try that:
./C++_APP & wait && PID=`pidof -s -x C++_APP` && top -b -p $PID
It will display stats every second. To break CTRL+C
To kill your app type than
kill $PID
Upvotes: 0
Reputation: 9681
Use watch
. You can pass your ps
(along with its arguments) to it. If you don't run your application as a background process you will have to use a second terminal session or pipe the results to a file that you can look at later on.
Upvotes: 1