firecracker-microvm / firecracker
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,683 units with 29,992 lines of code in units (55.4% of code).
    • 25 very long units (4,139 lines of code)
    • 80 long units (5,207 lines of code)
    • 315 medium size units (10,061 lines of code)
    • 415 small units (6,127 lines of code)
    • 848 very small units (4,458 lines of code)
13% | 17% | 33% | 20% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs13% | 17% | 33% | 20% | 14%
py0% | 0% | 19% | 22% | 58%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/dumbo49% | 6% | 20% | 8% | 14%
src/vmm14% | 14% | 34% | 22% | 14%
src/jailer38% | 7% | 22% | 22% | 8%
src/devices4% | 17% | 36% | 24% | 16%
src/mmds21% | 18% | 30% | 17% | 11%
src/firecracker54% | 0% | 28% | 9% | 7%
src/utils26% | 6% | 35% | 14% | 16%
src/arch_gen34% | 55% | 6% | 0% | 3%
src/virtio_gen41% | 32% | 25% | 0% | 0%
src/cpuid9% | 15% | 37% | 15% | 21%
src/seccompiler6% | 29% | 42% | 15% | 6%
src/io_uring27% | 0% | 39% | 20% | 12%
src/api_server0% | 26% | 35% | 28% | 8%
src/arch0% | 13% | 28% | 31% | 26%
src/net_gen0% | 27% | 62% | 0% | 10%
src/snapshot0% | 43% | 15% | 17% | 23%
src/logger0% | 13% | 22% | 15% | 47%
src/rate_limiter0% | 16% | 24% | 40% | 18%
src/vm-memory0% | 23% | 58% | 14% | 4%
tools/parse_baselines0% | 0% | 19% | 22% | 58%
ROOT0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
fn test_connection()
in src/dumbo/src/tcp/connection.rs
343 4 0
fn test_error_display()
in src/jailer/src/main.rs
282 1 0
fn test_from_json()
in src/vmm/src/resources.rs
269 2 0
fn main_exitable()
in src/firecracker/src/main.rs
264 12 0
fn test_parse()
in src/utils/src/arg_parser.rs
241 2 0
fn test_read_write()
in src/devices/src/virtio/block/device.rs
211 1 0
fn test_handler()
in src/dumbo/src/tcp/handler.rs
184 4 0
170 8 0
fn fmt()
in src/jailer/src/main.rs
159 1 2
fn test_attach_block_devices()
in src/vmm/src/builder.rs
157 1 0
fn test_constructors()
in src/dumbo/src/pdu/tcp.rs
143 1 0
fn test_get_value()
in src/mmds/src/data_store.rs
136 1 0
fn bindgen_test_layout_virtio_blk_config()
in src/virtio_gen/src/virtio_blk.rs
136 1 0
fn make_test_seccomp_bpf_filter()
in src/vmm/src/signal_handler.rs
131 1 0
fn test_endpoint()
in src/dumbo/src/tcp/endpoint.rs
131 4 0
fn test_simple_write_bits()
in src/cpuid/src/bit_helper.rs
130 1 0
fn restore()
in src/vmm/src/device_manager/persist.rs
130 8 2
fn test_get_argument_values()
in src/seccompiler/src/seccompiler_bin.rs
129 1 0
fn test_eth_ipv4_arp_frame()
in src/dumbo/src/pdu/arp.rs
123 1 0
fn bindgen_test_layout_mpc_table()
in src/arch_gen/src/x86/mpspec.rs
122 1 0