Load – How to Find Source of System Load for a Certain Period

load

By running top, htop, uptime, etc. we can see the load average as three values indicating the average load for the last 1/5/15 minutes (well not really, but that isn't the question here).

Sometimes I'll notice that I have a fairly high load average for the last 15 minutes, but the current load is very low. Is there a utility/program that can list the processes (even if they no longer exist) that consumed the most CPU-time for the last 1/5/15 minutes (or some other similar period)?

I am aware that load average can also be caused by processes waiting for I/O, but I am mostly interested in seeing the most CPU-hungry applications (though being able to see historic I/O would also be nice).

As far as I know running htop and sorting by time cannot help me here, since if the computer has been on for a while the top values will not necessarily have anything to do with the recent past.

Best Answer

I suggest to use atop. It's a daemon gathering all 'top' information every 10 minutes by default and you can just go back in time viewing these 'top' snapshots. Adjust the default interval setting to your needs (consumes more disk space if set more frequently).

Just yesterday, I answered a similar question, in which I included a very short how-to.