1

I know close questions have been asked, but I did not find any answer to this. I would like to monitor CPU and RAM of a process I launch, which is executed through several threads. I would like the monitoring to be accurate, at least every 100ms, 10ms would be very nice. So I am looking for something similar to htop with the capability of monitoring only one process by extracting its CPU and RAM usage.

If it does not exist, is there a way to monitor and log all processes (like in htop) faster ?

Thank you very much !

Etienne

1

Try running the following command in a loop and see if you can get the update rate you want:

ps -p <PID> -mo %cpu %mem >> log.txt

Depending on what you mean by "memory", you may be better served by other options, such as size, sz, vsz or rss.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.