Search code examples
linuxloadembeddeduptime

uptime VS. top CPU usage : What should I believe, why this difference?


I'm having some performance issue on my embedded device:

# uptime 
 14:59:39 up  5:37, load average: 1.60, 1.50, 1.53

Very bad for a monocore system ... :-p! However if I check with the top utility, I always have an idle time around 80% !

Mem: 49020K used, 75960K free, 0K shrd, 0K buff, 21476K cached
CPU: 12.5% usr  4.8% sys  0.0% nic 81.7% idle  0.0% io  0.9% irq  0.0% sirq
Load average: 1.30 1.42 1.51 1/80 18696

After reading some articles, I would better believe the uptime command. But why this difference? Is my CPU really idle ??!


Solution

  • Load is not just a measure of how many processes in the R state (runnable, could use CPU time), but also processes in the D state (uninterruptable sleep, usually waiting for IO). You likely have a process in the D state which is contributing to load, but not using cpu. This command would show you all the current processes which are contributing to load:

    ps aux | awk '$8~/[RD]/'
    

    Have a look at that output and see if you have commands in the D state (in the 8th column)