aws-samples / aws-cloudhsm-pkcs11-examples
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 118 units with 3,932 lines of code in units (57.5% of code).
    • 5 very long units (593 lines of code)
    • 17 long units (1,114 lines of code)
    • 57 medium size units (1,701 lines of code)
    • 29 small units (473 lines of code)
    • 10 very small units (51 lines of code)
15% | 28% | 43% | 12% | 1%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c15% | 28% | 43% | 12% | 1%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/encrypt31% | 45% | 14% | 7% | <1%
src/tools46% | 18% | 16% | 12% | 6%
src/common38% | 0% | 31% | 25% | 5%
src/derivation36% | 23% | 40% | 0% | 0%
src/wrapping0% | 49% | 36% | 14% | 0%
src/attributes0% | 51% | 37% | 8% | 2%
src/sign0% | 0% | 89% | 10% | 0%
src/find_objects0% | 0% | 91% | 8% | 0%
src/digest0% | 0% | 100% | 0% | 0%
src/generate0% | 0% | 76% | 23% | 0%
src/mechanism_info0% | 0% | 100% | 0% | 0%
src/generate_random0% | 0% | 60% | 39% | 0%
src/destroy0% | 0% | 55% | 34% | 10%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int main()
in src/tools/wrap_with_imported_rsa_key.c
140 27 2
int gopt()
in src/common/gopt.c
129 27 2
CK_RV aes_gcm_sample()
in src/encrypt/aes_gcm.c
112 14 1
CK_RV aes_gcm_sample()
in src/derivation/ecdh.c
106 13 2
CK_RV aes_cbc_multipart_sample()
in src/encrypt/aes_cbc.c
106 16 1
CK_RV attributes_output_all()
in src/attributes/attributes.c
88 16 3
CK_RV aes_ctr_sample()
in src/encrypt/aes_ctr.c
87 14 1
CK_RV aes_cbc_sample()
in src/encrypt/aes_cbc.c
75 12 1
CK_RV des_ecb_sample()
in src/encrypt/des_ecb.c
73 12 1
CK_RV aes_ecb_sample()
in src/encrypt/aes_ecb.c
73 12 1
CK_RV aes_gcm_wrapping()
in src/wrapping/aes_gcm_wrapping.c
72 13 1
CK_RV hmac_kdf_sample()
in src/derivation/hmac_kdf.c
68 3 1
CK_RV rsa_oaep_wrap()
in src/wrapping/rsa_wrapping.c
62 12 1
CK_RV rsa_aes_wrap()
in src/wrapping/rsa_wrapping.c
62 12 1
CK_RV aes_wrap_unwrap_with_trusted()
in src/wrapping/unwrap_with_template.c
60 11 2
CK_RV aes_pkcs5_padding_wrapping()
in src/wrapping/aes_wrapping.c
59 11 1
CK_RV aes_zero_padding_wrapping()
in src/wrapping/aes_zero_padding_wrapping.c
59 11 1
CK_RV aes_no_padding_wrapping()
in src/wrapping/aes_no_padding_wrapping.c
58 11 1
CK_RV rsa_aes_unwrap_key()
in src/wrapping/rsa_wrapping.c
56 5 6
int main()
in src/tools/import_pub_key.c
56 8 2