Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
which OS are you running? –  Karlson Dec 5 '12 at 21:23
    
I tend to try out different GNU/Linux distributios, but mostly I use openSUSE. –  Quantumboredom Dec 5 '12 at 21:57

3 Answers 3

up vote 9 down vote accepted

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.

share|improve this answer
    
atop seems absolutely perfect, thanks a lot! –  Quantumboredom Dec 5 '12 at 22:43
    
so it wont show, lets say, the load value caused by specific pids, but it will show it in a way we can somehow guess it, like the order of cpu usage being the most troublesome application right? I wonder how atop information can help on guessing how the load values are composed (summed up)? in other words, what does that algorithm (of htop) do to compose the load average and why it is not displayed per process? (I think this may deserve a new thread?) –  Aquarius Power Oct 7 '13 at 5:24
    
@AquariusPower That indeed deserves a new Question. Load averages on machines are calculated on many factors, not really relevant to this question. –  gertvdijk Oct 7 '13 at 19:29

Judging by indication of htop I would assume you're running Linux.

You can take a look at a utility called sar, which is frequently used on Solaris but I've rarely seen it in use on Linux. It is capable of recording system activity for a day and then reporting it at various intervals. You can also look at Orca but the data statistics are still per system.

If you require per process data there are obviously paid products like TeamQuest.

share|improve this answer

Unless you set up a data collection tool, the answer is no, there is no such built-in utility, which will log the utilization of different resources.

On the other hand, every Linux installation comes with sar utility, which addresses the subject matter you are talking about. I am not going to go into any detail of how you collect data and how you extract this data for reporting, as needs of every server and every organization is different.

Log in to your server and start reading the man page of sar command. Then make a google search on how to use sar effectively. And in short time you will be able to set up your data collection utility. When you encounter a problem, you just dig back into sar logs for the specified period of time and find which resource happened to be utilized higher than usual, etc.

It is an invaluable tool to convince management to invest some money to buy/upgrade hardware, if you are continuously clocking 75% or upwards utilization and no other way to prove it to them. There are even excel macros to make graphical (read as Management-speak) reports out of raw sar data if I am not mistaken.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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