Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here's the output I get when I run mpstat:

$mpstat
Linux 3.2.0-30-generic (my-laptop-C650)     09/17/2012  _x86_64_    (2 CPU)

05:32:01 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
05:32:01 PM  all    9.16    0.08    2.69    2.00    0.00    0.04    0.00    0.00   86.02

And here's what I get when I run it with a one-second interval:

$mpstat 1
05:31:51 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
05:31:52 PM  all    1.52    0.00    1.01    0.00    0.00    0.00    0.00    0.00   97.47
05:31:53 PM  all    2.04    0.00    1.02    0.00    0.00    0.00    0.00    0.00   96.94
05:31:54 PM  all    1.50    0.00    1.50    0.00    0.00    0.00    0.00    0.00   97.00

Why does the first process show the processor as 86% idle, and the second show it as ~97% idle? I've tried this in a bunch of different configurations, and it's not a real difference in CPU usage -- unless mpstat itself is making the difference.

Which number should I trust?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

When you run mpstat for first time, it calculates the idle time since the server has booted up to the point where you have run mpstat.

But when you run it with intervals, you are getting the value within the defined time amount you specified, here 1 second. And not the entire time since boot up and then to that moment.

In fact, iostat, vmstat all work in this same way as I told,

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.