KLOC in Samba? [was Re: NamedPipe API design; freedce / samba interoperability issues]

Green, Paul Paul.Green at stratus.com
Fri Jan 11 12:28:05 GMT 2002


Jerry says Samba 3.0 is 279,068 LOC.
Luke says Samba TNG is 347,381 LOC.

but both of these estimates count blank lines and comment lines.  We have a
tool that knows a little more about C syntax and counts comments and blank
lines separately, so I ran it on Samba 2.2.2 (I don't have a copy of Samba
3.0 handy) and came up with the following data. Yes, I know someone had to
code those blank and comment lines, but it hardly seems fair to give them
the same weight as C code.  BTW, I'm NOT trying to minimize the effort that
has gone into Samba, just trying to measure the effort a with a little more
precision.

{cd to samba-2.2.2/source}
{ignores: configure.in, codepages/*, script/*}
srcstat aparser/*.* aparser/templates/* client/*.c groupdb/*.c include/*.h*
lib
+/*.c libsmb/*.c locking/*.c msdfs/*.c nmbd/*.c nsswitch/*.* pam_smbpass/*.*
pa
+ram/*.c passdb/*.c printing/*.c profile/*.c rpc_client/*.c rpc_parse/*.c
rpc_s
+erver/*.c rpcclient/*.c smbd/*.c smbwrapper/*.c smbwrapper/*.h tdb/*.c
tdb/*.h
+ tests/*.c ubiqx/*.c ubiqx/*.h utils/*.c web/*.c web/po/*.h
-no_per_file_stati
+stics
srcstat: Version 1.4 (Aug 25 1999 12:41)

For all files:
Total tokens: 1996208 total, 1 min, 4536.8 avg, 75644 max
Code tokens: 1127792 (56.5%); per code line: 1 min, 6.7 avg, 51 max
Comment tokens: 868416 (43.5%); per comment line: 1 min, 17.8 avg, 83 max
Tokens per comment: 2 min, 46.1 avg, 1796 max
Lines: 259448; code: 168211 (64.8%), comment: 48883 (18.8%)
           whitespace: 47435 (18.3%), code & comment: 5081 (2.0%)

What this says is that Samba 2.2.2 has 168,211 LOC of *.C/*.H and AWK
scripts.  I ignored the code page files and the script files.  It also says
that somewhere in Samba is a source file with 51 code tokens on a single
line of text, and a comment with 1796 words/tokens in it....


If we separately look at just the C code and Headers, then the following
data emerges:

{Just the C source files}
srcstat aparser>*.c client>*.c groupdb>*.c lib>*.c libsmb>*.c locking>*.c
msdfs
+>*.c nmbd>*.c nsswitch>*.c pam_smbpass>*.c param>*.c passdb>*.c
printing>*.c p
+rofile>*.c rpc_client>*.c rpc_parse>*.c rpc_server>*.c rpcclient>*.c
smbd>*.c
+smbwrapper>*.c tdb>*.c tests>*.c ubiqx>*.c utils>*.c web>*.c
-no_per_file_stat
+istics
srcstat: Version 1.4 (Aug 25 1999 12:41)

For all files:
Total tokens: 1729164 total, 10 min, 5506.9 avg, 65700 max
Code tokens: 929207 (53.7%); per code line: 1 min, 6.7 avg, 51 max
Comment tokens: 799957 (46.3%); per comment line: 1 min, 19.6 avg, 83 max
Tokens per comment: 3 min, 53.6 avg, 1796 max
Lines: 219328; code: 138831 (63.3%), comment: 40799 (18.6%)
           whitespace: 42740 (19.5%), code & comment: 3042 (1.4%)
ready  14:27:18  1.085  69

==> 138,831 LOC in C.

{Just the Header files}
srcstat aparser>*.h include>*.h* nsswitch>*.h pam_smbpass>*.h smbwrapper>*.h
td
+b>*.h ubiqx>*.h web>po>*.h -no_per_file_statistics
srcstat: Version 1.4 (Aug 25 1999 12:41)

For all files:
Total tokens: 250618 total, 4 min, 3213.1 avg, 75644 max
Code tokens: 184463 (73.6%); per code line: 1 min, 6.9 avg, 48 max
Comment tokens: 66155 (26.4%); per comment line: 1 min, 8.5 avg, 77 max
Tokens per comment: 2 min, 18.4 avg, 1796 max
Lines: 36868; code: 26703 (72.4%), comment: 7764 (21.1%)
           whitespace: 4212 (11.4%), code & comment: 1811 (4.9%)

==> 26,703 of Headers.

So, counted this way, Samba 2.2.2 is 138,831+26,703 ==> 165,534 LOC.

The formula is TOTAL_LINES = EMPTY_LINES + CODE_LINES + COMMENT_LINES -
CODE_AND_COMMENT_LINES;

Thanks
PG
--
Paul Green, Senior Technical Consultant, Stratus Technologies.
Voice: +1 978-461-7557; FAX: +1 978-461-3610; Video on request.






-----Original Message-----
From: Luke Kenneth Casson Leighton [mailto:lkcl at samba-tng.org]
Sent: Friday, January 11, 2002 8:04 AM
To: Gerald (Jerry) Carter
Cc: tng-technical at lists.dcerpc.org; samba-technical at samba.org;
freedce-dev at lists.dcerpc.net
Subject: Re: KLOC in Samba? [was Re: NamedPipe API design; freedce /
samba interoperability issues]


On Wed, Jan 09, 2002 at 09:01:12PM -0600, Gerald (Jerry) Carter wrote:
> On Tue, 8 Jan 2002, Luke Kenneth Casson Leighton wrote:
> 
> >  SAMBA 3 was 340,000 lines of code, last time i checked, 2 years
> >  ago.  it's probably more like 380,000 by now, i guess.
> 
> Hmmm....I keep hearing this nunber thrown around....
> 
> [jerry at tashtego source]5$ pwd
> /opt/src/samba-cvs/samba/source
> 
> [jerry at tashtego source]6$ cat */*.[ch] | wc -l
>  279068
> 
> 
> Where are you getting these numbers from?
 
 pwd:
 /home/lkcl/tng/source

 cat */*.[ch] | wc -l:
 347381

 and that's with no significant development for the last
 18 months.

 lkcl




More information about the samba-technical mailing list