Linux / Arch / Sh
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 1,611 units with 21,081 lines of code in units (33.5% of code).
    • 13 very long units (2,136 lines of code)
    • 26 long units (1,631 lines of code)
    • 217 medium size units (6,454 lines of code)
    • 355 small units (5,152 lines of code)
    • 1,000 very small units (5,708 lines of code)
10% | 7% | 30% | 24% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c11% | 8% | 30% | 24% | 25%
h0% | 0% | 30% | 24% | 45%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
kernel11% | 9% | 30% | 22% | 26%
boards25% | 4% | 21% | 26% | 21%
drivers0% | 16% | 39% | 22% | 22%
mm0% | 8% | 40% | 26% | 24%
include0% | 0% | 30% | 24% | 44%
lib0% | 0% | 28% | 61% | 10%
cchips0% | 0% | 43% | 16% | 40%
boot0% | 0% | 0% | 53% | 46%
math-emu0% | 0% | 0% | 20% | 79%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
292 14 1
245 76 2
210 5 1
189 1 1
181 45 1
170 56 1
145 28 3
135 20 6
125 2 1
124 39 5
111 1 1
108 31 4
101 3 1
99 9 1
90 15 1
79 11 2
77 13 5
67 1 2
67 18 3
66 16 3
66 9 3
66 3 1
64 9 6
63 16 2
61 1 2
60 9 5
59 11 1
59 10 3
59 10 3
55 12 2
54 16 3
54 10 3
54 10 3
53 13 1
53 3 1
52 7 3
52 2 3
51 3 1
51 12 1
50 11 1
50 7 3
49 9 4
49 8 3
48 13 1
48 2 3
47 9 1
47 7 1
46 9 2
46 1 1
46 10 2