Linux / Drivers / Base
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,693 units with 23,289 lines of code in units (74.1% of code).
    • 9 very long units (1,251 lines of code)
    • 30 long units (1,843 lines of code)
    • 278 medium size units (8,225 lines of code)
    • 425 small units (6,209 lines of code)
    • 951 very small units (5,761 lines of code)
5% | 7% | 35% | 26% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c5% | 7% | 35% | 26% | 24%
h0% | 0% | 0% | 13% | 86%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
regmap12% | 15% | 31% | 19% | 20%
ROOT3% | 4% | 32% | 30% | 28%
power3% | 7% | 42% | 25% | 20%
firmware_loader0% | 0% | 34% | 30% | 34%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
244 67 7
151 34 5
139 38 2
127 39 1
125 37 2
123 30 2
122 32 1
111 1 3
109 28 2
87 23 3
83 25 1
83 17 1
75 16 3
73 13 3
69 15 1
68 23 2
66 19 3
62 19 2
62 16 3
62 17 1
62 9 1
61 11 4
61 13 5
60 14 3
57 14 1
57 12 4
57 16 1
56 18 4
56 11 1
55 9 1
55 15 4
54 10 1
53 12 2
52 20 3
52 17 3
52 15 3
51 2 1
51 9 4
51 18 2
50 8 3
50 12 4
50 9 1
50 9 4
49 18 3
49 14 2
49 11 6
49 8 6
48 18 3
48 17 1
47 8 2