microsoft / ctsTraffic
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 873 units with 16,470 lines of code in units (43.6% of code).
    • 26 very long units (3,979 lines of code)
    • 48 long units (3,271 lines of code)
    • 125 medium size units (3,875 lines of code)
    • 171 small units (2,596 lines of code)
    • 503 very small units (2,749 lines of code)
24% | 19% | 23% | 15% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp33% | 25% | 20% | 11% | 8%
hpp6% | 7% | 32% | 22% | 31%
h10% | 16% | 12% | 25% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ctsTraffic29% | 25% | 26% | 11% | 6%
ctsPerf35% | 29% | 7% | 14% | 13%
SdkChanges49% | 0% | 11% | 27% | 11%
ctl3% | 2% | 30% | 23% | 39%
MSTest/ctsSocketBrokerUnitTest0% | 0% | 34% | 27% | 37%
MSTest/ctsIOPatternProtocolPolicyUnitTest0% | 0% | 13% | 55% | 31%
MSTest/ctsSocketStateUnitTest0% | 0% | 20% | 28% | 51%
MSTest/ctsSocketUnitTest0% | 0% | 31% | 0% | 68%
MSTest/ctsIOPatternUnitTest_Server0% | 0% | 18% | 28% | 53%
MSTest/ctsIOPatternUnitTest_Client0% | 0% | 18% | 17% | 63%
MSTest/ctsMediaStreamServerConnectedSocketUnitTest0% | 0% | 0% | 49% | 50%
MSTest/ctsIOPatternStateUnitTest0% | 0% | 0% | 32% | 67%
MSTest/ctsMediaStreamSendBuffer0% | 0% | 0% | 48% | 51%
MSTest/ctsIOPatternRateLimitPolicyUnitTest0% | 0% | 0% | 0% | 100%
MSTest/ctsStatisticsUnitTest0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void PrintUsage()
in ctsTraffic/ctsConfig.cpp
387 6 1
void PrintSettings()
in ctsTraffic/ctsConfig.cpp
323 52 0
bool Startup()
in ctsTraffic/ctsConfig.cpp
211 51 2
int __cdecl wmain()
in ctsPerf/ctsPerf.cpp
199 34 2
int SetPreBindOptions()
in ctsTraffic/ctsConfig.cpp
199 28 2
static void ParseForIoPattern()
in ctsTraffic/ctsConfig.cpp
196 36 1
170 27 2
static void ParseForAddress()
in ctsTraffic/ctsConfig.cpp
167 32 1
static void ParseForLogging()
in ctsTraffic/ctsConfig.cpp
146 26 1
int __cdecl wmain()
in ctsTraffic/ctsTraffic.cpp
146 19 2
ctsTask ctsIoPattern::CreateNewTask()
in ctsTraffic/ctsIOPattern.cpp
133 16 2
typedef DECLSPEC_UUID()
in SdkChanges/WbemDisp.h
132 1 1
void PrintConnectionResults()
in ctsTraffic/ctsConfig.cpp
125 27 4
void PrintConnectionResults()
in ctsTraffic/ctsConfig.cpp
125 22 4
ctsIoStatus ctsIoPattern::CompleteIo()
in ctsTraffic/ctsIOPattern.cpp
120 32 3
117 1 0
void ctsReadWriteIocp()
in ctsTraffic/ctsReadWriteIocp.cpp
117 22 1
void ctsWSASocket()
in ctsTraffic/ctsWSASocket.cpp
115 19 1
114 16 3
void ProcessPerProcessCounters()
in ctsPerf/ctsPerf.cpp
111 8 3