microsoft / hcsshim
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 3,903 units with 63,057 lines of code in units (79.7% of code).
    • 90 very long units (13,667 lines of code)
    • 136 long units (9,408 lines of code)
    • 487 medium size units (14,637 lines of code)
    • 1,075 small units (15,222 lines of code)
    • 2,115 very small units (10,123 lines of code)
21% | 14% | 23% | 24% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go21% | 14% | 23% | 24% | 16%
c0% | 17% | 59% | 14% | 8%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal19% | 14% | 25% | 23% | 16%
pkg29% | 18% | 11% | 23% | 17%
cmd31% | 15% | 25% | 19% | 9%
ext417% | 22% | 27% | 21% | 10%
ROOT0% | 12% | 16% | 25% | 46%
computestorage0% | 20% | 20% | 54% | 4%
vsockexec0% | 66% | 0% | 33% | 0%
hcn0% | 0% | 30% | 46% | 23%
init0% | 0% | 80% | 7% | 11%
osversion0% | 0% | 0% | 70% | 30%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go
617 176 1
func()
in internal/vmservice/vmservice.pb.go
430 122 1
func()
in internal/vmservice/vmservice.pb.go
317 89 1
func()
in pkg/ncproxy/ncproxygrpc/v1/networkconfigproxy.pb.go
272 77 1
func()
in pkg/ncproxy/ncproxygrpc/v1/networkconfigproxy.pb.go
267 74 1
func()
in cmd/containerd-shim-runhcs-v1/options/runhcs.pb.go
264 77 1
func()
in cmd/containerd-shim-runhcs-v1/stats/stats.pb.go
246 72 1
func()
in internal/shimdiag/shimdiag.pb.go
233 64 1
func()
in internal/vmservice/vmservice.pb.go
229 67 1
func()
in pkg/ncproxy/ncproxygrpc/v1/networkconfigproxy.pb.go
219 61 1
func()
in internal/vmservice/vmservice.pb.go
213 58 1
func()
in cmd/containerd-shim-runhcs-v1/stats/stats.pb.go
189 55 1
func()
in internal/vmservice/vmservice.pb.go
189 53 1
func()
in pkg/ncproxy/ncproxygrpc/v1/networkconfigproxy.pb.go
185 51 1
func()
in pkg/ncproxy/ncproxygrpc/v1/networkconfigproxy.pb.go
185 51 1
func()
in pkg/ncproxy/nodenetsvc/v1/nodenetsvc.pb.go
183 50 1
func()
in pkg/ncproxy/nodenetsvc/v1/nodenetsvc.pb.go
181 49 1
func createContainer()
in cmd/runhcs/container.go
168 53 1
func()
in internal/computeagent/computeagent.pb.go
168 46 1
func()
in internal/vmservice/vmservice.pb.go
162 46 1