sysctl hw add nphyscpu variable
Richard Yao
ryao at gentoo.org
Mon Aug 4 12:23:18 UTC 2014
On Mon 04 Aug 2014 07:53:42 AM EDT, Stefan Parvu wrote:
> Hi,
>
> Would be possible to have under sysctl interface a new variable which will track the
> number of physical CPU sockets a system has ? Would be useful for hardware
> and data inventory.
It should be.
> Something like:
>
> hw.machine: amd64
> hw.model: Intel(R) Xeon(R) CPU E5-2640 v2 @ 2.00GHz
> hw.ncpu: 32
> hw.nphyscpu: 2
> ^^^^^^^^^^^^
I think hw.nsocket would make more sense. Whoever does this should
check to see if any other UNIX platforms have picked a suitable name.
> This is an example from my system with two 2 physical CPUs installed. No system
> virtualization in place, like Xen, etc ...
>
> Or is it possible currently to get easily this information ? I havent found one
> except dmesg information.
>
> FreeBSD/SMP: Multiprocessor System Detected: 32 CPUs
> FreeBSD/SMP: 2 package(s) x 8 core(s) x 2 SMT threads
> cpu0 (BSP): APIC ID: 0
> cpu1 (AP): APIC ID: 1
> cpu2 (AP): APIC ID: 2
> cpu3 (AP): APIC ID: 3
> cpu4 (AP): APIC ID: 4
> cpu5 (AP): APIC ID: 5
> cpu6 (AP): APIC ID: 6
> cpu7 (AP): APIC ID: 7
> cpu8 (AP): APIC ID: 8
> cpu9 (AP): APIC ID: 9
> cpu10 (AP): APIC ID: 10
> cpu11 (AP): APIC ID: 11
> cpu12 (AP): APIC ID: 12
> cpu13 (AP): APIC ID: 13
> cpu14 (AP): APIC ID: 14
> cpu15 (AP): APIC ID: 15
> cpu16 (AP): APIC ID: 32
> cpu17 (AP): APIC ID: 33
> cpu18 (AP): APIC ID: 34
> cpu19 (AP): APIC ID: 35
> cpu20 (AP): APIC ID: 36
> cpu21 (AP): APIC ID: 37
> cpu22 (AP): APIC ID: 38
> cpu23 (AP): APIC ID: 39
> cpu24 (AP): APIC ID: 40
> cpu25 (AP): APIC ID: 41
> cpu26 (AP): APIC ID: 42
> cpu27 (AP): APIC ID: 43
> cpu28 (AP): APIC ID: 44
> cpu29 (AP): APIC ID: 45
> cpu30 (AP): APIC ID: 46
> cpu31 (AP): APIC ID: 47
Whoever implements this would want to find the code that prints this
and use the information to initialize the sysctl variable.
> Probable things will get complicated a bit if the system is a guest under Xen or other
> hypervisor. But probable there the nphyscpu should be NA ?
The hypervisor is able to pass through a geometry, so this would still
make sense there.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140804/4002b625/attachment.sig>
More information about the freebsd-hackers
mailing list