Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jan 2005 00:43:24 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-stable@FreeBSD.ORG, Chris <chrcoluk@gmail.com>
Subject:   Re: dual cpu and top in 5.3
Message-ID:  <200501132343.j0DNhOuk058424@lurza.secnetix.de>
In-Reply-To: <3aaaa3a05011315113c64ec76@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Chris <chrcoluk@gmail.com> wrote:
 > Hi, I have a dual athlon mp system running FreeBSD 5.3-RELEASE-p2, I
 > have wondered if both cpu's should show in top.
 > 
 > Here is a snapshot of my top output.
 > 
 > last pid: 15520;  load averages:  0.28,  0.09,  0.03    up 7+23:21:08  23:05:33
 > 153 processes: 2 running, 151 sleeping
 > CPU states:  0.2% user,  0.0% nice,  3.3% system,  2.5% interrupt, 94.0% idle
 > Mem: 770M Active, 67M Inact, 115M Wired, 40M Cache, 112M Buf, 9804K Free
 > Swap: 2048M Total, 920K Used, 2047M Free
 > 
 > I compiled a SMP kernel of course, but I am not confident I have this
 > setup right because of lack of evidence showing I am in SMP modein
 > top, here is my dmesg boot log which does say 2 cpus detected.

On SMP machines, top should show a column titled "C" which
contains the number of the processor on which the process
was scheduled last (i.e. either "0" or "1" if you have two
processors).

 > [...]
 > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 >  cpu0 (BSP): APIC ID:  0
 >  cpu1 (AP): APIC ID:  1
 > [...]
 > SMP: AP CPU #1 Launched!

Looks OK.

You can also query "sysctl hw.ncpu" to get the number of
processors detected (and supported) by the kernel.

 > Is it all looking dandy and I am ok or have I missed something, and
 > should top show 2 cpu's or just 1?

The "top" command doesn't display the number of processors
directly, as far as I know.  But it has the "C" column, as
explained above.

On an SMP machine of mine with two processors (it's a dual
Celeron-466), the output looks like this:

last pid: 55565;  load averages:  0.01,  0.01,  0.00   up 295+04:59:09 00:40:23
76 processes:  1 running, 75 sleeping
CPU states:  0.2% user,  0.0% nice,  0.2% system,  0.0% interrupt, 99.6% idle
Mem: 72M Active, 7296K Inact, 35M Wired, 48K Cache, 25M Buf, 39M Free
Swap: 320M Total, 29M Used, 291M Free, 8% Inuse

  PID USERNAME     PRI NICE  SIZE    RES STATE  C   TIME   WCPU    CPU COMMAND
   77 bind           2   0 12512K  9820K select 0 394:50  0.00%  0.00% named
22723 root           2   0  2200K   264K poll   0 190:52  0.00%  0.00% dovecot
  111 root           2   0  3056K   936K select 1  94:35  0.00%  0.00% sendmail
   79 root           2   0  1312K   364K select 1  35:56  0.00%  0.00% ntpd
.. and so on.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"A language that doesn't have everything is actually easier
to program in than some that do."
        -- Dennis M. Ritchie



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