Linux / Drivers / Net
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 81,320 units with 1,849,325 lines of code in units (58.6% of code).
    • 1,664 very long units (256,640 lines of code)
    • 5,697 long units (385,472 lines of code)
    • 21,553 medium size units (675,192 lines of code)
    • 22,610 small units (338,253 lines of code)
    • 29,796 very small units (193,768 lines of code)
13% | 20% | 36% | 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
c14% | 21% | 37% | 18% | 9%
h<1% | 1% | 3% | 16% | 77%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ethernet12% | 19% | 37% | 19% | 11%
wireless17% | 23% | 35% | 15% | 8%
fddi37% | 17% | 26% | 11% | 6%
usb14% | 19% | 37% | 18% | 9%
can9% | 26% | 33% | 20% | 10%
ROOT11% | 20% | 37% | 19% | 11%
wan21% | 18% | 36% | 14% | 8%
dsa4% | 12% | 40% | 26% | 15%
bonding18% | 19% | 30% | 19% | 10%
phy5% | 14% | 38% | 26% | 15%
hamradio14% | 25% | 35% | 16% | 8%
arcnet24% | 14% | 34% | 16% | 9%
ppp22% | 22% | 31% | 15% | 8%
wireguard10% | 26% | 28% | 19% | 14%
hyperv8% | 27% | 45% | 13% | 4%
xen-netback9% | 24% | 29% | 24% | 11%
hippi23% | 48% | 20% | 5% | 1%
team10% | 7% | 22% | 33% | 25%
fjes12% | 26% | 36% | 14% | 9%
ieee8021544% | 31% | 42% | 13% | 8%
appletalk9% | 26% | 40% | 16% | 7%
mctp31% | 0% | 49% | 10% | 8%
wwan0% | 10% | 49% | 23% | 15%
mdio0% | 21% | 38% | 25% | 15%
netdevsim0% | 15% | 39% | 28% | 16%
ipa0% | 8% | 39% | 31% | 19%
slip0% | 36% | 46% | 8% | 8%
ipvlan0% | 13% | 38% | 29% | 19%
caif0% | 31% | 29% | 19% | 20%
vmxnet30% | 24% | 44% | 19% | 11%
pcs0% | 6% | 56% | 26% | 10%
plip0% | 25% | 30% | 26% | 17%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
1814 7 3
939 174 4
854 168 4
786 122 4
672 185 2
599 91 2
580 123 5
568 51 1
548 199 2
501 1 4
484 9 3
482 67 1
479 88 5
477 81 1
462 82 2
446 48 1
443 80 2
434 35 2
429 64 1
425 65 1
424 75 5
418 3 4
418 37 1
413 132 5
408 42 1
407 99 4
398 22 1
385 67 1
381 61 2
380 50 2
378 62 7
378 72 2
376 94 3
374 112 2
366 15 1
365 19 2
365 68 2
363 74 1
360 105 3
356 67 1
355 50 2
354 84 2
353 18 3
351 61 3
349 84 2
348 85 1
347 59 3
342 121 4
341 87 4
340 42 1