microsoft / BPerf
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 4,236 units with 59,187 lines of code in units (24.2% of code).
    • 62 very long units (11,976 lines of code)
    • 138 long units (9,469 lines of code)
    • 407 medium size units (12,465 lines of code)
    • 778 small units (11,207 lines of code)
    • 2,851 very small units (14,070 lines of code)
20% | 15% | 21% | 18% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp33% | 23% | 24% | 10% | 8%
h10% | 9% | 14% | 18% | 47%
inl21% | 3% | 13% | 45% | 16%
cs1% | 21% | 29% | 20% | 26%
c0% | 22% | 40% | 17% | 19%
hpp0% | 8% | 27% | 10% | 53%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
CoreCLRProfiler/native22% | 15% | 19% | 18% | 23%
CPUSamplesCollector/Windows35% | 12% | 25% | 10% | 16%
WebViewer/Microsoft.BPerf.StackInformation.Etw15% | 20% | 20% | 15% | 28%
WebViewer/Microsoft.Diagnostics.Tracing.Stacks0% | 20% | 30% | 22% | 26%
CPUSamplesCollector/Linux0% | 31% | 15% | 28% | 24%
WebViewer/Microsoft.BPerf.SymbolicInformation.ProgramDatabase0% | 17% | 51% | 13% | 18%
WebViewer/Microsoft.BPerf.StackViewer0% | 9% | 31% | 18% | 40%
WebViewer/Microsoft.BPerf.Internal.CabExtraction0% | 12% | 36% | 31% | 18%
CoreCLRProfiler/managed0% | 23% | 43% | 25% | 7%
WebViewer/Microsoft.BPerf.StackAggregation0% | 0% | 0% | 22% | 77%
WebViewer/Microsoft.BPerf.ModuleInformation.Abstractions0% | 0% | 0% | 8% | 91%
WebViewer/Microsoft.BPerf.SymbolicInformation.Interfaces0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
inl
int __cdecl __tinput_s()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/safecrt/input.inl
770 188 3
inl
_CRTIMP int __cdecl _vtcprintf_l()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/safecrt/output.inl
558 134 6
_CRTIMP int __cdecl _vtcprintf_l()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/safecrt/safecrt_output_l.cpp
524 127 6
int CoreVfwprintf()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/printfcpp.cpp
362 55 4
int GetChars()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/locale/utf8.cpp
337 59 4
DWORD CorUnix::InternalWaitForMultipleObjectsEx()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/synchmgr/wait.cpp
317 60 7
BOOL Internal_ExtractFormatW()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/printfcpp.cpp
285 79 8
int CoreVfprintf()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/printfcpp.cpp
280 44 4
BOOL Internal_ExtractFormatA()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/printfcpp.cpp
264 73 8
int GetBytes()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/locale/utf8.cpp
262 50 4
PCCOR_SIGNATURE PrettyPrintType()
in CoreCLRProfiler/native/coreclr_headers/src/inc/formattype.cpp
254 61 3
static BOOL Internal_ScanfExtractFormatA()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/printf.cpp
252 57 7
int GetCharCount()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/locale/utf8.cpp
234 47 2
BOOL Silent_ExtractFormatA()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/silent_printf.cpp
232 70 7
PCCOR_SIGNATURE PrettyPrintSignature()
in CoreCLRProfiler/native/coreclr_headers/src/inc/formattype.cpp
223 35 7
static BOOL Internal_ScanfExtractFormatW()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/cruntime/printf.cpp
223 57 7
int GetByteCount()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/locale/utf8.cpp
220 56 2
static PCCOR_SIGNATURE PrettyPrintType()
in CoreCLRProfiler/native/PrettyPrintSig.cpp
211 49 4
DWORD PALAPI CPalSynchronizationManager::WorkerThread()
in CoreCLRProfiler/native/coreclr_headers/src/pal/src/synchmgr/synchmanager.cpp
203 17 1
HRESULT ReadAndSetupConfiguration()
in CPUSamplesCollector/Windows/lib/Program.cpp
202 47 2