Linux / 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 29,301 units with 624,382 lines of code in units (70.5% of code).
    • 496 very long units (73,649 lines of code)
    • 1,891 long units (127,414 lines of code)
    • 7,440 medium size units (232,105 lines of code)
    • 7,825 small units (116,581 lines of code)
    • 11,649 very small units (74,633 lines of code)
11% | 20% | 37% | 18% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c11% | 20% | 37% | 18% | 11%
h2% | 1% | 5% | 25% | 65%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ipv413% | 22% | 34% | 19% | 10%
mac8021120% | 20% | 34% | 15% | 8%
ipv616% | 20% | 34% | 18% | 10%
core14% | 17% | 33% | 20% | 13%
sched14% | 20% | 34% | 17% | 14%
wireless18% | 27% | 34% | 12% | 6%
netfilter9% | 17% | 37% | 22% | 13%
bluetooth6% | 21% | 40% | 20% | 11%
sctp11% | 17% | 44% | 17% | 8%
openvswitch22% | 14% | 35% | 17% | 9%
rxrpc22% | 24% | 33% | 10% | 8%
ceph9% | 15% | 38% | 23% | 13%
rds16% | 22% | 34% | 15% | 11%
tipc8% | 24% | 40% | 13% | 12%
tls31% | 19% | 29% | 12% | 7%
bridge5% | 23% | 37% | 17% | 16%
ax2526% | 19% | 32% | 13% | 7%
packet28% | 18% | 28% | 16% | 9%
decnet13% | 16% | 44% | 15% | 8%
smc7% | 22% | 40% | 19% | 10%
can11% | 25% | 37% | 15% | 10%
netlabel20% | 27% | 34% | 10% | 7%
x2523% | 21% | 33% | 15% | 5%
batman-adv5% | 24% | 41% | 18% | 10%
atm9% | 21% | 42% | 15% | 10%
xfrm6% | 15% | 44% | 23% | 9%
mptcp7% | 17% | 40% | 19% | 14%
rose17% | 24% | 34% | 14% | 8%
netrom19% | 18% | 42% | 10% | 9%
unix16% | 15% | 34% | 18% | 15%
nfc3% | 20% | 47% | 14% | 12%
dccp6% | 21% | 35% | 17% | 18%
l2tp9% | 28% | 36% | 17% | 7%
mpls16% | 26% | 36% | 14% | 5%
ncsi10% | 31% | 33% | 18% | 4%
dcb25% | 14% | 41% | 11% | 7%
kcm23% | 15% | 43% | 10% | 7%
caif8% | 26% | 40% | 10% | 13%
appletalk15% | 15% | 42% | 17% | 7%
6lowpan18% | 4% | 46% | 16% | 14%
8021q12% | 8% | 35% | 20% | 22%
vmw_vsock5% | 19% | 32% | 17% | 25%
xdp11% | 14% | 21% | 24% | 27%
llc5% | 8% | 37% | 20% | 27%
lapb16% | 33% | 30% | 9% | 10%
sunrpc1% | 14% | 37% | 26% | 20%
iucv6% | 21% | 41% | 22% | 8%
strparser47% | 0% | 6% | 15% | 30%
key5% | 27% | 39% | 18% | 8%
psample33% | 20% | 28% | 9% | 8%
hsr6% | 24% | 31% | 24% | 12%
phonet4% | 14% | 46% | 23% | 9%
9p4% | 28% | 36% | 21% | 9%
ethtool1% | 20% | 48% | 23% | 5%
mctp5% | 15% | 46% | 17% | 13%
netlink0% | 33% | 36% | 17% | 12%
ieee8021540% | 21% | 41% | 18% | 18%
ROOT0% | 30% | 28% | 25% | 14%
qrtr0% | 32% | 38% | 22% | 6%
dsa0% | 8% | 38% | 34% | 18%
mac8021540% | 8% | 34% | 42% | 13%
8020% | 8% | 42% | 30% | 18%
dns_resolver0% | 45% | 33% | 6% | 14%
switchdev0% | 11% | 30% | 33% | 24%
rfkill0% | 4% | 36% | 28% | 29%
bpf0% | 0% | 63% | 0% | 36%
l3mdev0% | 0% | 31% | 59% | 8%
ethernet0% | 0% | 21% | 42% | 36%
nsh0% | 0% | 84% | 0% | 15%
bpfilter0% | 0% | 32% | 41% | 26%
ife0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
726 186 4
517 165 5
495 180 7
452 95 9
445 169 5
392 99 9
388 66 5
359 124 5
351 44 2
345 44 1
329 43 5
326 47 4
306 91 1
304 81 7
293 101 5
293 60 1
289 70 1
282 88 6
279 81 1
277 89 5
275 88 4
274 82 5
266 61 2
264 64 4
259 64 2
259 77 8
258 68 12
255 77 3
254 80 5
252 102 1
251 90 5
251 62 3
245 27 3
240 62 5
235 50 4
232 62 3
231 55 6
230 56 3
230 64 1
230 1 1
229 43 9
229 63 2
227 48 4
225 85 5
222 61 5
221 66 3
220 63 5
219 45 3
218 56 11
218 54 3