Linux / Drivers / Pci
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 3,706 units with 69,926 lines of code in units (76.1% of code).
    • 49 very long units (7,486 lines of code)
    • 168 long units (11,421 lines of code)
    • 821 medium size units (25,366 lines of code)
    • 1,041 small units (15,312 lines of code)
    • 1,627 very small units (10,341 lines of code)
10% | 16% | 36% | 21% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c10% | 16% | 36% | 21% | 14%
h0% | 0% | 10% | 16% | 73%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
hotplug26% | 18% | 32% | 13% | 9%
controller8% | 16% | 39% | 21% | 13%
ROOT4% | 13% | 32% | 28% | 20%
pcie4% | 7% | 42% | 30% | 14%
switch8% | 16% | 44% | 17% | 13%
endpoint0% | 28% | 34% | 26% | 10%
msi0% | 0% | 42% | 19% | 37%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
399 66 4
379 61 2
355 56 2
316 90 2
209 41 2
184 22 1
181 34 2
180 37 2
176 31 1
170 41 1
164 60 5
161 32 1
157 30 1
152 17 1
152 28 1
151 33 2
151 28 1
147 36 1
147 29 1
144 38 1
142 18 2
139 20 1
137 34 1
136 43 5
133 25 1
132 21 2
129 24 1
128 10 1
127 11 2
123 14 1
122 14 2
122 15 1
118 24 1
118 24 1
114 24 3
113 23 2
113 23 1
111 31 1
110 23 1
109 31 1
108 19 1
107 53 1
105 18 2
104 20 1
104 24 6
103 27 4
102 23 1
101 19 1
101 36 2
100 13 1