pytorch / kineto
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 852 units with 9,375 lines of code in units (53.1% of code).
    • 5 very long units (952 lines of code)
    • 17 long units (1,123 lines of code)
    • 88 medium size units (2,778 lines of code)
    • 124 small units (1,791 lines of code)
    • 618 very small units (2,731 lines of code)
10% | 11% | 29% | 19% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp21% | 10% | 27% | 19% | 19%
py0% | 17% | 35% | 20% | 26%
tsx0% | 0% | 50% | 20% | 28%
ts0% | 0% | 43% | 33% | 23%
h0% | 0% | 0% | 5% | 94%
tpp0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
libkineto/src19% | 9% | 24% | 17% | 30%
tb_plugin/torch_tb_profiler/profiler0% | 19% | 45% | 20% | 14%
tb_plugin/torch_tb_profiler0% | 27% | 27% | 11% | 32%
tb_plugin/fe/src0% | 0% | 46% | 27% | 25%
tb_plugin/torch_tb_profiler/io0% | 0% | 14% | 31% | 53%
libkineto/sample_programs0% | 0% | 0% | 100% | 0%
libkineto/include0% | 0% | 0% | 8% | 91%
tb_plugin0% | 0% | 0% | 0% | 100%
tb_plugin/fe/scripts0% | 0% | 0% | 0% | 100%
tb_plugin/torch_tb_profiler/static0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void ChromeTraceLogger::handleTraceStart()
in libkineto/src/output_json.cpp
398 30 1
void RoctracerActivityApi::api_callback()
in libkineto/src/RoctracerActivityApi.cpp
165 17 4
int RoctracerActivityApi::processActivities()
in libkineto/src/RoctracerActivityApi.cpp
155 21 1
void EventProfilerController::profilerLoop()
in libkineto/src/EventProfilerController.cpp
127 22 0
bool getProfilerConfigImage()
in libkineto/src/CuptiNvPerfMetric.cpp
107 12 4
def _generate_overview()
in tb_plugin/torch_tb_profiler/profiler/run_generator.py
96 15 1
def get_memory_events()
in tb_plugin/torch_tb_profiler/run.py
82 12 6
const time_point CuptiActivityProfiler::performRunLoopStep()
in libkineto/src/CuptiActivityProfiler.cpp
79 21 2
def get_memory_curve()
in tb_plugin/torch_tb_profiler/run.py
77 2 5
bool getCounterDataPrefixImage()
in libkineto/src/CuptiNvPerfMetric.cpp
75 7 3
bool Config::handleOption()
in libkineto/src/Config.cpp
75 27 2
CuptiProfilerResult evalMetricValues()
in libkineto/src/CuptiNvPerfMetric.cpp
74 9 4
void CuptiActivityProfiler::configure()
in libkineto/src/CuptiActivityProfiler.cpp
65 14 2
def update_node()
in tb_plugin/torch_tb_profiler/profiler/memory_parser.py
65 21 2
def calculate_gpu_utilization()
in tb_plugin/torch_tb_profiler/profiler/gpu_metrics_parser.py
65 21 5
def _generate_op_pie()
in tb_plugin/torch_tb_profiler/profiler/run_generator.py
56 12 2
void Config::validate()
in libkineto/src/Config.cpp
54 10 1
def process()
in tb_plugin/torch_tb_profiler/profiler/data.py
54 3 1
void RoctracerActivityApi::enableActivities()
in libkineto/src/RoctracerActivityApi.cpp
52 7 1
def get_memory_statistics()
in tb_plugin/torch_tb_profiler/profiler/memory_parser.py
52 24 3