Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen a few posts similar to this, most notably here, but wasn't quite satisfied with the answers. I'm comparing top and ps results on a specific process and see huge discrepancies in CPU usage. top varies between <1% and 100% from interval to interval including periods of sustained highs (>50% for 3-4 intervals), while ps is steady at 2.2%. The process I'm watching doesn't have any children or anything, so I'm not quite sure what to make of it. Since there are sustained high periods in top, I feel I can rule out sampling interval.

Is this really just a discrepancy in how these two tools handle I/O wait time, as suggested by the question I linked to above?

I've seen it fluctuate to 2.1% in ps, but that's it so far. Output from top -p 4522:

4522 root      16   0  340m 316m 4732 R 54.7  1.3 508:57.46 maui

Output from ps u -p 4522:

root      4522  2.2  1.3 348764 324456 ?       Ss   Aug25 509:25 /usr/local/maui/sbin/maui
share|improve this question
You mean ps never ever changes and is always 2.2? Could you post the output of ps and top for the command in question so we can have a look? – terdon Sep 10 '13 at 13:18
@terdon I updated the original post with additional information. – TTT Sep 11 '13 at 13:16
up vote 2 down vote accepted

The likeliest reason is that top shows the percentage values as a percentage of a single CPU while ps shows the percentage of total available CPU power. Try running top and hitting ShiftI while it's running to show the percentage of all cores.

If this is a server cluster with a lot of CPUs, what you describe is normal behavior. Also see here.

share|improve this answer
Yes, I'm running on 12 cores. That does reduce the % levels that it reaches in top such that the average value is below that of ps, so that may be the difference. The process is a lot less active now, though, so it's hard to say... – TTT Sep 11 '13 at 15:48
@TTT this is a classic issue, it used to drive me up the wall before I discovered the shift+I thing. – terdon Sep 11 '13 at 17:18

You must log in to answer this question.

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