[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] support for accessing CPU/core count (processor-count)
From: |
Arthur Miller |
Subject: |
Re: [PATCH] support for accessing CPU/core count (processor-count) |
Date: |
Mon, 11 Oct 2021 19:17:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Paul Eggert <eggert@cs.ucla.edu> writes:
> On 10/10/21 5:21 AM, Stefan Kangas wrote:
>> Omar Polo <op@omarpolo.com> writes:
>>> OpenBSD disables hyperthreading by default so HW_NCPU is (almost) always
>>> misleading. For example, on my machine
>>>
>>> % uname -a
>>> OpenBSD venera 7.0 GENERIC.MP#221 amd64
>>> % sysctl hw.ncpu
>>> hw.ncpu=8
>>> % sysctl hw.ncpuonline
>>> hw.ncpuonline=4
>>>
>>> and this has been the case for a while already (I mean, a couple of
>>> years if not more.)
>> BTW, Gnulib doesn't seem to make this distinction (lib/nproc.c:313).
>> Maybe that should be reported to the Gnulib developers?
>
>
> No need for a bug report as I'm one of those developers. To fix the Gnulib
> nproc
> OpenBSD issue I installed the first attached patch into Gnulib, and to port
> Emacs's recently-added processor-count code to more platforms I installed the
> second attached patch into Emacs's emacs-28 branch. Although I think the
> latter
> patch means that emacs/src/w32proc.c's w32-get-nproc function can be removed,
> I'll let the Emacs MS-Windows experts opine on that.
So you just included entire nproc into Emacs :). Ok. Anyway; it only gives
number of "logical cores" when "hyperthreading" is on not physical. I don't
think nproc can give you that either.