Linux / Drivers / Block
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 2,569 units with 54,270 lines of code in units (76.4% of code).
    • 53 very long units (7,231 lines of code)
    • 157 long units (10,399 lines of code)
    • 640 medium size units (19,928 lines of code)
    • 698 small units (10,266 lines of code)
    • 1,021 very small units (6,446 lines of code)
13% | 19% | 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
c13% | 19% | 36% | 18% | 11%
h0% | 6% | 30% | 23% | 39%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
drbd21% | 17% | 32% | 17% | 10%
ROOT10% | 22% | 35% | 19% | 10%
mtip32xx24% | 20% | 32% | 16% | 6%
xen-blkback15% | 32% | 36% | 9% | 7%
rnbd11% | 4% | 45% | 19% | 18%
zram7% | 16% | 35% | 21% | 18%
paride0% | 13% | 46% | 22% | 17%
null_blk0% | 17% | 45% | 21% | 15%
aoe0% | 0% | 51% | 11% | 37%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
306 66 2
199 35 4
191 113 5
189 50 3
184 66 1
177 37 2
173 29 1
161 55 4
160 37 3
158 34 1
158 29 1
156 55 3
155 36 2
151 16 1
148 24 1
146 31 2
144 76 4
141 49 3
140 30 3
140 16 2
138 40 4
135 29 2
133 37 1
132 25 2
130 26 2
129 32 2
128 21 2
127 25 2
126 27 2
124 29 4
121 18 2
120 17 2
120 52 2
118 20 2
117 29 2
116 13 5
114 37 4
114 21 2
114 14 1
113 21 3
112 28 2
109 24 2
108 25 4
108 22 4
108 22 2
107 24 1
107 20 2
107 22 1
106 26 3
105 21 4