Linux / Include
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 15,964 units with 85,824 lines of code in units (12.3% of code).
    • 0 very long units (0 lines of code)
    • 11 long units (762 lines of code)
    • 160 medium size units (4,410 lines of code)
    • 852 small units (11,704 lines of code)
    • 14,941 very small units (68,948 lines of code)
0% | <1% | 5% | 13% | 80%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h0% | <1% | 5% | 13% | 80%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
linux0% | 1% | 3% | 10% | 84%
math-emu0% | 87% | 0% | 0% | 12%
sound0% | 4% | 13% | 9% | 72%
asm-generic0% | 2% | 11% | 12% | 74%
net0% | 0% | 7% | 22% | 69%
uapi0% | 0% | 19% | 22% | 57%
crypto0% | 0% | 12% | 27% | 60%
media0% | 0% | 4% | 11% | 83%
video0% | 0% | 12% | 0% | 87%
rdma0% | 0% | 2% | 20% | 77%
drm0% | 0% | 2% | 12% | 85%
xen0% | 0% | 7% | 14% | 77%
clocksource0% | 0% | 19% | 25% | 54%
scsi0% | 0% | 0% | 11% | 88%
soc0% | 0% | 0% | 4% | 95%
acpi0% | 0% | 0% | 3% | 96%
kvm0% | 0% | 0% | 8% | 91%
keys0% | 0% | 0% | 12% | 87%
trace0% | 0% | 0% | 18% | 81%
kunit0% | 0% | 0% | 0% | 100%
vdso0% | 0% | 0% | 0% | 100%
misc0% | 0% | 0% | 0% | 100%
memory0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
99 20 3
94 26 3
72 1 1
71 14 2
71 22 2
69 25 1
65 13 5
64 6 1
55 2 1
51 5 3
51 11 8
49 11 2
45 20 1
43 3 6
42 10 5
42 23 2
40 5 1
40 8 6
40 32 2
38 20 2
37 5 1
37 23 2
37 20 2
37 5 5
36 6 2
35 3 5
35 7 6
35 8 3
35 7 5
35 8 5
35 8 4
35 10 2
35 3 8
35 9 1
34 5 2
34 7 5
34 3 2
34 3 4
34 16 2
33 4 3
33 7 9
33 29 1
33 8 1
33 15 3
33 3 8
33 10 3
32 7 2
32 10 2
32 6 4
32 5 1