microsoft / mu_basecore
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 6,633 units with 116,868 lines of code in units (12.1% of code).
    • 144 very long units (34,677 lines of code)
    • 297 long units (20,498 lines of code)
    • 879 medium size units (28,235 lines of code)
    • 1,041 small units (15,362 lines of code)
    • 4,272 very small units (18,096 lines of code)
29% | 17% | 24% | 13% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py30% | 18% | 24% | 11% | 15%
c25% | 15% | 23% | 21% | 13%
h8% | 4% | 15% | 26% | 45%
pyw0% | 10% | 58% | 15% | 16%
nsh0% | 100% | 0% | 0% | 0%
cpp0% | 0% | 24% | 42% | 32%
pl0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
BaseTools29% | 17% | 24% | 12% | 15%
MdeModulePkg35% | 17% | 24% | 12% | 9%
MdePkg28% | 0% | 3% | 66% | 1%
CryptoPkg30% | 5% | 32% | 12% | 19%
StandaloneMmPkg100% | 0% | 0% | 0% | 0%
ShellPkg0% | 100% | 0% | 0% | 0%
NetworkPkg0% | 0% | 52% | 21% | 25%
UefiCpuPkg0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def macro_statement()
in BaseTools/Source/Python/Ecc/CParser3/CParser.py
2094 1466 1
def macro_statement()
in BaseTools/Source/Python/Eot/CParser3/CParser.py
2094 1466 1
def assignment_expression()
in BaseTools/Source/Python/Ecc/CParser3/CParser.py
1526 802 1
def assignment_expression()
in BaseTools/Source/Python/Eot/CParser3/CParser.py
1526 802 1
def compound_statement()
in BaseTools/Source/Python/Ecc/CParser3/CParser.py
1126 763 1
def compound_statement()
in BaseTools/Source/Python/Eot/CParser3/CParser.py
1126 763 1
def statement_list()
in BaseTools/Source/Python/Ecc/CParser3/CParser.py
993 715 1
def statement_list()
in BaseTools/Source/Python/Eot/CParser3/CParser.py
993 715 1
static unsigned GetOptimum()
in BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
574 110 2
__asm__ __volatile__()
in MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c
523 2 1
def CreatePcdDatabasePhaseSpecificAutoGen()
in BaseTools/Source/Python/AutoGen/GenPcdDb.py
502 52 3
void mk()
in BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk.c
424 101 5
def serializedATN()
in BaseTools/Source/Python/Ecc/CParser4/CLexer.py
396 1 0
def serializedATN()
in BaseTools/Source/Python/Eot/CParser4/CLexer.py
396 1 0
def direct_declarator()
in BaseTools/Source/Python/Ecc/CParser3/CParser.py
346 196 1
def direct_declarator()
in BaseTools/Source/Python/Eot/CParser3/CParser.py
346 196 1
int MY_FAST_CALL LZMA_DECODE_REAL()
in BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
334 32 3
int MY_FAST_CALL LZMA_DECODE_REAL()
in MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c
334 32 3
def PreProcess()
in BaseTools/Source/Python/UPT/Library/UniClassObject.py
319 48 3
void mk()
in BaseTools/Source/C/VfrCompile/Pccts/support/genmk/genmk_old.c
295 70 5