util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lscpu : -b and -c option does not give expected output.
@ 2012-08-05 10:37 Faizan husain
  2012-08-06  5:08 ` faizan husain
  0 siblings, 1 reply; 8+ messages in thread
From: Faizan husain @ 2012-08-05 10:37 UTC (permalink / raw)
  To: util-linux; +Cc: faizan husain

From: faizan husain <faizanh@linux.vnet.ibm.com>

Options for lscpu command are giving incorrect output.
As per the man page or help, '-b' option should limit the output to online CPUs
and '-c' option should limit the output to offline CPUs.
But we could see the output is same for '-a','-b' and '-c' options.

Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>
---
 sys-utils/lscpu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index b93998a..648f51e 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1101,12 +1101,12 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 #endif
 	print_n(_("CPU(s):"), desc->ncpus);
 
-	if (desc->online)
+	if (desc->online && mod->online)
 		print_cpuset(mod->hex ? _("On-line CPU(s) mask:") :
 					_("On-line CPU(s) list:"),
 				desc->online, mod->hex);
 
-	if (desc->online && CPU_COUNT_S(setsize, desc->online) != desc->ncpus) {
+	if (desc->online && mod->online && CPU_COUNT_S(setsize, desc->online) != desc->ncpus) {
 		cpu_set_t *set;
 
 		/* Linux kernel provides cpuset of off-line CPUs that contains
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] lscpu : -b and -c option does not give expected output.
  2012-08-05 10:37 Faizan husain
@ 2012-08-06  5:08 ` faizan husain
  0 siblings, 0 replies; 8+ messages in thread
From: faizan husain @ 2012-08-06  5:08 UTC (permalink / raw)
  To: Faizan husain, util-linux

