Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 04 Feb 2023 21:35:29 +0100
From:      Steffen Nurpmeso <steffen@sdaoden.eu>
To:        Mateusz Guzik <mjg@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: d9d5f2c042a5 - main - cpuset: add --count
Message-ID:  <20230204203529.CusFt%steffen@sdaoden.eu>
In-Reply-To: <202302041751.314HpRrn042970@gitrepo.freebsd.org>
References:  <202302041751.314HpRrn042970@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Mateusz Guzik wrote in
 <202302041751.314HpRrn042970@gitrepo.freebsd.org>:
 |The branch main has been updated by mjg:
 |
 |URL: https://cgit.FreeBSD.org/src/commit/?id=d9d5f2c042a51a9f0dd69eb1fc3\
 |49efd81ffa483
 |
 |commit d9d5f2c042a51a9f0dd69eb1fc349efd81ffa483
 |Author:     Mateusz Guzik <mjg@FreeBSD.org>
 |AuthorDate: 2023-02-04 17:47:41 +0000
 |Commit:     Mateusz Guzik <mjg@FreeBSD.org>
 |CommitDate: 2023-02-04 17:50:41 +0000
 |
 |    cpuset: add --count
 |    
 |    Can be used to count the number of hardware threads in the cpu set.
 ...
 |    The intent is to replace calls to sysctl hw.ncpu and kern.smp.cpus \
 |    which
 |    can be found in the tree, which are not adequate given existence of
 |    cpusets.

This is great (in respect to a #freebsd IRC from 2021-07-02)!
Are there plans to address

  19:26 < RhodiumToad> and in fact sysconf(_SC_NPROCESSORS_ONLN) is implemented as  sysctl hw.ncpu

or

  19:25 < RhodiumToad> on fbsd 13 on a 4-cpu box, cpuset -l 0-1 getconf _NPROCESSORS_ONLN   returns 4 rather than 2

or even add a shallow usr.bin/nproc(1) that does only this
operation, as in Linux?  (Or ln(1) it and check out argv[0] to do
so?)  Having a "portable" thing would be great.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20230204203529.CusFt%steffen>