microsoft / pmwcas
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 355 units with 4,199 lines of code in units (63.9% of code).
    • 3 very long units (406 lines of code)
    • 9 long units (585 lines of code)
    • 38 medium size units (1,241 lines of code)
    • 56 small units (796 lines of code)
    • 249 very small units (1,171 lines of code)
9% | 13% | 29% | 18% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc10% | 18% | 36% | 18% | 15%
h8% | 6% | 18% | 19% | 47%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/mwcas26% | 23% | 27% | 10% | 11%
src/benchmarks20% | 23% | 38% | 9% | 8%
src/environment0% | 5% | 24% | 32% | 36%
src/double-linked-list0% | 19% | 70% | 5% | 4%
src/util0% | 15% | 14% | 15% | 54%
src/common0% | 0% | 27% | 35% | 37%
include0% | 0% | 0% | 5% | 94%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void Main()
in src/benchmarks/doubly_linked_list_benchmark.cc
152 33 1
class alignas()
in src/mwcas/mwcas.h
139 5 1
void DescriptorPool::Recovery()
in src/mwcas/mwcas.cc
115 19 1
96 24 1
Status LinuxEnvironment::SetThreadAffinity()
in src/environment/environment_linux.cc
72 32 3
71 18 2
void Setup()
in src/benchmarks/doubly_linked_list_benchmark.cc
68 14 1
Status CASDList::Delete()
in src/double-linked-list/doubly_linked_list.cc
62 9 2
void Run()
in src/benchmarks/benchmark.h
58 11 4
53 15 1
std::string Status::ToString()
in src/util/status.cc
53 14 0
void Run()
in src/benchmarks/benchmark_linux.h
52 11 4
Status WindowsAsyncIOHandler::ScheduleOperation()
in src/environment/environment_windows.cc
49 5 6
uint32_t WindowsEnvironment::GetCoreCount()
in src/environment/environment_windows.cc
48 9 0
Status CASDList::InsertBefore()
in src/double-linked-list/doubly_linked_list.cc
47 5 3
virtual void Dump()
in src/benchmarks/doubly_linked_list_benchmark.cc
45 4 4
void Main()
in src/benchmarks/mwcas_benchmark.cc
45 8 1
44 12 2
Status WindowsEnvironment::SetThreadAffinity()
in src/environment/environment_windows.cc
43 8 3
Status MwCASDList::InsertBefore()
in src/double-linked-list/doubly_linked_list.cc
42 7 3