On Sunday 05 August 2012 04:07 PM, Faizan husain wrote:
> From: faizan husain <faizanh@linux.vnet.ibm.com>
>
> Options for lscpu command are giving incorrect output.
> As per the man page or help, '-b' option should limit the output to online CPUs
> and '-c' option should limit the output to offline CPUs.
> But we could see the output is same for '-a','-b' and '-c' options.
>
> Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>
> ---
>   sys-utils/lscpu.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
> index b93998a..648f51e 100644
> --- a/sys-utils/lscpu.c
> +++ b/sys-utils/lscpu.c
> @@ -1101,12 +1101,12 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
>   #endif
>   	print_n(_("CPU(s):"), desc->ncpus);
>
> -	if (desc->online)
> +	if (desc->online && mod->online)
>   		print_cpuset(mod->hex ? _("On-line CPU(s) mask:") :
>   					_("On-line CPU(s) list:"),
>   				desc->online, mod->hex);
>
> -	if (desc->online && CPU_COUNT_S(setsize, desc->online) != desc->ncpus) {
> +	if (desc->online && mod->online && CPU_COUNT_S(setsize, desc->online) != desc->ncpus) {
>   		cpu_set_t *set;
>
>   		/* Linux kernel provides cpuset of off-line CPUs that contains

please discard this patch as wrong patch has been sent, I will resend the patch again..

Thanks

Faizan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] lscpu : -b and -c option does not give expected output.
@ 2012-08-06  5:10 Faizan husain
  2012-08-06 11:50 ` Heiko Carstens
  0 siblings, 1 reply; 8+ messages in thread
From: Faizan husain @ 2012-08-06  5:10 UTC (permalink / raw)
  To: util-linux; +Cc: faizan husain

From: faizan husain <faizanh@linux.vnet.ibm.com>

Options for lscpu command are giving incorrect output.
As per the man page or help, '-b' option should limit the output to online CPUs
and '-c' option should limit the output to offline CPUs.
But we could see the output is same for '-a','-b' and '-c' options.

Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>
---
 sys-utils/lscpu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index b93998a..7c28a56 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1101,12 +1101,12 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 #endif
 	print_n(_("CPU(s):"), desc->ncpus);
 
-	if (desc->online)
+	if (desc->online && mod->online)
 		print_cpuset(mod->hex ? _("On-line CPU(s) mask:") :
 					_("On-line CPU(s) list:"),
 				desc->online, mod->hex);
 
-	if (desc->online && CPU_COUNT_S(setsize, desc->online) != desc->ncpus) {
+	if (desc->online && mod->offline && CPU_COUNT_S(setsize, desc->online) != desc->ncpus) {
 		cpu_set_t *set;
 
 		/* Linux kernel provides cpuset of off-line CPUs that contains
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] lscpu : -b and -c option does not give expected output.
  2012-08-06  5:10 [PATCH] lscpu : -b and -c option does not give expected output Faizan husain
@ 2012-08-06 11:50 ` Heiko Carstens
  2012-08-07  5:30   ` faizan husain
  0 siblings, 1 reply; 8+ messages in thread
From: Heiko Carstens @ 2012-08-06 11:50 UTC (permalink / raw)
  To: Faizan husain; +Cc: util-linux

On Sun, Aug 05, 2012 at 10:10:52PM -0700, Faizan husain wrote:
> From: faizan husain <faizanh@linux.vnet.ibm.com>
> 
> Options for lscpu command are giving incorrect output.
> As per the man page or help, '-b' option should limit the output to online CPUs
> and '-c' option should limit the output to offline CPUs.
> But we could see the output is same for '-a','-b' and '-c' options.
> 
> Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>

The -a, -b and -c options were meant to influence the output for the
extended (-e) and parsable (-p) output options.
I'm not sure it makes sense to change the default output with these
options. I'd prefer an update of the man page.

Hm?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] lscpu : -b and -c option does not give expected output.
  2012-08-06 11:50 ` Heiko Carstens
@ 2012-08-07  5:30   ` faizan husain
  2012-08-07  7:35     ` Heiko Carstens
  0 siblings, 1 reply; 8+ messages in thread
From: faizan husain @ 2012-08-07  5:30 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: util-linux

On Monday 06 August 2012 05:20 PM, Heiko Carstens wrote:
> On Sun, Aug 05, 2012 at 10:10:52PM -0700, Faizan husain wrote:
>> From: faizan husain <faizanh@linux.vnet.ibm.com>
>>
>> Options for lscpu command are giving incorrect output.
>> As per the man page or help, '-b' option should limit the output to online CPUs
>> and '-c' option should limit the output to offline CPUs.
>> But we could see the output is same for '-a','-b' and '-c' options.
>>
>> Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>
> The -a, -b and -c options were meant to influence the output for the
> extended (-e) and parsable (-p) output options.
> I'm not sure it makes sense to change the default output with these
> options. I'd prefer an update of the man page.
>
> Hm?
This fix is not going to influence the default output with these options 
(-e and -p),
and it does not make any sense if -a, -b and -c option print same output.

Thanks
Faizan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] lscpu : -b and -c option does not give expected output.
  2012-08-07  5:30   ` faizan husain
@ 2012-08-07  7:35     ` Heiko Carstens
  2012-08-07  8:23       ` Bernhard Voelker
  2012-08-07  9:01       ` faizan husain
  0 siblings, 2 replies; 8+ messages in thread
From: Heiko Carstens @ 2012-08-07  7:35 UTC (permalink / raw)
  To: faizan husain; +Cc: util-linux

On Tue, Aug 07, 2012 at 11:00:32AM +0530, faizan husain wrote:
> On Monday 06 August 2012 05:20 PM, Heiko Carstens wrote:
> >On Sun, Aug 05, 2012 at 10:10:52PM -0700, Faizan husain wrote:
> >>From: faizan husain <faizanh@linux.vnet.ibm.com>
> >>
> >>Options for lscpu command are giving incorrect output.
> >>As per the man page or help, '-b' option should limit the output to online CPUs
> >>and '-c' option should limit the output to offline CPUs.
> >>But we could see the output is same for '-a','-b' and '-c' options.
> >>
> >>Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>
> >The -a, -b and -c options were meant to influence the output for the
> >extended (-e) and parsable (-p) output options.
> >I'm not sure it makes sense to change the default output with these
> >options. I'd prefer an update of the man page.
> >
> >Hm?
> This fix is not going to influence the default output with these
> options (-e and -p),

Yes, I'm aware of that.

> and it does not make any sense if -a, -b and -c option print same output.

Just to make sure we talk about the same things:

extended output: -e option
parsable output: -p option
default output : no -e or -p option specified

What I tried to say above was that the -a, -b and -c modifiers were
only added to influence the output for the extended and parsable
options.
If you have a system with a lot of cpus the output can be significantly
different for the extended and parsable options if you specify any of the
modifiers.

The default output (no -e or -p) however is intended to give an overview
of the complete system.

So from a usability point of view: why would a user want to exclude the
line which contains the online list of cpus for the default output?

>From my point of view the correct "fix" would be to change the lscpu man
page in order to document that the -a, -b and -c modifiers only influence
the output for the extended and parsable options.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] lscpu : -b and -c option does not give expected output.
  2012-08-07  7:35     ` Heiko Carstens
@ 2012-08-07  8:23       ` Bernhard Voelker
  2012-08-07  9:01       ` faizan husain
  1 sibling, 0 replies; 8+ messages in thread
From: Bernhard Voelker @ 2012-08-07  8:23 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: faizan husain, util-linux


On 08/07/2012 09:35 AM, Heiko Carstens wrote:
> What I tried to say above was that the -a, -b and -c modifiers were
> only added to influence the output for the extended and parsable
> options.

If -a,-b,-c are not to be used with OUTPUT_SUMMARY, then what about
giving an error message when they are used together?

Have a nice day,
Berny



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] lscpu : -b and -c option does not give expected output.
  2012-08-07  7:35     ` Heiko Carstens
  2012-08-07  8:23       ` Bernhard Voelker
@ 2012-08-07  9:01       ` faizan husain
  1 sibling, 0 replies; 8+ messages in thread
From: faizan husain @ 2012-08-07  9:01 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: util-linux

On Tuesday 07 August 2012 01:05 PM, Heiko Carstens wrote:
> On Tue, Aug 07, 2012 at 11:00:32AM +0530, faizan husain wrote:
>> On Monday 06 August 2012 05:20 PM, Heiko Carstens wrote:
>>> On Sun, Aug 05, 2012 at 10:10:52PM -0700, Faizan husain wrote:
>>>> From: faizan husain <faizanh@linux.vnet.ibm.com>
>>>>
>>>> Options for lscpu command are giving incorrect output.
>>>> As per the man page or help, '-b' option should limit the output to online CPUs
>>>> and '-c' option should limit the output to offline CPUs.
>>>> But we could see the output is same for '-a','-b' and '-c' options.
>>>>
>>>> Signed-off-by: faizan husain <faizanh@linux.vnet.ibm.com>
>>> The -a, -b and -c options were meant to influence the output for the
>>> extended (-e) and parsable (-p) output options.
>>> I'm not sure it makes sense to change the default output with these
>>> options. I'd prefer an update of the man page.
>>>
>>> Hm?
>> This fix is not going to influence the default output with these
>> options (-e and -p),
> Yes, I'm aware of that.
>
>> and it does not make any sense if -a, -b and -c option print same output.
> Just to make sure we talk about the same things:
>
> extended output: -e option
> parsable output: -p option
> default output : no -e or -p option specified
>
> What I tried to say above was that the -a, -b and -c modifiers were
> only added to influence the output for the extended and parsable
> options.
> If you have a system with a lot of cpus the output can be significantly
> different for the extended and parsable options if you specify any of the
> modifiers.

yes it does ...

[root@mx3650m2 ~]# lscpu -a

[...]

CPU(s):                16

On-line CPU(s) list:   0-2,4,6-8,10-15

Off-line CPU(s) list:  3,5,9

[...]

[root@mx3650m2 ~]# lscpu -e

CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE

0   0    0      0    0:0:0:0       yes

1   0    0      1    1:1:1:0       yes

2   0    0      2    2:2:2:0       yes

3   -    -      -    :::           no

4   1    1      3    3:3:3:1       yes

5   -    -      -    :::           no

6   1    1      4    4:4:4:1       yes

7   1    1      5    5:5:5:1       yes

8   0    0      0    0:0:0:0       yes

9   -    -      -    :::           no

10  0    0      2    2:2:2:0       yes

11  0    0      6    6:6:6:0       yes

12  1    1      3    3:3:3:1       yes

13  1    1      7    7:7:7:1       yes

14  1    1      4    4:4:4:1       yes

15  1    1      5    5:5:5:1       yes

[root@mx3650m2 ~]# lscpu -p

# The following is the parsable format, which can be fed to other

# programs. Each different item in every column has an unique ID

# starting from zero.

# CPU,Core,Socket,Node,,L1d,L1i,L2,L3

0,0,0,0,,0,0,0,0

1,1,0,0,,1,1,1,0

2,2,0,0,,2,2,2,0

4,3,1,1,,3,3,3,1

6,4,1,1,,4,4,4,1

7,5,1,1,,5,5,5,1

8,0,0,0,,0,0,0,0

10,2,0,0,,2,2,2,0

11,6,0,0,,6,6,6,0

12,3,1,1,,3,3,3,1

13,7,1,1,,7,7,7,1

14,4,1,1,,4,4,4,1

15,5,1,1,,5,5,5,1

[root@mx3650m2 ~]#

>
> The default output (no -e or -p) however is intended to give an overview
> of the complete system.
>
> So from a usability point of view: why would a user want to exclude the
> line which contains the online list of cpus for the default output?

default output has no problem here,it will contain both online and offline cpus

as mentioned in the man page.

        -a, --all

               Include online and offline CPUs in the output (default for -e).

and if user wants to limit the output to only online/offline cpus then he can use -b / -c modifier

        -b, --online

               Limit the output to online CPUs (default for -p).

        -c, --offline

               Limit the output to offline CPUs.

>  From my point of view the correct "fix" would be to change the lscpu man
> page in order to document that the -a, -b and -c modifiers only influence
> the output for the extended and parsable options.

Thanks

Faizan


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-07  9:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-06  5:10 [PATCH] lscpu : -b and -c option does not give expected output Faizan husain
2012-08-06 11:50 ` Heiko Carstens
2012-08-07  5:30   ` faizan husain
2012-08-07  7:35     ` Heiko Carstens
2012-08-07  8:23       ` Bernhard Voelker
2012-08-07  9:01       ` faizan husain
  -- strict thread matches above, loose matches on Subject: below --
2012-08-05 10:37 Faizan husain
2012-08-06  5:08 ` faizan husain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).