Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 03 May 2002 08:05:07 -0400
From:      Bill Moran <wmoran@potentialtech.com>
To:        Patrick Thomas <root@utility.clubscholarship.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: confusing CPU stats in `top`
Message-ID:  <3CD27CF3.6050801@potentialtech.com>
References:  <20020502160811.P29785-100000@utility.clubscholarship.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Patrick Thomas wrote:
<SNIP>
> So what is happening here ?
> 
> 
> last pid: 24283;  load averages:  1.71,  2.07,  2.62
> up 97+17:51:18  16:09:59
> 964 processes: 4 running, 956 sleeping, 4 zombie
> CPU states: 11.1% user,  0.2% nice, 19.0% system,  0.0% interrupt, 69.7%
> idle
> Mem: 1289M Active, 234M Inact, 376M Wired, 82M Cache, 199M Buf, 28M Free
> Swap: 2018M Total, 6316K Used, 2012M Free
> 
>   PID USERNAME PRI NICE  SIZE    RES STATE  C   TIME   WCPU    CPU COMMAND
> 92645     88     2   0 42280K 18464K poll   1 238:30 38.82% 38.82% mysqld
> 56036 root       2   0  1836K  1316K select 1  21:58  6.84%  6.84% master
>  8398     88     2   0 39272K 20700K poll   0 996:14  5.47%  5.47% mysqld
> 23617 root      31   0  2968K  2108K CPU1   2   0:01  5.31%  2.54% top
> 19435   1006     2  20 48916K 39828K poll   0  35:20  1.12%  1.12% httpd
> 93802    500     2   0 64804K 61024K sbwait 1   2:40  0.63%  0.63% httpd
> 87873 root       2   0  1596K  1180K select 2   0:01  0.20%  0.20% proftpd
> 93750    500     2   0 70352K 66716K accept 1   3:24  0.15%  0.15% httpd
> 93751    500     2   0 66396K 62412K accept 0   3:02  0.15%  0.15% httpd
>  4965    500     2   0 49084K 45436K sbwait 2   0:02  0.10%  0.10% httpd
> 53925 user      38   5 10652K  4960K CPU2   0   7:40  0.05%  0.05% ack
>   747 root       2   0   872K   284K poll   2 159:24  0.00%  0.00% httpd
> 68955 root       2   0   872K   368K poll   1 148:05  0.00%  0.00% httpd
> 96533     72     2   0 13360K 12624K poll   0  29:00  0.00%  0.00% ircd
> 
> 
> 
> As you can see, the server reports 69.7% idle
> 
> BUT, that would imply processes using up a total of (30.3 x 4) `top`
> reported percent ... which is not the case - if you add up the percentages
> in the `top` reported processes, they add up to ~58 or so, and if we
> divide that by four we would expect to see 85% idle or so, instead of
> 69.7% idle.

BUT, your system time is at 19% which means the kernel is busy with something.
SMP on Intel systems has a lot of overhead, but this isn't the only reason,
crappy disk controllers on older computers will drive up the system processor
usage for example.  Heck I'd bet that if FreeBSD had winmodem support
in the kernel it would drive up the system processor usage.  Multi-proc
machines require FreeBSD to do a lot of work managing the processors.
Apparently, this is much improved in -CURRENT, but it will never go away
completely, not on the Intel platform at least.

> So why is this exhibiting this behavior, when as I said, if you have a
> non-loaded system, and a single process goes to 99%, the overall load is
> roughly 74%  ??

If you take this math, and figure in the 19% system time, you'll come up
with a number very close to what's reported.

-- 
Bill Moran
Potential Technology
http://www.potentialtech.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CD27CF3.6050801>