bottlerocket-os / bottlerocket
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 1,161 units with 15,318 lines of code in units (30.8% of code).
    • 4 very long units (529 lines of code)
    • 29 long units (1,936 lines of code)
    • 166 medium size units (4,987 lines of code)
    • 245 small units (3,743 lines of code)
    • 717 very small units (4,123 lines of code)
3% | 12% | 32% | 24% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go37% | 14% | 29% | 6% | 12%
rs1% | 12% | 32% | 25% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sources/host-ctr37% | 14% | 29% | 6% | 12%
sources/api2% | 11% | 35% | 23% | 26%
tools/pubsys0% | 31% | 48% | 7% | 13%
sources/updater0% | 19% | 39% | 27% | 14%
tools/infrasys0% | 75% | 0% | 21% | 3%
tools/pubsys-setup0% | 96% | 0% | 0% | 3%
tools/buildsys0% | 14% | 41% | 17% | 26%
sources/models0% | 0% | 25% | 41% | 33%
sources/logdog0% | 0% | 59% | 28% | 11%
sources/driverdog0% | 0% | 59% | 34% | 5%
sources/prairiedog0% | 0% | 64% | 27% | 8%
sources/shimpei0% | 0% | 55% | 30% | 14%
sources/growpart0% | 0% | 22% | 44% | 33%
tools/pubsys-config0% | 0% | 57% | 0% | 42%
sources/metricdog0% | 0% | 0% | 65% | 34%
sources/imdsclient0% | 0% | 0% | 62% | 37%
sources/ghostdog0% | 0% | 0% | 63% | 37%
sources/retry-read0% | 0% | 0% | 60% | 40%
sources/parse-datetime0% | 0% | 0% | 86% | 13%
sources/webpki-roots-shim0% | 0% | 0% | 84% | 15%
sources/bottlerocket-release0% | 0% | 0% | 63% | 36%
sources/constants0% | 0% | 0% | 100% | 0%
packages/os0% | 0% | 0% | 0% | 100%
variants/aws-k8s-1.210% | 0% | 0% | 0% | 100%
variants/aws-k8s-1.180% | 0% | 0% | 0% | 100%
variants/aws-ecs-10% | 0% | 0% | 0% | 100%
variants/metal-dev0% | 0% | 0% | 0% | 100%
variants/metal-k8s-1.210% | 0% | 0% | 0% | 100%
variants/vmware-k8s-1.200% | 0% | 0% | 0% | 100%
variants/vmware-dev0% | 0% | 0% | 0% | 100%
variants/aws-k8s-1.190% | 0% | 0% | 0% | 100%
variants/aws-k8s-1.200% | 0% | 0% | 0% | 100%
variants/vmware-k8s-1.210% | 0% | 0% | 0% | 100%
variants/aws-k8s-1.21-nvidia0% | 0% | 0% | 0% | 100%
variants/aws-dev0% | 0% | 0% | 0% | 100%
packages/nvidia-k8s-device-plugin0% | 0% | 0% | 0% | 100%
packages/open-vm-tools0% | 0% | 0% | 0% | 100%
packages/libnetfilter_conntrack0% | 0% | 0% | 0% | 100%
packages/ecs-agent0% | 0% | 0% | 0% | 100%
packages/ncurses0% | 0% | 0% | 0% | 100%
packages/wicked0% | 0% | 0% | 0% | 100%
packages/libpcre0% | 0% | 0% | 0% | 100%
packages/dbus-broker0% | 0% | 0% | 0% | 100%
packages/libmnl0% | 0% | 0% | 0% | 100%
packages/makedumpfile0% | 0% | 0% | 0% | 100%
packages/filesystem0% | 0% | 0% | 0% | 100%
packages/util-linux0% | 0% | 0% | 0% | 100%
packages/libelf0% | 0% | 0% | 0% | 100%
packages/log4j2-hotpatch0% | 0% | 0% | 0% | 100%
packages/coreutils0% | 0% | 0% | 0% | 100%
packages/libselinux0% | 0% | 0% | 0% | 100%
packages/libz0% | 0% | 0% | 0% | 100%
packages/grub0% | 0% | 0% | 0% | 100%
packages/libxcrypt0% | 0% | 0% | 0% | 100%
packages/bash0% | 0% | 0% | 0% | 100%
packages/libdbus0% | 0% | 0% | 0% | 100%
packages/strace0% | 0% | 0% | 0% | 100%
packages/findutils0% | 0% | 0% | 0% | 100%
packages/cni-plugins0% | 0% | 0% | 0% | 100%
packages/oci-add-hooks0% | 0% | 0% | 0% | 100%
packages/conntrack-tools0% | 0% | 0% | 0% | 100%
packages/iputils0% | 0% | 0% | 0% | 100%
packages/libnetfilter_queue0% | 0% | 0% | 0% | 100%
packages/login0% | 0% | 0% | 0% | 100%
packages/libnetfilter_cthelper0% | 0% | 0% | 0% | 100%
packages/microcode0% | 0% | 0% | 0% | 100%
packages/libzstd0% | 0% | 0% | 0% | 100%
packages/libbzip20% | 0% | 0% | 0% | 100%
packages/procps0% | 0% | 0% | 0% | 100%
packages/libsemanage0% | 0% | 0% | 0% | 100%
packages/aws-iam-authenticator0% | 0% | 0% | 0% | 100%
packages/libpcap0% | 0% | 0% | 0% | 100%
packages/runc0% | 0% | 0% | 0% | 100%
packages/libattr0% | 0% | 0% | 0% | 100%
packages/e2fsprogs0% | 0% | 0% | 0% | 100%
packages/libnvidia-container0% | 0% | 0% | 0% | 100%
packages/libtirpc0% | 0% | 0% | 0% | 100%
packages/nvidia-container-toolkit0% | 0% | 0% | 0% | 100%
packages/libstd-rust0% | 0% | 0% | 0% | 100%
packages/libglib0% | 0% | 0% | 0% | 100%
packages/docker-proxy0% | 0% | 0% | 0% | 100%
packages/ca-certificates0% | 0% | 0% | 0% | 100%
packages/libnl0% | 0% | 0% | 0% | 100%
packages/kmod0% | 0% | 0% | 0% | 100%
packages/binutils0% | 0% | 0% | 0% | 100%
packages/docker-cli0% | 0% | 0% | 0% | 100%
packages/docker-engine0% | 0% | 0% | 0% | 100%
packages/selinux-policy0% | 0% | 0% | 0% | 100%
packages/libseccomp0% | 0% | 0% | 0% | 100%
packages/libacl0% | 0% | 0% | 0% | 100%
packages/libnftnl0% | 0% | 0% | 0% | 100%
packages/systemd0% | 0% | 0% | 0% | 100%
packages/cni0% | 0% | 0% | 0% | 100%
packages/libaudit0% | 0% | 0% | 0% | 100%
packages/release0% | 0% | 0% | 0% | 100%
packages/kexec-tools0% | 0% | 0% | 0% | 100%
packages/libcap0% | 0% | 0% | 0% | 100%
packages/libnfnetlink0% | 0% | 0% | 0% | 100%
packages/libffi0% | 0% | 0% | 0% | 100%
packages/libsepol0% | 0% | 0% | 0% | 100%
packages/tcpdump0% | 0% | 0% | 0% | 100%
packages/iptables0% | 0% | 0% | 0% | 100%
packages/libgcc0% | 0% | 0% | 0% | 100%
packages/libexpat0% | 0% | 0% | 0% | 100%
packages/glibc0% | 0% | 0% | 0% | 100%
packages/libnetfilter_cttimeout0% | 0% | 0% | 0% | 100%
packages/acpid0% | 0% | 0% | 0% | 100%
packages/host-ctr0% | 0% | 0% | 0% | 100%
packages/hotdog0% | 0% | 0% | 0% | 100%
packages/policycoreutils0% | 0% | 0% | 0% | 100%
packages/kmod-5.10-nvidia0% | 0% | 0% | 0% | 100%
packages/iproute0% | 0% | 0% | 0% | 100%
packages/docker-init0% | 0% | 0% | 0% | 100%
packages/grep0% | 0% | 0% | 0% | 100%
packages/chrony0% | 0% | 0% | 0% | 100%
packages/libiw0% | 0% | 0% | 0% | 100%
packages/containerd0% | 0% | 0% | 0% | 100%
packages/readline0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func runCtr()
in sources/host-ctr/cmd/host-ctr/main.go
192 37 7
fn populate_default_datastore>()
in sources/api/storewolf/src/main.rs
119 13 2
fn deserialize_struct()
in sources/api/datastore/src/deserialization/pairs.rs
111 9 4
func App()
in sources/host-ctr/cmd/host-ctr/main.go
107 1 0
fn find_root_role_and_key()
in tools/pubsys-setup/src/main.rs
99 16 1
fn handle()
in sources/api/apiserver/src/server/exec.rs
92 3 3
fn flip_to_new_version()
in sources/api/migration/migrator/src/main.rs
90 1 2
fn main_inner()
in sources/updater/updog/src/main.rs
87 7 0
fn run_migrations()
in sources/api/migration/migrator/src/main.rs
78 6 5
fn run()
in tools/pubsys-setup/src/main.rs
77 5 0
fn populated_bucket_policy()
in tools/infrasys/src/s3.rs
75 1 0
fn handle_host_container()
in sources/api/host-containers/src/main.rs
74 10 2
fn add_keys_kms()
in tools/infrasys/src/root.rs
72 4 5
fn update_manifest()
in tools/pubsys/src/repo.rs
70 1 2
fn forward()
in sources/api/migration/migrations/v1.5.3/vmware-host-containers/src/main.rs
66 7 2
fn usage()
in sources/api/apiclient/src/main.rs
65 4 0
func withDynamicResolver()
in sources/host-ctr/cmd/host-ctr/main.go
65 11 3
fn parse_args()
in sources/updater/updog/src/main.rs
65 8 1
fn read_from_server()
in sources/api/apiclient/src/exec.rs
64 3 4
fn create_test_repo()
in sources/api/migration/migrator/src/test.rs
63 2 0