awslabs / sagemaker-debugger
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 1,172 units with 10,947 lines of code in units (70.7% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (303 lines of code)
    • 52 medium complex units (1,951 lines of code)
    • 119 simple units (2,455 lines of code)
    • 999 very simple units (6,238 lines of code)
0% | 2% | 17% | 22% | 56%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py0% | 2% | 17% | 22% | 56%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
smdebug/profiler0% | 8% | 23% | 16% | 50%
smdebug/core0% | 0% | 10% | 23% | 65%
smdebug/tensorflow0% | 0% | 23% | 23% | 52%
smdebug/pytorch0% | 0% | 28% | 33% | 37%
smdebug/rules0% | 0% | 27% | 23% | 49%
smdebug/xgboost0% | 0% | 13% | 38% | 48%
smdebug/mxnet0% | 0% | 17% | 31% | 50%
smdebug/trials0% | 0% | 6% | 29% | 63%
ROOT0% | 0% | 0% | 0% | 100%
smdebug0% | 0% | 0% | 0% | 100%
smdebug/analysis0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def _read_event()
in smdebug/profiler/trace_event_file_parser.py
115 38 3
def merge_timeline()
in smdebug/profiler/analysis/utils/merge_timelines.py
188 32 5
def forward_pre_hook()
in smdebug/pytorch/hook.py
82 25 3
def preprocess_system_metrics()
in smdebug/profiler/analysis/notebook_utils/heatmap.py
70 24 3
def write_event()
in smdebug/core/tfevent/timeline_file_writer.py
55 22 2
def get_framework_metrics_by_timesteps()
in smdebug/profiler/analysis/utils/profiler_data_to_pandas.py
51 21 3
def _get_nodes_from_symbol()
in smdebug/mxnet/graph.py
47 21 1
def _on_any_batch_begin()
in smdebug/tensorflow/keras.py
31 21 4
def _initialize_writers()
in smdebug/tensorflow/base_hook.py
32 20 2
def is_checkpoint_updated()
in smdebug/core/state_store.py
64 19 1
def _wrap_tape_gradient()
in smdebug/tensorflow/keras.py
45 19 2
def list_prefix()
in smdebug/core/access_layer/s3handler.py
53 18 1
def _get_writers()
in smdebug/tensorflow/base_hook.py
28 17 3
def _read_write_loop()
in smdebug/profiler/hvd_trace_file_rotation.py
44 16 1
def _prepare_collections()
in smdebug/core/hook.py
28 16 1
def export_collections()
in smdebug/tensorflow/base_hook.py
24 16 1
def can_start_profiling()
in smdebug/profiler/profiler_config.py
28 15 3
def get_utilization_stats()
in smdebug/profiler/analysis/utils/pandas_data_analysis.py
62 15 4
def parse_save_config_dict()
in smdebug/core/json_config.py
26 15 2
def _callback()
in smdebug/xgboost/hook.py
35 14 2