Re: [PATCH] core-count: A new program to count the number of cpu cores ( (original) (raw)

[Top][All Lists]


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


From: Pádraig Brady
Subject: Re: [PATCH] core-count: A new program to count the number of cpu cores (was: [PATCH] md5: accepts a new --threads option)
Date: Sun, 25 Oct 2009 21:21:48 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Giuseppe Scrivano wrote:

Jim Meyering <address@hidden> writes:

>>> If nobody is already working on it, I can start doing it. >>> >>> What about the name? "ncores" or "ncpus" are fine? >> Here are some longer candidates: >> >> count-cores >> count-cpus >> cpu-count >> core-count > Actually, "cpu" seems too ambiguous, so let's rule those out. > That leaves: > > ncores > count-cores > core-count > > Any others? > Preferences?

I went for `core-count'. This is the first version of the new program, it is a simple wrapper around the gnulib nproc module, thanks to Bruno to have done the real work.

Any comment?

I was pondering this and looking around as to whether an existing command could get an option to support this as I was a bit worried that a whole command was overkill.

Perhaps this new command could get more logic in future, though I can't think of anything obvious at present. In any case I don't like "core" in the name as there can be multiple processing units per core. I vote for "nproc".

diff --git a/tests/core-count/cpuinfo b/tests/core-count/cpuinfo + +test (grep′coreid′/proc/cpuinfo∣wc−l)−eq(grep '^core id' /proc/cpuinfo | wc -l) -eq (grepcoreid/proc/cpuinfowcl)eqcores || fail=1

grep '^proc'

cheers, Pádraig.