awslabs / swage
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 298 units with 1,840 lines of code in units (64.0% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 13 medium size units (333 lines of code)
    • 32 small units (447 lines of code)
    • 253 very small units (1,060 lines of code)
0% | 0% | 18% | 24% | 57%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java0% | 0% | 18% | 24% | 57%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
metrics-core/src/main/java/software/amazon/swage/metrics/record0% | 0% | 30% | 32% | 37%
metrics-core/src/benchmarks/java/com/amazon/metrics0% | 0% | 31% | 32% | 36%
metrics-core/src/main/java/software/amazon/swage/metrics/jmx0% | 0% | 18% | 56% | 24%
type-safe/src/benchmarks/java/software/amazon/swage/collection0% | 0% | 19% | 16% | 63%
disseminating-executors/src/main/java/software/amazon/swage/concurrent0% | 0% | 12% | 14% | 73%
thread-context/src/main/java/software/amazon/swage/threadcontext0% | 0% | 0% | 0% | 100%
type-safe/src/main/java/software/amazon/swage/collection0% | 0% | 0% | 0% | 100%
metrics-api/src/main/java/software/amazon/swage/metrics/record0% | 0% | 0% | 0% | 100%
metrics-api/src/main/java/software/amazon/swage/metrics0% | 0% | 0% | 0% | 100%
metrics-core/src/main/java/software/amazon/swage/metrics0% | 0% | 0% | 0% | 100%
metrics-core/src/main/java/software/amazon/swage/metrics/measures0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private static void format_exception()
in metrics-core/src/benchmarks/java/com/amazon/metrics/DoubleFormat.java
35 10 2
public void leadingZerosIntegerOverflow()
in metrics-core/src/benchmarks/java/com/amazon/metrics/DoubleFormatTest.java
31 1 0
public void sense()
in metrics-core/src/main/java/software/amazon/swage/metrics/jmx/sensor/OperatingSystemSensor.java
30 5 1
public FileRecorder()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/file/FileRecorder.java
30 6 1
static
in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/CloudWatchRecorder.java
28 1 0
protected void record()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/file/FileRecorder.java
26 3 5
public MXBeanPoller()
in metrics-core/src/main/java/software/amazon/swage/metrics/jmx/MXBeanPoller.java
23 2 4
public CloudWatchRecorder()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/CloudWatchRecorder.java
23 5 6
public CloudWatchRecorder build()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/CloudWatchRecorder.java
22 4 0
private void rollIfNeeded()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/file/RollingFileWriter.java
22 4 0
static
in disseminating-executors/src/main/java/software/amazon/swage/concurrent/StateCapture.java
21 4 0
public void benchmarkImmutableTypedMap()
in type-safe/src/benchmarks/java/software/amazon/swage/collection/TypedMapBenchmarks.java
21 2 2
public void benchmarkListTypedMap()
in type-safe/src/benchmarks/java/software/amazon/swage/collection/TypedMapBenchmarks.java
21 2 2
protected void record()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/CloudWatchRecorder.java
20 3 5
public void benchmarkGuava()
in type-safe/src/benchmarks/java/software/amazon/swage/collection/TypedMapBenchmarks.java
20 2 2
public void sense()
in metrics-core/src/main/java/software/amazon/swage/metrics/jmx/sensor/HeapMemoryAfterGCSensor.java
19 6 1
public void benchmark()
in metrics-core/src/benchmarks/java/com/amazon/metrics/DoubleFormatTest.java
19 1 0
protected void count()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/file/FileRecorder.java
18 2 3
public void add()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/MetricDataAggregator.java
17 1 4
private TypedMap flattenContextHierarchy()
in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/DimensionMapper.java
17 4 1