apple / darwin-xnu
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 2,106 units with 45,961 lines of code in units (4.1% of code).
    • 8 very complex units (2,528 lines of code)
    • 25 complex units (3,401 lines of code)
    • 163 medium complex units (9,411 lines of code)
    • 260 simple units (8,071 lines of code)
    • 1,650 very simple units (22,550 lines of code)
5% | 7% | 20% | 17% | 49%
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
c10% | 5% | 14% | 14% | 54%
py<1% | 9% | 26% | 21% | 41%
h0% | 4% | 23% | 3% | 67%
lua0% | 23% | 0% | 28% | 47%
pl0% | 0% | 50% | 10% | 38%
m0% | 0% | 45% | 28% | 25%
cpp0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
bsd10% | 5% | 12% | 17% | 54%
libkdd87% | 0% | 11% | 0% | <1%
iokit89% | 0% | 0% | 0% | 10%
tools<1% | 9% | 25% | 21% | 41%
osfmk0% | 7% | 19% | 11% | 61%
libkern0% | 0% | 30% | 9% | 60%
libsyscall0% | 0% | 37% | 22% | 40%
san0% | 0% | 57% | 0% | 42%
EXTERNAL_HEADERS0% | 0% | 0% | 0% | 100%
config0% | 0% | 0% | 0% | 100%
pexpert0% | 0% | 0% | 0% | 100%
security0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
static __attribute__()
in bsd/net/if.c
215 209 1
static __attribute__()
in bsd/net/if.c
687 186 1
reswitch: switch()
in iokit/Kernel/IOHibernateRestoreKernel.c
290 116 1
def ShowAllSetidLinks()
in tools/lldbmacros/waitq.py
208 103 2
691 93 5
310 74 9
static __attribute__()
in bsd/net/pf_ioctl.c
78 72 1
static ZONE_DECLARE()
in bsd/net/content_filter.c
49 58 3
def SaveStackshotReport()
in tools/lldbmacros/kcdata.py
179 50 3
def showmaphdrvme()
in tools/lldbmacros/memory.py
121 50 8
def VMObjectWalkPages()
in tools/lldbmacros/memory.py
129 50 2
def GetInPcb()
in tools/lldbmacros/net.py
121 49 2
def IterateAllPorts()
in tools/lldbmacros/ipc.py
118 48 6
def ShowAllPreposts()
in tools/lldbmacros/waitq.py
104 48 2
def __getattribute__()
in tools/lldbmacros/core/kernelcore.py
138 45 2
def ShowScheduler()
in tools/lldbmacros/scheduler.py
158 44 1
def DumpRawTraceFile()
in tools/lldbmacros/misc.py
197 43 2
def formatWaitInfo()
in tools/lldbmacros/kcdata.py
108 42 1
def GetKernelDebugBufferEntry()
in tools/lldbmacros/misc.py
105 42 1
336 40 5