Re: [PATCH] add a script to diff rendered documentation
- From
Jeff King <peff@peff.net>
- Date
- Aug 6, 2018, 16:42 UTC
- Message-ID
- <20180806164208.GB19053@sigill.intra.peff.net>
- In-Reply-To
- <20180806150100.GC97564@aiede.svl.corp.google.com>
On Mon, Aug 06, 2018 at 08:01:00AM -0700, Jonathan Nieder wrote:
Show 10 quoted lines
> Jeff King wrote: > > > 3. Default to number of CPUs, which is what a lot of other threading > > in Git does. Unfortunately getting that from the shell is > > non-trivial. I'm OK with $(grep -c ^processor /proc/cpuinfo), but > > people on non-Linux platforms would have to fill in their own > > implementation. > > How about $(getconf _NPROCESSORS_ONLN)? That's what Linux's > scripts/coccicheck uses (apropos of a recent discussion :)).
Thanks, that's certainly less gross than grepping /proc/cpuinfo. getconf is POSIX, but _NPROCESSORS_ONLN is not. According to [1], it works on Linux and macOS, which is probably a reasonable start, though. This is, after all, a script aimed at developers, and the worst case is that we default back to 1.
-Peff
[1] https://stackoverflow.com/questions/42862559/one-liner-for-n-1-cores/42863212#42863212