Linux / Drivers / Platform
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 3,641 units with 62,545 lines of code in units (66.4% of code).
    • 25 very long units (3,098 lines of code)
    • 152 long units (9,933 lines of code)
    • 710 medium size units (21,808 lines of code)
    • 1,180 small units (17,430 lines of code)
    • 1,574 very small units (10,276 lines of code)
4% | 15% | 34% | 27% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c4% | 15% | 34% | 27% | 16%
h0% | 0% | 0% | 19% | 80%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
x865% | 15% | 32% | 29% | 16%
chrome3% | 23% | 42% | 18% | 11%
olpc23% | 11% | 24% | 20% | 20%
mellanox0% | 29% | 41% | 19% | 10%
surface0% | 5% | 40% | 33% | 20%
goldfish0% | 11% | 49% | 26% | 11%
mips0% | 0% | 49% | 18% | 31%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
277 27 1
152 30 1
137 22 2
135 32 1
128 122 2
125 37 3
122 17 1
121 32 1
120 9 2
120 114 2
119 47 2
119 14 1
117 16 1
117 11 2
117 35 1
114 20 1
112 16 2
112 22 1
109 28 1
109 45 1
107 16 1
105 12 1
102 1 4
101 15 2
101 34 4
100 29 2
100 21 2
99 26 1
98 13 2
95 15 2
93 23 1
92 19 1
92 19 2
91 24 1
87 18 2
86 12 1
85 19 2
84 32 2
83 12 3
82 15 1
82 7 3
80 21 1
80 11 2
80 27 4
80 22 2
79 14 2
79 20 1
79 17 1
78 16 1
77 9 2