How can I view the load average over a shorter time period?

uptime reports load averages over the last 1, 5, and 15 minutes.

How can I view the load average over the last 10 seconds?


Solution 1:

That's impossible because the kernel doesn't compute it. (Well, you could patch the kernel of course...).

Remember that the load average is not a "regular average" of a set of numbers like you learned to compute in high school. Keeping around samples for 15 minutes and computing 3 averages over that array several times a second would require way too much memory & CPU power.

The "load average" (on linux) is an exponentially damped/weighted moving average, meaning it indicates a trend over time. See my answer to this related question for a couple of links to sites with more info.

If you know a bit of programming, it's actually easy to understand from the kernel sources too--that's how somebody teached me this. See page 2 of the link to the Linux Journal article for that.

Solution 2:

What JanC explained is correct. However, you can compute this by measuring the run-queue length (number of active threads waiting for the CPU) of your system. Unfortunately there is no utility/tool available for Linux. If you want to play around this, you can do this on OpenSolris even with microseconds resolution using DTrace scripts. It is pretty much easy. You can easily find such a script on the WEB.