facebook / openbmc-qemu
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 36,427 units with 659,090 lines of code in units (61.7% of code).
    • 588 very long units (97,077 lines of code)
    • 1,725 long units (118,050 lines of code)
    • 6,428 medium size units (200,034 lines of code)
    • 8,793 small units (128,826 lines of code)
    • 18,893 very small units (115,103 lines of code)
14% | 17% | 30% | 19% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c14% | 18% | 30% | 19% | 16%
inc31% | 14% | 26% | 13% | 13%
cc21% | 24% | 30% | 15% | 8%
pl25% | 12% | 31% | 18% | 11%
h4% | 7% | 12% | 16% | 59%
py3% | 11% | 26% | 19% | 38%
cpp19% | 22% | 26% | 14% | 15%
m0% | 20% | 32% | 38% | 9%
inl0% | 0% | 0% | 0% | 100%
frag0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
hw14% | 19% | 30% | 19% | 16%
block20% | 22% | 30% | 14% | 11%
tcg29% | 15% | 26% | 16% | 12%
ROOT29% | 15% | 26% | 16% | 12%
linux-user21% | 20% | 31% | 13% | 12%
disas26% | 14% | 21% | 12% | 24%
ui12% | 15% | 35% | 22% | 14%
softmmu12% | 9% | 31% | 26% | 19%
migration8% | 21% | 35% | 20% | 15%
scripts8% | 13% | 28% | 18% | 30%
bsd-user24% | 30% | 20% | 12% | 11%
fpu19% | 5% | 15% | 15% | 43%
tools11% | 22% | 35% | 21% | 8%
qga12% | 17% | 41% | 17% | 10%
nbd21% | 25% | 29% | 17% | 6%
monitor13% | 13% | 32% | 25% | 14%
net6% | 20% | 31% | 23% | 17%
accel5% | 6% | 26% | 27% | 34%
libdecnumber26% | 26% | 32% | 10% | 3%
fsdev28% | 25% | 28% | 10% | 6%
audio6% | 13% | 42% | 22% | 15%
semihosting46% | 0% | 9% | 21% | 22%
util2% | 11% | 31% | 30% | 24%
crypto12% | 13% | 29% | 26% | 18%
dump16% | 23% | 37% | 14% | 7%
chardev5% | 17% | 32% | 26% | 19%
include2% | 5% | 6% | 13% | 72%
scsi13% | 17% | 42% | 17% | 8%
pc-bios3% | 13% | 28% | 34% | 20%
contrib3% | 27% | 39% | 15% | 13%
storage-daemon44% | 23% | 14% | 10% | 8%
backends3% | 11% | 35% | 26% | 23%
io0% | 14% | 43% | 24% | 18%
qobject0% | 14% | 31% | 26% | 27%
plugins0% | 10% | 27% | 22% | 40%
python0% | 3% | 17% | 24% | 54%
qapi0% | 3% | 17% | 39% | 39%
qom0% | 4% | 23% | 38% | 33%
trace0% | 7% | 43% | 33% | 16%
replay0% | 0% | 30% | 30% | 39%
authz0% | 0% | 88% | 0% | 11%
subprojects0% | 0% | 31% | 11% | 56%
ebpf0% | 0% | 23% | 48% | 27%
stubs0% | 0% | 0% | 6% | 93%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
927 225 3
699 393 2
613 182 1
594 113 2
592 130 2
522 142 2
512 160 4
510 148 4
510 96 2
500 182 3
488 121 2
469 157 3
451 130 2
430 134 4
420 105 1
407 78 4
388 11 5
383 87 4
379 75 1
377 101 4
370 88 1
368 77 2
361 96 2
357 132 4
336 71 2
334 44 1
329 16 1
322 5 6
320 98 2
314 102 3
305 15 2
303 76 4
302 32 1
300 48 2
298 70 6
297 80 4
296 86 4
294 104 4
294 70 4
293 115 4
286 30 2
279 84 4
279 48 1
279 50 6
277 196 1
277 17 2
269 64 4
265 11 6
264 53 6
261 80 3