0

I'm runing program on ubuntu 20.04. And use command top -p $(pgrep process_name) to monitor cpu usage. However, i discovered a strange things: when i compile my code on the same machine, i found the cpu usage reduced-from 25% to less than 20%. So i think the top command is NOT accurately.Back to my question, is there some way to precisely monitor cpu usage?

wshing
  • 9
  • 1
  • check out [https://stackoverflow.com/questions/3017162/how-to-get-total-cpu-usage-in-linux-using-c](https://stackoverflow.com/questions/3017162/how-to-get-total-cpu-usage-in-linux-using-c) – Gal Sep 03 '21 at 12:22

0 Answers0