aws / aws-nitro-enclaves-cli
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 234 units with 5,228 lines of code in units (31.6% of code).
    • 6 very long units (940 lines of code)
    • 16 long units (1,165 lines of code)
    • 58 medium size units (1,649 lines of code)
    • 62 small units (959 lines of code)
    • 92 very small units (515 lines of code)
17% | 22% | 31% | 18% | 9%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs14% | 24% | 32% | 18% | 10%
c30% | 16% | 28% | 17% | 7%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src13% | 21% | 34% | 20% | 9%
drivers30% | 16% | 28% | 17% | 7%
enclave_build35% | 53% | 8% | 0% | 2%
vsock_proxy0% | 79% | 0% | 13% | 7%
eif_defs0% | 0% | 56% | 18% | 25%
ROOT0% | 0% | 100% | 0% | 0%
eif_utils0% | 0% | 0% | 58% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
fn main()
in src/main.rs
255 5 0
fn handle_command()
in src/enclave_proc/mod.rs
169 4 8
static long ne_enclave_ioctl()
in drivers/virt/nitro_enclaves/ne_misc_dev.c
156 33 3
fn main()
in enclave_build/src/main.rs
129 3 0
static int ne_setup_cpu_pool()
in drivers/virt/nitro_enclaves/ne_misc_dev.c
126 18 1
static int ne_set_user_memory_region_ioctl()
in drivers/virt/nitro_enclaves/ne_misc_dev.c
105 16 2
fn process_event_loop()
in src/enclave_proc/mod.rs
98 4 2
fn main()
in vsock_proxy/src/main.rs
97 2 0
fn test_connection_listener_run_describe()
in src/enclave_proc/connection_listener.rs
96 7 0
static int ne_create_vm_ioctl()
in drivers/virt/nitro_enclaves/ne_misc_dev.c
96 14 2
fn test_connection_listener_run_connection_stop()
in src/enclave_proc/connection_listener.rs
84 6 0
fn inspect_image()
in enclave_build/src/docker.rs
73 4 1
fn allocate()
in src/enclave_proc/resource_manager.rs
71 11 1
fn new()
in src/enclave_proc/resource_manager.rs
69 4 5
fn do_ioctl()
in src/enclave_proc/resource_manager.rs
69 2 3
fn test_ramfs()
in enclave_build/src/yaml_generator.rs
66 1 0
static int ne_pci_probe()
in drivers/virt/nitro_enclaves/ne_pci_dev.c
65 8 2
fn create_enclave()
in src/enclave_proc/resource_manager.rs
64 2 3
fn write_eif_to_regions()
in src/enclave_proc/resource_manager.rs
57 6 3
fn parse_enclave_cid()
in src/common/commands_parser.rs
54 8 1