microsoft / TSS.MSR
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 10,814 units with 60,872 lines of code in units (35.1% of code).
    • 30 very long units (4,736 lines of code)
    • 71 long units (4,918 lines of code)
    • 229 medium size units (7,172 lines of code)
    • 479 small units (6,801 lines of code)
    • 10,005 very small units (37,245 lines of code)
7% | 8% | 11% | 11% | 61%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs13% | 16% | 23% | 16% | 30%
h21% | 0% | 0% | 3% | 74%
cpp4% | 4% | 8% | 14% | 68%
java2% | <1% | 1% | 4% | 91%
ts3% | 0% | 4% | 7% | 83%
py0% | 2% | <1% | 1% | 94%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Tpm2Tester/TestSubstrate25% | 21% | 19% | 18% | 15%
TSS.NET/TSS.Net8% | 9% | 17% | 17% | 46%
TssCodeGen/src14% | 26% | 30% | 11% | 16%
TSS.CPP/CryptoEngine82% | 0% | 0% | 0% | 17%
TSS.Java/src2% | <1% | 1% | 4% | 91%
PCPTool.v11/exe90% | 0% | 0% | 9% | 0%
TSS.JS/src3% | 0% | 4% | 7% | 83%
PCPTool.v11/dll84% | 0% | 0% | 15% | 0%
TSS.CPP/Src1% | 4% | 8% | 14% | 70%
Tpm2Tester/TestSuite14% | 11% | 45% | 23% | 4%
TSS.NET/TSS.Net.UWP0% | 16% | 37% | 23% | 22%
TSS.Py/src0% | 2% | <1% | 1% | 94%
Tpm2Tester/TpmProxy0% | 45% | 33% | 3% | 16%
TSS.CPP/include0% | 0% | 0% | 4% | 95%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private void InitTpmParams()
in Tpm2Tester/TestSubstrate/TestFramework.cs
325 55 1
internal bool DispatchMethod()
in TSS.NET/TSS.Net/Tpm2.cs
267 62 5
static ASN1_ITEM_start()
in TSS.CPP/CryptoEngine/openssl/VC-WIN32/openssl/asn1t.h
253 1 1
static ASN1_ITEM_start()
in TSS.CPP/CryptoEngine/openssl/VC-WIN64A/openssl/asn1t.h
253 1 1
void GenStructure()
in TssCodeGen/src/CGenDotNet.cs
211 43 1
private void UpdateHandleData()
in TSS.NET/TSS.Net/Tpm2.cs
201 33 4
int __cdecl wmain()
in PCPTool.v11/exe/PCPTool.cpp
200 51 2
void DoFuzzDecomposedStruct()
in Tpm2Tester/TestSubstrate/TestFuzzer.cs
178 35 2
void GenStruct()
in TssCodeGen/src/CGenJava.cs
169 32 1
Type UnionElementFromSelector()
in TSS.NET/TSS.Net/X_TpmDefs.cs
162 95 2
internal bool RunTestSession()
in Tpm2Tester/TestSubstrate/TestFramework.cs
155 35 0
protected void DispatchCommand()
in TSS.Java/src/tss/TpmBase.java
151 35 3
private void PrepareRequestSessions()
in TSS.NET/TSS.Net/Tpm2.cs
150 41 2
void GenStructDecl()
in TssCodeGen/src/CGenCpp.cs
139 30 1
public static create()
in TSS.JS/src/TpmTypes.ts
138 95 2
U create()
in TSS.Java/src/tss/tpm/UnionFactory.java
136 95 2
internal void DispatchCommand()
in TSS.NET/TSS.Net/SlotManager.cs
134 28 4
DllExport TpmAttWrapPlatformKey()
in PCPTool.v11/dll/AttestationApi.cpp
130 25 5
static void Create()
in TSS.CPP/Src/TpmTypes.cpp
125 95 2
internal bool TransformerCallback()
in Tpm2Tester/TestSubstrate/TestFuzzer.cs
121 24 3