From: P S Subject: Re: Enhancing Xen's Kconfig infrastructure to support tailored solutions Date: Tue, 19 Feb 2019 16:05:43 -0500 Message-ID: <91366EC9-9448-43CE-9D80-88401FB48B5B@gmail.com> References: <5C653AB10200007800216997@prv1-mh.provo.novell.com> <20190215110807.jtybxyfl523vwo3y@zion.uk.xensource.com> <20190218111234.r7ae42wswy2hjo7k@zion.uk.xensource.com> <1636EB19-FE45-42FF-B4D3-8CE8853BD040@gmail.com> <20190218112337.qoyws3pedxav4wmf@zion.uk.xensource.com> <59568551-146c-e0b7-2f94-4f9ee19c5325@citrix.com> <1B830543-1B7B-4DF4-8D1E-FB862FEE836C@gmail.com> <20190218115712.s7os5yx5sxvqq7n4@zion.uk.xensource.com> <775bed6a-1c35-3614-9a86-4fcedf84acd4@citrix.com> Mime-Version: 1.0 (1.0) Content-Type: multipart/mixed; boundary="===============5045514908740122145==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" To: Stefano Stabellini Cc: James McKenzie , Christopher Clark , robin.randhawa@arm.com, Wei Liu , Suravee Suthikulpanit , Lars Kurth , Andrew Cooper , Doug Goldstein , Marek Marczykowski , George Dunlap , "Daniel P.Smith" , Daniel Smith , Paul Durrant , committers@xenproject.org, Jan Beulich , Stewart Hildebrand , Jun Nakajima , xen-devel List-Id: xen-devel@lists.xenproject.org --===============5045514908740122145== Content-Type: multipart/alternative; boundary=Apple-Mail-993D9079-4D0D-426B-B960-DA4FEB92959F Content-Transfer-Encoding: 7bit --Apple-Mail-993D9079-4D0D-426B-B960-DA4FEB92959F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable On Feb 19, 2019, at 14:13, Stefano Stabellini wrote= : >=20 >> On Mon, 18 Feb 2019, Lars Kurth wrote: >> On 18 Feb 2019, at 12:16, George Dunlap w= rote: >>=20 >> On 2/18/19 12:11 PM, George Dunlap wrote: >> On 2/18/19 12:01 PM, Andrew Cooper wrote: >> On 18/02/2019 11:57, Wei Liu wrote: >> On Mon, Feb 18, 2019 at 11:53:15AM +0000, Lars Kurth wro= te: >>=20 >> On 18 Feb 2019, at 11:30, George Dunlap >> wrote: >>=20 >> On 2/18/19 11:23 AM, Wei Liu wrote: >> On Mon, Feb 18, 2019 at 11:17:56AM +00= 00, Lars >> Kurth wrote: >> Thank you Wei. It's interesting t= hough >> that the full vs HVM only is alm= ost >> identical in terms of SLOC's >> Lars >>=20 >> The cloc target counts the files in th= e dependency >> graph generated by >> make. >>=20 >> Do we know for sure that CLOC counts everything in= a file or does it honour >> the pre-processor settings? >>=20 >> We certainly don't feed any preprocessor defines to it. I= doubt it >> understand C to that level of details anyway. >>=20 >>=20 >> LoC isn't a fantastic metric under any circumstance. >>=20 >> Bigger code is definitely better, if the reason it is bigger i= s because >> it is because it is formatted for readability/clarity etc. >>=20 >> Attempting to optimise for smaller LoC, other than making enti= re >> functional areas optional, is usually short sighted. >>=20 >>=20 >> For instance, we could probably decrease the LoC by nearly 20k by >> changing the style not to give the opening bracket its own line: >>=20 >> $ find . -name '*.c' | xargs grep '^[[:space:]]*{' | wc -l >> 19896 >> $ find . -name '*.[ch]' | xargs grep '^[[:space:]]*{' | wc -l >> 21847 >>=20 >>=20 >> This is hypervisor only BTW (run from xen.git/xen). >>=20 >> It is a bit mind-boggling to think that there are more open brackets in >> the Xen code base than there is PV-specific code. O_o >>=20 >>=20 >> As we have the same coding conventions across hypervisor code, that shoul= dn't make a difference >=20 > This is amazing, in a terrible kind of way: all our numbers will be > inflated by 20K!! For Xen on Arm is almost 50%! I am half-thinking we > should add xargs grep '^[[:space:]]*{' to the make cloc target. UCC (Unified Code Count) [1] can measure/diff logical SLOC for several langu= ages. Rich [1] Papers=20 http://csse.usc.edu/TECHRPTS/2007/usc-csse-2007-737/usc-csse-2007-737.pdf http://csse.usc.edu/csse/event/2012/COCOMO/presentations/TOR-2010(3906)-72_L= ibrary.pdf http://www.nguyenvvu.net/wp-content/uploads/2015/07/UCC_Tool_Description.pdf= [2] Source http://csse.usc.edu/ucc_new/wordpress/2018/07/26/ucc-version-2018-07/ [3] Build g++ ./src/*.cpp -o UCC -std=3Dc++0x -DUNIX -O3 [4] Run UCC -dir xen *.c -outdir report --Apple-Mail-993D9079-4D0D-426B-B960-DA4FEB92959F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On = Feb 19, 2019, at 14:13, Stefano Stabellini <sstabellini@kernel.org> wrote:
On Mon, 18 Feb 2019,= Lars Kurth wrote:
  &n= bsp;  On 18 Feb 2019, at 12:16, George Dunlap <george.dunlap@citrix.com> wrote:

On 2/18/19 12:11 PM, George Dunlap wrote:<= br>
    &nb= sp;On 2/18/19 12:01 PM, Andrew Cooper wrote:
        &nb= sp;  On 18/02/2019 11:57, Wei Liu wrote:
       &nb= sp;         On Mon, Feb 18, 201= 9 at 11:53:15AM +0000, Lars Kurth wrote:

&= nbsp;            = ;            &nb= sp;   On 18 Feb 2019, at 11:30, George Dunlap
      = ;            &nb= sp;          <george.dunlap@citrix.com> wrote:

       =             &nbs= p;         On 2/18/19 11:23 AM,= Wei Liu wrote:
&nbs= p;            &n= bsp;            =          On Mon, Feb 18, 2019 a= t 11:17:56AM +0000, Lars
            = ;            &nb= sp;          Kurth wrote:<= /span>
   &n= bsp;            =             &nbs= p;            Th= ank you Wei. It's interesting though
          = ;            &nb= sp;            &= nbsp;     that the full vs HVM only is almost
    &= nbsp;            = ;            &nb= sp;           identic= al in terms of SLOC's
            &n= bsp;            =             &nbs= p;   Lars

  &nb= sp;            &= nbsp;            = ;       The cloc target counts the files i= n the dependency
&nb= sp;            &= nbsp;            = ;         graph generated by
   &nbs= p;            &n= bsp;            =       make.

            &n= bsp;          Do we know f= or sure that CLOC counts everything in a file or does it honour
     &n= bsp;            =      the pre-processor settings?

         &nbs= p;       We certainly don't feed any prep= rocessor defines to it. I doubt it
          &n= bsp;      understand C to that level of detail= s anyway.

=

        &n= bsp;  LoC isn't a fantastic metric under any circumstance.<= br>

        = ;   Bigger code is definitely better, if the reason it is big= ger is because
 = ;          it is because i= t is formatted for readability/clarity etc.

           Attemp= ting to optimise for smaller LoC, other than making entire
      &= nbsp;    functional areas optional, is usually short sig= hted.


     For instance, we could p= robably decrease the LoC by nearly 20k by
     changing the style not t= o give the opening bracket its own line:

&= nbsp;    $ find . -name '*.c' | xargs grep '^[[:space:]]= *{' | wc -l
 &n= bsp;   19896
     $ find . -name '*.[ch]' | xargs grep '= ^[[:space:]]*{' | wc -l
     21847

<= /span>
This is hypervisor on= ly BTW (run from xen.git/xen).

It is a bi= t mind-boggling to think that there are more open brackets in
the Xen code base than there is PV-= specific code. O_o


As we have the same coding conventions acr= oss hypervisor code, that shouldn't make a difference

This is amazing, in a terrible kind of way: all our n= umbers will be
inflated by 20K!! For Xen on Arm is almost 50= %! I am half-thinking we
should add xargs grep '^[[:space:]]= *{' to the make cloc target.

UCC (Unified Code Count) [1] can measure/diff logical SLOC for several lan= guages.

Rich

[1] Papers 
http://csse.usc.edu/TECHRPTS/2007/usc-csse-2007-737/usc-csse-20= 07-737.pdf<= div>

[2] Source

[3] Build
g++ ./src/*.cpp -o UCC -std=3Dc++0x -DUNIX -O3

[4] Run
UCC -dir xen *.c -outdir report

= --Apple-Mail-993D9079-4D0D-426B-B960-DA4FEB92959F-- --===============5045514908740122145== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============5045514908740122145==--