From: Dave Chinner <david@fromorbit.com>
To: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Cc: vasily.isaenko@oracle.com, xfs@oss.sgi.com
Subject: Re: [PATCH 1/2] xfstests: implemented _no_of_online_cpus() function
Date: Thu, 24 Oct 2013 08:31:52 +1100 [thread overview]
Message-ID: <20131023213152.GP2797@dastard> (raw)
In-Reply-To: <1382529524-2184-2-git-send-email-stanislav.kholmanskikh@oracle.com>
On Wed, Oct 23, 2013 at 03:58:43PM +0400, Stanislav Kholmanskikh wrote:
> Its purpose is to get a number of online cpus.
>
> Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
> ---
> common/rc | 19 +++++++++++++++++++
> 1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index 77e96c4..ff2f7fe 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2145,6 +2145,25 @@ _scale_fsstress_args()
> echo $args
> }
>
> +_no_of_online_cpus()
> +{
> + count=0
> +
> + for i in `cat /sys/devices/system/cpu/online | $SED_PROG 's/,/ /g'`; do
> + count=$(( $count + 1 ))
That's just as kernel/platform dependent as using /proc/cpuinfo.
Indeed, note this in generic/273:
_supported_os IRIX Linux
It's supposed to work on Irix as well, which means using sysfs is
just as wrong as using /proc/cpuinfo.
sysconf is the prefered platform neutral interface for getting this
sort of information. Something as simple as:
$ getconf _NPROCESSORS_ONLN
8
$
or adding a sysconf(_SC_NPROCESSORS_ONLN) call to src/features.c (if
we don't want to rely on systems having getconf installed) would be
much better than manually parsing magic proc or sysfs files.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-10-23 21:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 11:58 Avoid of using /proc/cpuinfo in generic tests Stanislav Kholmanskikh
2013-10-23 11:58 ` [PATCH 1/2] xfstests: implemented _no_of_online_cpus() function Stanislav Kholmanskikh
2013-10-23 13:08 ` Carlos Maiolino
2013-10-23 21:31 ` Dave Chinner [this message]
2013-10-24 8:56 ` [PATCH] xfstests: src/feature.c: print a number of online CPUs Stanislav Kholmanskikh
2013-10-24 10:40 ` Dave Chinner
2013-10-24 12:10 ` [PATCH V2] " Stanislav Kholmanskikh
2013-10-28 22:15 ` Dave Chinner
2013-10-29 10:03 ` [PATCH V3] " Stanislav Kholmanskikh
2013-11-05 12:41 ` Stanislav Kholmanskikh
2013-11-10 1:19 ` Rich Johnston
2013-11-10 1:20 ` Rich Johnston
2013-10-24 13:18 ` [PATCH] " Carlos Maiolino
2013-10-24 14:33 ` Stanislav Kholmanskikh
2013-10-24 21:23 ` Dave Chinner
2013-10-28 7:23 ` Stanislav Kholmanskikh
2013-10-28 12:23 ` Carlos Maiolino
2013-10-23 11:58 ` [PATCH 2/2] xfstests: generic/273: do not use /proc/cpuinfo Stanislav Kholmanskikh
2013-10-23 13:09 ` Carlos Maiolino
2013-10-24 0:14 ` Rich Johnston
2013-10-24 1:09 ` Dave Chinner
2013-11-11 9:34 ` [PATCH] xfstests: generic/273: use src/feature -o Stanislav Kholmanskikh
2013-11-11 11:10 ` Jeff Liu
2013-11-11 16:05 ` Rich Johnston
2013-11-11 16:06 ` Rich Johnston
2013-11-11 14:50 ` [PATCH 2/2] xfstests: generic/273: do not use /proc/cpuinfo Rich Johnston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131023213152.GP2797@dastard \
--to=david@fromorbit.com \
--cc=stanislav.kholmanskikh@oracle.com \
--cc=vasily.isaenko@oracle.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox