microsoft / Windows-driver-samples
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 5,037 units with 155,986 lines of code in units (15.4% of code).
    • 49 very complex units (21,919 lines of code)
    • 86 complex units (14,101 lines of code)
    • 395 medium complex units (34,064 lines of code)
    • 676 simple units (31,989 lines of code)
    • 3,831 very simple units (53,913 lines of code)
14% | 9% | 21% | 20% | 34%
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
cpp15% | 9% | 22% | 21% | 31%
c12% | 9% | 25% | 19% | 33%
cxx10% | 9% | 21% | 23% | 34%
h0% | 10% | 17% | 18% | 53%
CPP0% | 10% | 18% | 27% | 42%
js0% | 0% | 17% | 11% | 70%
cs0% | 0% | 0% | 7% | 92%
hpp0% | 0% | 0% | <1% | 99%
hxx0% | 0% | 0% | 39% | 60%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
network27% | 12% | 17% | 17% | 25%
wia23% | 19% | 21% | 13% | 22%
storage20% | 16% | 27% | 10% | 24%
wpd4% | 3% | 31% | 30% | 29%
video14% | 5% | 14% | 20% | 45%
print0% | 4% | 18% | 19% | 57%
setup0% | 19% | 42% | 21% | 17%
avstream0% | 3% | 19% | 21% | 55%
sensors0% | 4% | 18% | 36% | 39%
nfp0% | 16% | 14% | 25% | 43%
usb0% | 2% | 19% | 22% | 55%
general0% | 0% | 18% | 18% | 62%
pos0% | 0% | 41% | 29% | 29%
audio0% | 0% | 12% | 20% | 67%
hid0% | 0% | 65% | 9% | 24%
pofx0% | 0% | 59% | 24% | 16%
bluetooth0% | 0% | 77% | 0% | 22%
spb0% | 0% | 57% | 39% | 2%
serial0% | 0% | 26% | 37% | 35%
filesys0% | 0% | 0% | 29% | 70%
nfc0% | 0% | 0% | 34% | 65%
input0% | 0% | 0% | 0% | 100%
gnss0% | 0% | 0% | 0% | 100%
biometrics0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
PSTR KrnlHlprFwpValueGetStringForFwpsIncomingValue()
in network/trans/WFPSampler/syslib/HelperFunctions_FwpObjects.cpp
1320 540 3
UINT32 HlprCommandLineParseForFilterConditions()
in network/trans/WFPSampler/exe/HelperFunctions_CommandLine.cpp
3604 498 1
PSTR KrnlHlprExposedCalloutToString()
in network/trans/WFPSampler/sys/HelperFunctions_ExposedCallouts.cpp
731 337 1
_Out_opt_ _Deref_out_range_()
in storage/class/classpnp/src/class.c
1246 234 2
VOID NTAPI ClassifyBasicPacketExamination()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketExaminationCallouts.cpp
316 208 7
BOOLEAN HlprFwpmFilterConditionIsValidForLayer()
in network/trans/WFPSampler/lib/HelperFunctions_FwpmFilter.cpp
590 169 2
397 138 3
VOID NTAPI ClassifyFastPacketInjection()
in network/trans/WFPSampler/sys/ClassifyFunctions_FastPacketInjectionCallouts.cpp
755 127 7
NTSTATUS KrnlHlprIPHeaderGet()
in network/trans/WFPSampler/syslib/HelperFunctions_Headers.cpp
397 123 4
NTSTATUS PerformBasicPacketModificationAtInboundTransport()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketModificationCallouts.cpp
691 115 4
NTSTATUS KrnlHlprTransportHeaderGet()
in network/trans/WFPSampler/syslib/HelperFunctions_Headers.cpp
373 115 4
VOID NTAPI ClassifyBasicPacketModification()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketModificationCallouts.cpp
300 109 7
VOID NTAPI ClassifyBasicPacketExamination()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketExaminationCallouts.cpp
200 108 6
VOID PerformBasicPacketExaminationAtOther()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketExaminationCallouts.cpp
550 102 1
456 101 2
UINT32 HlprFwpmLayerGetFilterConditionArrayByKey()
in network/trans/WFPSampler/lib/HelperFunctions_FwpmLayer.cpp
376 95 2
VOID NTAPI ClassifyBasicPacketInjection()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketInjectionCallouts.cpp
233 93 7
VOID NTAPI ClassifyAdvancedPacketInjection()
in network/trans/WFPSampler/sys/ClassifyFunctions_AdvancedPacketInjectionCallouts.cpp
229 92 7
VOID NTAPI ClassifyFastPacketInjection()
in network/trans/WFPSampler/sys/ClassifyFunctions_FastPacketInjectionCallouts.cpp
553 90 6
HRESULT InitializeWIAItemProperties()
in wia/wiadriverex/usd/wiahelpers.cpp
441 90 3