I'm trying to determine the CPU usage of a program by looking at the output from Top in Linux. I understand that %us means userspace and %sy means system/kernel etc. But say I see 100%us. Does this mean that the CPU is really only doing useful work? What if a CPU is tied up waiting for resources that are not avaliable, or cache misses, would it also show up in the %us column, or any other column?

Thank you.

  • You might be interested in "htop" for interactive use. But that's tangential to the question.
    – detly
    Commented Apr 8, 2010 at 4:15
  • Depends on the definition of "useful." If a program is in a spin-wait for I/O, it's technically running in user space but not doing anything useful (and that's just one of many examples of running in user time but not doing useful work). Commented Apr 8, 2010 at 4:18
  • 2
    Not programming related - voting to migrate to superuser.com
    – danben
    Commented Apr 8, 2010 at 4:43

1 Answer 1


As Travis pointed out this is a tricky question, and one that really depends on defining what useful work actually is - but that's more of an academic question.

I think that the way this is likely calculated is the percentage of total CPU cycles run in user space that is not spent in idling. As long as the program goes to sleep while waiting for certain resources, it shouldn't consume CPU.

If it can't do this for some reason top does tell you the percentage of time spent specifically waiting for IO as %wa.

Short answer: %us of 100% probably includes some busywork, but the exact amount will depend on the type of processor you have, the type of software you're running and a dozen other factors. To get the full story of exactly what top is telling you, you'd probably need to go to the source code (which thankfully, is freely available).

  • Is cache thrashing considered busywork and thus show up in the %us column?
    – Rayne
    Commented Apr 8, 2010 at 5:36
  • That would depend on what top considers IO and thus what it puts into %us versus %wa. At a guess without doing more digging I would say thrashing between different levels of memory (i.e. L1, L2, etc.) would go under %us while thrashing that involved calls to disk/secondary storage while the processor was forced to wait (as opposed to being able to do other things if it's multithreaded) would go under %wa. But for that level of detail you need to check the source or other detailed documentation.
    – Jacinda
    Commented Apr 8, 2010 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .