Linux / Drivers / Mtd
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,959 units with 91,658 lines of code in units (76.0% of code).
    • 85 very long units (11,737 lines of code)
    • 338 long units (22,635 lines of code)
    • 975 medium size units (31,056 lines of code)
    • 1,158 small units (16,968 lines of code)
    • 1,403 very small units (9,262 lines of code)
12% | 24% | 33% | 18% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c12% | 24% | 33% | 18% | 9%
h0% | 0% | 9% | 0% | 90%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
nand10% | 25% | 33% | 20% | 10%
ubi24% | 26% | 30% | 12% | 5%
ROOT16% | 20% | 35% | 18% | 8%
maps24% | 14% | 29% | 16% | 14%
devices8% | 15% | 46% | 17% | 11%
chips9% | 37% | 31% | 10% | 11%
parsers27% | 31% | 26% | 8% | 5%
spi-nor6% | 19% | 35% | 24% | 14%
lpddr0% | 32% | 48% | 9% | 10%
hyperbus0% | 34% | 26% | 15% | 23%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
324 97 3
218 18 2
212 27 1
211 56 1
208 45 2
200 41 3
197 28 1
196 41 3
184 41 3
180 17 1
178 11 4
173 52 3
171 38 1
170 47 4
167 34 3
165 33 3
163 33 2
163 41 1
163 28 4
162 34 1
162 20 4
161 26 1
160 19 4
158 29 1
158 30 2
150 24 1
148 33 2
147 28 4
146 36 3
144 32 1
143 23 2
141 24 1
138 21 5
137 34 2
135 22 5
134 25 1
132 21 2
131 31 2
130 29 3
129 37 2
129 22 3
129 20 6
129 22 1
129 26 1
129 25 2
128 25 1
128 20 1
127 35 3
124 19 2
119 20 3