Re: Some very useless statistics

Thomas Koenig (ig25@fg70.rz.uni-karlsruhe.de)
21 Nov 1996 10:47:07 +0100


In linux.dev.kernel, Chai Harjo <c.harjo@student.anu.edu.au> wrote:

>> As of 2.0.25, there are 782 *.c files, 835 *.h files and 109 *.S files
>> in a total of 122 directories. These contain a total number of 234663
>> semicolons, 741201 lines, 79552 comments, 9930 #include and 36232
>> #define statements.

>What program did you use to do this?

A simple script (attached).

>How about testing 2.1.10 for comparison?

For 2.0.11:

There are 830 *.c files, 877 *.h files and 130 *.S files in a total of
124 directories. These contain a total number of 248228 semicolons,
781920 lines, 81706 comments, 10979 #include and 37540 #define statements.

For 1.2.13:

There are 400 *.c files, 365 *.h files and 38 *.S files in a total of 60
directories. These contain a total number of 99863 semicolons, 298207
lines, 30179 comments, 4490 #include and 13593 #define statements.

For 1.0.9:

There are 282 *.c files, 205 *.h files and 19 *.S files in a total of 34
directories. These contain a total number of 61615 semicolons, 170443
lines, 16562 comments, 2720 #include and 6899 #define statements.

These values fit a linear extrapolation over the kernel number surpisingly
well. Apart from revealing the Dark Secret that Linus has been hiding
from us (WHY he chose to go to 2.0 and not to 1.4), I now with total
confidence predict the following values for the stable version of 2.2:

\begin{crystal-ball}
There will be 883 *.c files, 963 *.h files and 127 *.S files in a total
of 140 directories. These will contain a total number of 269446
semicolons, 856001 lines, 92199 comments, 11388 #include and 42138
#define statements.
\end{crystal-ball}

Here's the promised script.

echo There are $(find . -name '*.c' | wc -l) '*.c' files, \
$(find . -name '*.h' | wc -l) '*.h' files and \
$(find . -name '*.S' | wc -l) '*.S' files in a total of \
$(find . -type d | wc -l) directories.
find . -name '*.[chS]' | xargs cat |
perl -e 'while (<>)
{ $nl++; $sem += s/\;/$1/g; $com+=s/\/\*/$1/g;
$inc+=/\#include/; $def += /\#define/; }
print "These contain a total number of $sem semicolons, ",
"$nl lines, $com comments, $inc \#include and ",
"$def \#define statements.";'
#define statements.