Unused defines: some numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inspired by LWN article "Our [desktop] bloat problem" and a comment
about probability of finding unused prototype in kernel.

This is purely FYI.

   version   |   LOC   |    size   | nr_defines | nr_used | bloat |
             |  *.[ch] |   *.[ch]  |     [1]    |   [2]   |   %   |
-------------+---------+-----------+------------+---------+-------+
        0.01 |    8413 |    190551 |        698 |     398 | 42.98 | [4]
         1.0 |  165165 |   4413579 |       5791 |    4472 | 22.78 |
         1.2 |  281985 |   7599324 |      10840 |    7721 | 28.77 |
         1.3 |  310545 |   8332410 |      11637 |    8303 | 28.65 |
         2.0 |  674422 |  18866984 |      23804 |   16746 | 29.65 |
2.6.13-rc6-? | 6133558 | 180252914 |     248063 |  151492 | 38.93 | [3]

Consider the numbers as zero-order approximation because of obvious
flaws in this "research":

* Once one layer of unused defines is removed, another appears
  (real bloat >= bloat).
* Possible ## obfuscation (real bloat <= bloat).
* _Of_course_, my regexp-fu sucks (real nr_defines != nr_defines).
* Counting doesn't understand that
	include/asm-alpha/unistd.h: #define FUBAR 1
	include/asm-sparc/unistd.h: #define FUBAR 1
   means "unused" (real bloat >= bloat).
* Some numbers in *.c files can be these unused defines
  (real bloat <= bloat).

HTH to not put every single piece of hardware spec into kernel next
time.

P. S.: regk_iop_sw_cfg_rw_fifo_out1_extra_owner_default, no less.
-------------------------------------------------------------------
[1] As in

	find . -type f -name *.[ch]		| \
		xargs grep "#[\t ]*define[\t ]"	| \
		sed "s/.*#[\t ]*define[\t ]*//"	| \
		sed "s/[\t (].*//"		| \
		sort -u

[2] "used" means

	grep $DEFINE -w -r . | wc -l	>= 2

[3] Quite recent 2.6.13-rc6-git-something. I forgot [to cat down] exact version. 
[4] Not Linus's fault ;-). Remember about __NR_*.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux