Getting the heaviest RAM processes in Linux is pretty easy, getting RAM usage numbers is pretty easy to. However getting CPU usage numbers per process in Linux is harder to come by. For example, top and top -c only have precision to 0 decimal places. Where as ps can offer 0.x one decimal precision for cpu usage (read update below to see 0.xx, two decimal precision for cpu usage). Here it is

Here is the resource on that:

If you know of a better process let me know.

If you can show me a way to measure CPU on a linux box usage of a process over a given interval of time (instead of every second).

UPDATE: Looks like the program ive been looking for is pidstat. For those interested in how CPU usage is calculated check this stackoverflow page out.

http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux

pidstat” comes with “sysstat” (installed with “apt-get install sysstat“). Here is an article on pidstat:

http://xmodulo.com/how-to-measure-average-cpu-utilization.html

This gives me the numbers I want but its only for a single process. I wish it could list it for all processes at once. Well it can, and here is how:

For a single process you can do this:

 

Leave a Reply

Your email address will not be published. Required fields are marked *