[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] support for accessing CPU/core count (processor-count)

From: Campbell Barton
Subject: Re: [PATCH] support for accessing CPU/core count (processor-count)
Date: Mon, 11 Oct 2021 15:01:38 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

On 10/11/21 14:04, Po Lu wrote:
Campbell Barton <ideasman42@gmail.com> writes:

This seems like a better location. Updated the patch, including
OpenBSD's ncpuonline support from Omar Polo.

Doesn't gnulib already have a portable mechanism to obtain the number of
CPUs in a system?  And if not, wouldn't it be useful there?

Yes, `num_processors (NPROC_ALL)` is an equivalent that would work.

Correction to my previous mail which mentioned CPU affinity being an issue, that's only used for `NPROC_CURRENT`.

If the additional complexity of GNULib's `lib/nproc.c` isn't viewed as a major down-side (~279-SLOC ~27-SLOC from the patch I submitted), both can work.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]