Re: [PATCH] pack-objects: Add runtime detection of online CPU's
- From
Bert Wesarg <bert.wesarg@googlemail.com>
- Date
- Feb 12, 2008, 11:18 UTC
- Message-ID
- <36ca99e90802120318y5099b06cta3f8488dc758f6@mail.gmail.com>
- In-Reply-To
- <47B156CD.1010209@op5.se>
Hi,
On Feb 12, 2008 9:20 AM, Andreas Ericsson <ae@op5.se> wrote:
Show 7 quoted lines
> +#ifdef THREADED_DELTA_SEARCH > +# ifdef _SC_NPROCESSORS_ONLN > + long ncpus; > + > + if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0) > + return (int)ncpus; > +# else
I can't find the right pointer, but for linux it would be more usable to use sched_getaffinity(). Than you can do thinks like this:
$ taskset 0x3 git gc ...
and you will get 2 cpus, even 4 are online.
Bert