facebookincubator / oculus-linux-kernel
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 369,193 units with 7,752,132 lines of code in units (57.8% of code).
    • 7,144 very long units (1,145,646 lines of code)
    • 23,500 long units (1,599,060 lines of code)
    • 83,091 medium size units (2,604,184 lines of code)
    • 95,500 small units (1,417,503 lines of code)
    • 159,958 very small units (985,739 lines of code)
14% | 20% | 33% | 18% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c15% | 21% | 34% | 18% | 11%
h2% | 2% | 10% | 18% | 65%
pl28% | 15% | 29% | 16% | 10%
py28% | 9% | 18% | 20% | 22%
cc8% | 13% | 36% | 25% | 15%
pm0% | 0% | 33% | 31% | 35%
inl0% | 0% | 0% | 0% | 100%
uc0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
drivers16% | 21% | 33% | 17% | 10%
fs18% | 23% | 31% | 15% | 9%
arch9% | 13% | 31% | 23% | 22%
sound13% | 21% | 34% | 18% | 11%
net11% | 19% | 37% | 18% | 12%
tools11% | 18% | 33% | 20% | 15%
scripts25% | 15% | 28% | 17% | 11%
kernel6% | 12% | 33% | 25% | 23%
lib19% | 16% | 31% | 19% | 13%
security10% | 18% | 35% | 18% | 17%
crypto14% | 13% | 35% | 21% | 15%
mm5% | 17% | 36% | 23% | 17%
block5% | 17% | 34% | 23% | 20%
virt6% | 8% | 37% | 26% | 20%
ipc10% | 20% | 25% | 23% | 19%
include<1% | <1% | 4% | 11% | 81%
init10% | 21% | 33% | 17% | 17%
usr0% | 35% | 43% | 14% | 6%
firmware0% | 75% | 0% | 8% | 16%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
4228 1 1
3202 1 1
2768 134 2
2349 6 2
2136 1 3
1479 1 3
1239 319 6
1236 12 1
1124 1117 2
1088 155 4
1050 181 1
1039 176 2
994 183 3
968 1 3
936 354 0
932 186 3
908 258 3
894 253 2
875 143 4
872 867 2
857 1 1
849 171 3
768 217 1
767 767 2
756 143 1
754 171 3
749 139 1
742 201 4
722 104 3
702 168 2
698 55 1
674 667 2
671 1 3
668 3 3
668 125 3
664 125 3
662 152 1
656 308 3
648 125 2
646 136 1
637 56 4
635 628 2
628 70 2
624 134 3
623 190 5
608 6 1
599 1 2
595 91 2
595 100 1
591 146 1