microsoft / clrmd
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 1,034 units with 13,227 lines of code in units (28.9% of code).
    • 3 very long units (414 lines of code)
    • 26 long units (1,773 lines of code)
    • 134 medium size units (4,029 lines of code)
    • 214 small units (3,106 lines of code)
    • 657 very small units (3,905 lines of code)
3% | 13% | 30% | 23% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs3% | 13% | 30% | 23% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/Microsoft.Diagnostics.Runtime/src2% | 14% | 31% | 22% | 28%
src/Microsoft.Diagnostics.Runtime.Utilities/Debugger86% | 0% | 0% | 10% | 2%
src/TestTasks/src0% | 0% | 23% | 28% | 48%
src/LongRunningTests/ParallelStressTest0% | 0% | 65% | 11% | 22%
src/Benchmarks0% | 0% | 17% | 48% | 33%
src/Microsoft.Diagnostics.Runtime.Utilities0% | 0% | 63% | 36% | 0%
src/TestTargets/GCRoot0% | 0% | 0% | 100% | 0%
src/TestTargets/GCHandles0% | 0% | 0% | 85% | 14%
src/TestTargets/FinalizationQueue0% | 0% | 0% | 42% | 57%
src/TestTargets/NestedException0% | 0% | 0% | 42% | 57%
src/TestTargets/NestedTypes0% | 0% | 0% | 64% | 35%
src/TestTargets/AppDomains0% | 0% | 0% | 100% | 0%
src/TestTargets/ByReference0% | 0% | 0% | 0% | 100%
src/TestTargets/Types0% | 0% | 0% | 0% | 100%
src/TestTargets/GCRoot20% | 0% | 0% | 0% | 100%
src/TestTargets/Arrays0% | 0% | 0% | 0% | 100%
src/TestTargets/ClrObjects0% | 0% | 0% | 0% | 100%
src/TestTargets/Shared0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public static string? Parse()
in src/Microsoft.Diagnostics.Runtime/src/Common/DACNameParser.cs
162 39 1
int ReadVirtual()
in src/Microsoft.Diagnostics.Runtime.Utilities/Debugger/IDebugDataSpaces.cs
148 1 4
public MachOCoreDump()
in src/Microsoft.Diagnostics.Runtime/src/MacOS/MachOCoreDump.cs
104 20 3
internal override unsafe bool GetFileVersion()
in src/Microsoft.Diagnostics.Runtime/src/Utilities/Platform/MacOSFunctions.cs
99 15 5
internal override unsafe bool GetFileVersion()
in src/Microsoft.Diagnostics.Runtime/src/Utilities/Platform/LinuxFunctions.cs
90 13 5
public ClrType? GetOrCreateTypeFromSignature()
in src/Microsoft.Diagnostics.Runtime/src/Builders/RuntimeBuilder.cs
86 37 4
private static()
in src/Microsoft.Diagnostics.Runtime/src/Common/DACNameParser.cs
86 20 2
private async Task ReadThreadData()
in src/Microsoft.Diagnostics.Runtime/src/Windows/Minidump.cs
86 19 1
private ImmutableArray GetOrCreateClrVersions()
in src/Microsoft.Diagnostics.Runtime/src/DataTargets/DataTarget.cs
84 18 0
private uint ReadPageDataFromOffset()
in src/Microsoft.Diagnostics.Runtime/src/Windows/CacheEntryBase.cs
78 8 5
private static unsafe uint ProcessPageForSequenceTerminatingRead()
in src/Microsoft.Diagnostics.Runtime/src/Windows/CacheEntryBase.cs
76 15 7
public bool SkipExactlyOne()
in src/Microsoft.Diagnostics.Runtime/src/Utilities/SigParser/SigParser.cs
74 36 0
public Command()
in src/Microsoft.Diagnostics.Runtime/src/Utilities/Command/Command.cs
73 12 2
internal int TryReadMemory()
in src/Microsoft.Diagnostics.Runtime/src/Windows/CachedMemoryReader.cs
73 18 3
public IEnumerable EnumerateGCRoots()
in src/Microsoft.Diagnostics.Runtime/src/Common/GCRoot.cs
68 17 5
public override IEnumerable EnumerateObjectReferences()
in src/Microsoft.Diagnostics.Runtime/src/Implementation/ClrmdHeap.cs
61 21 4
private static async Task FindBinaryFromServerAsync()
in src/Microsoft.Diagnostics.Runtime/src/Implementation/SymbolServerLocator.cs
61 10 3
private ImmutableDictionary LoadFileTable()
in src/Microsoft.Diagnostics.Runtime/src/Linux/ElfCoreFile.cs
61 8 0
public override long PageOutData()
in src/Microsoft.Diagnostics.Runtime/src/Windows/AWEBasedCacheEntry.cs
61 12 0
public override IEnumerable EnumerateReferencesWithFields()
in src/Microsoft.Diagnostics.Runtime/src/Implementation/ClrmdHeap.cs
60 19 4