[dpdk-dev] [PATCH v4 5/9] app/procinfo: add support for show tm

Pattan, Reshma reshma.pattan at intel.com
Fri Nov 23 15:57:26 CET 2018



> -----Original Message-----
> From: Varghese, Vipin
> Sent: Friday, November 23, 2018 1:56 PM
> To: Pattan, Reshma <reshma.pattan at intel.com>; dev at dpdk.org;
> thomas at monjalon.net; stephen at networkplumber.org; Mcnamara, John
> <john.mcnamara at intel.com>
> Cc: Byrne, Stephen1 <stephen1.byrne at intel.com>; Glynn, Michael J
> <michael.j.glynn at intel.com>; Patel, Amol <amol.patel at intel.com>
> Subject: RE: [PATCH v4 5/9] app/procinfo: add support for show tm
> 
> 
> 
> > -----Original Message-----
> > From: Pattan, Reshma
> > Sent: Friday, November 23, 2018 7:04 PM
> > To: Varghese, Vipin <vipin.varghese at intel.com>; dev at dpdk.org;
> > thomas at monjalon.net; stephen at networkplumber.org; Mcnamara, John
> > <john.mcnamara at intel.com>
> > Cc: Byrne, Stephen1 <stephen1.byrne at intel.com>; Glynn, Michael J
> > <michael.j.glynn at intel.com>; Patel, Amol <amol.patel at intel.com>
> > Subject: RE: [PATCH v4 5/9] app/procinfo: add support for show tm
> >
> >
> >
> > > -----Original Message-----
> > > From: Varghese, Vipin
> > > Sent: Friday, November 23, 2018 1:29 PM
> > > To: Pattan, Reshma <reshma.pattan at intel.com>; dev at dpdk.org;
> > > thomas at monjalon.net; stephen at networkplumber.org; Mcnamara, John
> > > <john.mcnamara at intel.com>
> > > Cc: Byrne, Stephen1 <stephen1.byrne at intel.com>; Glynn, Michael J
> > > <michael.j.glynn at intel.com>; Patel, Amol <amol.patel at intel.com>
> > > Subject: RE: [PATCH v4 5/9] app/procinfo: add support for show tm
> > >
> > >
> > > > -----Original Message-----
> > > > From: Pattan, Reshma
> > > > Sent: Friday, November 23, 2018 5:21 PM
> > > > To: Varghese, Vipin <vipin.varghese at intel.com>; dev at dpdk.org;
> > > > thomas at monjalon.net; stephen at networkplumber.org; Mcnamara, John
> > > > <john.mcnamara at intel.com>
> > > > Cc: Byrne, Stephen1 <stephen1.byrne at intel.com>; Glynn, Michael J
> > > > <michael.j.glynn at intel.com>; Patel, Amol <amol.patel at intel.com>
> > > > Subject: RE: [PATCH v4 5/9] app/procinfo: add support for show tm
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Varghese, Vipin
> > > > > Sent: Thursday, November 22, 2018 1:28 PM
> > > > > To: Pattan, Reshma <reshma.pattan at intel.com>; dev at dpdk.org;
> > > > > thomas at monjalon.net; stephen at networkplumber.org; Mcnamara, John
> > > > > <john.mcnamara at intel.com>
> > > > > Cc: Byrne, Stephen1 <stephen1.byrne at intel.com>; Glynn, Michael J
> > > > > <michael.j.glynn at intel.com>; Patel, Amol <amol.patel at intel.com>
> > > > > Subject: RE: [PATCH v4 5/9] app/procinfo: add support for show
> > > > > tm
> > > > >
> > > > > Hi Reshma,
> > > > >
> > > > > <snipped>
> > > > >
> > > > > >
> > > > > > > +			if ((ret) | (!is_leaf))
> > > > > > > +
> > > > > >
> > > > > > Is the operator here should be || ?
> > > > > >
> > > > > >
> > > > >
> > > > > Check is done for 'if either ret is not 0 or if it ret is 0 but
> > > > > not leaf' we skip leaf details print. If 'ret is 0 and is leaf'
> > > > > we skip continue to print
> > > > leaf details.
> > > >
> > > > IMO, using logical operator over bitwise operator is good here in
> > > > if statement
> > > .
> > > > Like below.?
> > > >
> > > > If (ret || (is_leaf == 0 ))
> > >
> > > Thanks for the information, if the logic is correct do I need to
> > > change for v6
> > >
> >
> > OK in v6, but you can wait to hear more comments from others if any
> > before sending v6 .
> 
> Ok thanks Reshma, but can you tell me how the earlier logic fails and runs slow
> compared to logical or?

Not about faster or slower. 

Logical operators are commonly used in decision making in C programming. 
Bitwise operators are used in C programming to perform bit-level operations.

Since , above if condition is for decision making here logical || operator will fit , so I am suggesting to use that. 

We  don't need to do any bitwise manipulation in if condition to make the decision, so bitwise | operator is not needed


More information about the dev mailing list