Linux / Drivers / Input
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 5,203 units with 113,252 lines of code in units (74.9% of code).
    • 70 very long units (9,346 lines of code)
    • 413 long units (28,064 lines of code)
    • 1,298 medium size units (41,065 lines of code)
    • 1,448 small units (21,294 lines of code)
    • 1,974 very small units (13,483 lines of code)
8% | 24% | 36% | 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
c8% | 24% | 36% | 18% | 11%
h0% | 17% | 17% | 14% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
touchscreen7% | 25% | 38% | 17% | 10%
misc10% | 21% | 33% | 20% | 13%
keyboard10% | 29% | 30% | 18% | 11%
mouse5% | 21% | 43% | 20% | 9%
rmi413% | 29% | 32% | 16% | 8%
joystick7% | 34% | 33% | 14% | 9%
tablet23% | 26% | 25% | 6% | 17%
serio4% | 19% | 32% | 24% | 19%
ROOT3% | 14% | 40% | 25% | 16%
gameport0% | 7% | 46% | 27% | 18%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
276 82 1
230 28 4
212 44 1
210 1 3
205 48 2
197 55 1
181 38 2
178 47 1
164 33 1
163 25 2
161 55 4
159 45 4
157 28 1
157 41 7
149 37 1
149 38 1
149 27 2
147 34 1
144 44 2
142 37 1
141 54 3
140 35 1
139 25 2
137 21 2
135 30 2
133 21 2
129 25 1
128 34 1
128 33 2
128 26 1
127 14 2
125 29 1
125 26 6
122 23 1
122 27 3
121 36 3
120 24 2
120 29 2
120 19 1
119 21 1
118 22 1
117 22 2
116 22 2
116 23 2
114 17 1
114 24 1
112 21 3
111 24 6
111 45 1
110 19 2