microsoft / Windows-driver-samples
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,037 units with 155,986 lines of code in units (15.4% of code).
    • 247 very long units (51,686 lines of code)
    • 521 long units (35,713 lines of code)
    • 1,371 medium size units (44,904 lines of code)
    • 957 small units (14,321 lines of code)
    • 1,941 very small units (9,362 lines of code)
33% | 22% | 28% | 9% | 6%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp34% | 23% | 29% | 8% | 3%
c44% | 24% | 20% | 7% | 3%
h13% | 17% | 31% | 17% | 19%
cxx15% | 26% | 41% | 9% | 7%
CPP10% | 56% | 26% | 5% | <1%
js17% | 0% | 3% | 30% | 48%
cs0% | 0% | 21% | 26% | 51%
hpp0% | 0% | 1% | 2% | 96%
hxx0% | 0% | 0% | 72% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
network51% | 21% | 20% | 4% | 1%
wia46% | 19% | 23% | 6% | 4%
storage59% | 17% | 15% | 5% | 1%
wpd12% | 36% | 39% | 7% | 4%
print9% | 15% | 41% | 21% | 12%
setup32% | 21% | 34% | 10% | 1%
general15% | 16% | 28% | 22% | 16%
usb16% | 23% | 15% | 4% | 39%
sensors16% | 30% | 40% | 10% | 1%
avstream9% | 21% | 42% | 17% | 9%
hid59% | 0% | 18% | 8% | 12%
video16% | 23% | 40% | 10% | 8%
pos26% | 35% | 26% | 6% | 4%
nfp27% | 14% | 31% | 19% | 6%
pofx59% | 24% | 16% | 0% | 0%
filesys44% | 0% | 23% | 4% | 26%
audio0% | 15% | 47% | 18% | 18%
spb0% | 97% | 0% | 0% | 2%
bluetooth0% | 77% | 22% | 0% | 0%
nfc0% | 34% | 16% | 31% | 17%
serial0% | 21% | 73% | 4% | 0%
gnss0% | 0% | 0% | 100% | 0%
input0% | 0% | 0% | 0% | 100%
biometrics0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
UINT32 HlprCommandLineParseForFilterConditions()
in network/trans/WFPSampler/exe/HelperFunctions_CommandLine.cpp
3604 498 1
PSTR KrnlHlprFwpValueGetStringForFwpsIncomingValue()
in network/trans/WFPSampler/syslib/HelperFunctions_FwpObjects.cpp
1320 540 3
_Out_opt_ _Deref_out_range_()
in storage/class/classpnp/src/class.c
1246 234 2
VOID NTAPI ClassifyFastPacketInjection()
in network/trans/WFPSampler/sys/ClassifyFunctions_FastPacketInjectionCallouts.cpp
755 127 7
PSTR KrnlHlprExposedCalloutToString()
in network/trans/WFPSampler/sys/HelperFunctions_ExposedCallouts.cpp
731 337 1
NTSTATUS PerformBasicPacketModificationAtInboundTransport()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketModificationCallouts.cpp
691 115 4
BOOLEAN HlprFwpmFilterConditionIsValidForLayer()
in network/trans/WFPSampler/lib/HelperFunctions_FwpmFilter.cpp
590 169 2
VOID NTAPI ClassifyFastPacketInjection()
in network/trans/WFPSampler/sys/ClassifyFunctions_FastPacketInjectionCallouts.cpp
553 90 6
VOID PerformBasicPacketExaminationAtOther()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketExaminationCallouts.cpp
550 102 1
HRESULT InitializeContent()
in wpd/WpdWudfSampleDriver/FakeDevice.h
538 27 1
NTSTATUS PerformBasicPacketModificationAtInboundNetwork()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketModificationCallouts.cpp
490 74 4
456 101 2
HRESULT InitializeWIAItemProperties()
in wia/wiadriverex/usd/wiahelpers.cpp
441 90 3
NTSTATUS PerformAdvancedPacketInjectionAtInboundTransport()
in network/trans/WFPSampler/sys/ClassifyFunctions_AdvancedPacketInjectionCallouts.cpp
440 83 3
NTSTATUS PerformBasicPacketInjectionAtInboundTransport()
in network/trans/WFPSampler/sys/ClassifyFunctions_BasicPacketInjectionCallouts.cpp
438 84 3
_Out_ _Deref_out_range_()
in storage/class/cdrom/src/sense.c
418 45 2
HRESULT WpdObjectProperties::GetPropertyValuesForObject()
in wpd/WpdHelloWorldDriver/WpdObjectProperties.cpp
407 74 3
HRESULT WpdObjectProperties::GetPropertyValuesForObject()
in wpd/WpdMultiTransportDriver/WpdObjectProperties.cpp
407 74 3
NTSTATUS KrnlHlprIPHeaderGet()
in network/trans/WFPSampler/syslib/HelperFunctions_Headers.cpp
397 123 4
397 138 3