Linux / Kernel
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 12,243 units with 183,582 lines of code in units (68.9% of code).
    • 24 very complex units (4,689 lines of code)
    • 85 complex units (9,190 lines of code)
    • 533 medium complex units (29,171 lines of code)
    • 1,349 simple units (39,450 lines of code)
    • 10,252 very simple units (101,082 lines of code)
2% | 5% | 15% | 21% | 55%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
c2% | 5% | 15% | 21% | 54%
h0% | 3% | 13% | 15% | 67%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
bpf10% | 11% | 20% | 18% | 38%
ROOT2% | 4% | 14% | 23% | 56%
trace1% | 3% | 16% | 22% | 55%
power4% | 5% | 12% | 27% | 49%
sched<1% | 1% | 16% | 17% | 64%
debug0% | 26% | 22% | 18% | 32%
events0% | 5% | 10% | 25% | 58%
locking0% | 5% | 11% | 16% | 65%
rcu0% | 3% | 23% | 18% | 54%
cgroup0% | 4% | 13% | 26% | 55%
futex0% | 8% | 36% | 24% | 31%
printk0% | 3% | 25% | 23% | 46%
time0% | 0% | 9% | 22% | 68%
irq0% | 0% | 9% | 23% | 67%
dma0% | 0% | 12% | 16% | 70%
kcsan0% | 0% | 16% | 16% | 67%
livepatch0% | 0% | 5% | 42% | 52%
entry0% | 0% | 7% | 36% | 55%
gcov0% | 0% | 0% | 13% | 86%
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
210 125 3
282 110 6
386 102 1
263 86 1
193 83 8
110 72 2
287 71 2
165 67 4
133 64 1
173 64 5
239 61 4
196 60 5
249 59 3
231 59 3
147 59 3
181 57 5
185 57 4
107 55 4
166 54 3
191 53 5
169 53 4
125 52 3
170 52 3
131 51 2
158 50 1
112 49 1
176 48 4
129 47 1
178 46 1
168 46 2
66 45 2
73 44 2
136 43 2
166 43 3
162 43 3
136 42 3
109 42 1
105 42 1
93 41 4
135 40 7
142 40 2
136 39 5
125 39 1
135 39 2
123 39 6
92 39 5
130 38 3
133 38 4
142 38 1
84 37 2