microsoft / service-fabric
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 73,883 units with 1,125,068 lines of code in units (53.7% of code).
    • 872 very long units (134,365 lines of code)
    • 2,724 long units (185,783 lines of code)
    • 11,571 medium size units (353,481 lines of code)
    • 16,098 small units (236,820 lines of code)
    • 42,618 very small units (214,619 lines of code)
11% | 16% | 31% | 21% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp12% | 17% | 34% | 21% | 14%
cs11% | 16% | 29% | 20% | 22%
h8% | 11% | 20% | 20% | 39%
c21% | 34% | 27% | 11% | 5%
inl10% | 2% | 16% | 51% | 18%
pl21% | 27% | 33% | 10% | 6%
js0% | 0% | 54% | 16% | 29%
py0% | 0% | 56% | 30% | 12%
pm0% | 0% | 0% | 84% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/prod/src11% | 16% | 31% | 21% | 19%
src/prod/ktl11% | 14% | 33% | 20% | 20%
src/prod/shared7% | 45% | 28% | 7% | 10%
src/prod/tools16% | 20% | 40% | 16% | 7%
src/prod/linuxsetup0% | 0% | 54% | 16% | 29%
src/prod/Setup0% | 0% | 72% | 14% | 13%
src0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void VariableArgument::WriteTo()
in src/prod/src/Common/VariableArgument.cpp
1364 373 2
vector QuerySpecification::CreateSpecifications()
in src/prod/src/query/QuerySpecification.cpp
882 93 0
HealthReport HealthReport::CreateSystemHealthReport()
in src/prod/src/ServiceModel/HealthReport.cpp
728 116 7
VOID LogTestBase::ReadAheadCacheTest()
in src/prod/src/data/logicallog/LogTestBase.cpp
683 10 1
private void VerifyExpectedClusterSize()
in src/prod/src/managed/Api/src/System/Fabric/Management/fabricvalidator/FabricSettingsValidator.cs
663 137 0
void MakeSeedFiles()
in src/prod/src/ktllogger/sys/tools/filefuzz/makeseed/makeseed.cpp
636 30 0
pair PlacementAndLoadBalancing::InternalUpdateService()
in src/prod/src/Reliability/LoadBalancing/PlacementAndLoadBalancing.cpp
569 129 5
std::wstring ErrorBody::FromErrorMessage()
in src/prod/src/httpgateway/ErrorBody.cpp
545 179 1
Awaitable TruncateTailManager::TruncateTailAsync()
in src/prod/src/data/txnreplicator/loggingreplicator/TruncateTailManager.cpp
538 43 1
void RequestManager::OnProcessRequest()
in src/prod/src/Management/FileStoreService/RequestManager.cpp
505 49 2
static WinFabDefaultFilter()
in src/prod/src/managed/DCA/product/system.fabric.dca/WinFabDefaultFilter.cs
437 1 0
Common::ErrorCode PartitionedServiceDescriptor::FromPublicApi()
in src/prod/src/ServiceModel/naming/PartitionedServiceDescriptor.cpp
434 78 1
void WriteToTextWriter()
in src/prod/src/Common/ErrorCodeValue.cpp
413 407 2
VOID LogTestBase::BasicIOTest()
in src/prod/src/data/logicallog/LogTestBase.cpp
399 7 2
public static int Main()
in src/prod/src/managed/ImageBuilderExe/ImageBuilderExe.cs
395 71 1
public async Task TruncateTailAsync()
in src/prod/src/managed/Microsoft.ServiceFabric.Data.Impl/Replicator/TruncateTailManager.cs
382 45 0
void PlacementCreator::CreatePartitionEntries()
in src/prod/src/Reliability/LoadBalancing/PlacementCreator.cpp
359 99 0
void KtlLoggerNode::OpenAsyncOperation::OnStart()
in src/prod/src/ktllogger/KtlLoggerNode.cpp
351 46 1
VOID LogTestBase::OpenManyStreamsTest()
in src/prod/src/data/logicallog/LogTestBase.cpp
346 49 1
Common::ErrorCode PlacementAndLoadBalancing::UpdateApplication()
in src/prod/src/Reliability/LoadBalancing/PlacementAndLoadBalancing.cpp
343 81 2