Linux / Drivers / Media
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 26,003 units with 621,043 lines of code in units (63.2% of code).
    • 635 very long units (106,895 lines of code)
    • 1,910 long units (130,901 lines of code)
    • 6,686 medium size units (209,119 lines of code)
    • 7,451 small units (111,177 lines of code)
    • 9,321 very small units (62,951 lines of code)
17% | 21% | 33% | 17% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c17% | 21% | 33% | 17% | 9%
h0% | 0% | 13% | 18% | 68%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
dvb-frontends29% | 20% | 29% | 14% | 6%
usb17% | 21% | 34% | 17% | 8%
pci16% | 19% | 33% | 19% | 10%
platform9% | 20% | 37% | 19% | 12%
i2c13% | 18% | 35% | 20% | 11%
tuners35% | 22% | 22% | 13% | 6%
common19% | 26% | 29% | 14% | 10%
v4l2-core16% | 21% | 31% | 17% | 13%
test-drivers14% | 26% | 31% | 17% | 10%
rc10% | 25% | 28% | 16% | 18%
cec24% | 21% | 28% | 13% | 11%
dvb-core22% | 23% | 30% | 15% | 8%
radio7% | 22% | 31% | 24% | 14%
firewire6% | 29% | 37% | 11% | 14%
mc6% | 8% | 48% | 17% | 19%
spi0% | 25% | 54% | 10% | 9%
mmc0% | 74% | 12% | 6% | 6%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
2768 134 2
2349 6 2
1260 214 1
892 253 2
857 1 1
686 154 1
638 117 3
595 147 1
589 129 4
537 114 3
466 109 1
458 77 1
456 111 2
452 96 1
432 77 2
409 127 1
408 119 3
403 64 1
403 261 8
400 45 1
397 59 6
394 156 4
383 65 3
375 82 4
357 63 1
347 57 2
344 22 2
337 67 1
334 48 1
332 143 1
326 83 1
319 90 1
316 6 1
313 111 3
311 60 1
308 87 1
306 42 8
301 48 1
299 83 1
297 75 1
288 185 2
281 58 1
274 20 1
264 95 1
261 80 1
257 12 2
256 18 2
256 38 1
256 41 2
254 64 3