pytorch / cpuinfo
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 389 units with 11,783 lines of code in units (73.6% of code).
    • 9 very complex units (3,098 lines of code)
    • 17 complex units (2,952 lines of code)
    • 28 medium complex units (1,962 lines of code)
    • 36 simple units (1,211 lines of code)
    • 299 very simple units (2,560 lines of code)
26% | 25% | 16% | 10% | 21%
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
c30% | 27% | 18% | 10% | 13%
py0% | 24% | 21% | 26% | 27%
h0% | 4% | 1% | 4% | 89%
cc0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/arm33% | 24% | 17% | 12% | 11%
src/x8632% | 41% | 12% | 4% | 9%
tools25% | 39% | 18% | 8% | 8%
ROOT0% | 100% | 0% | 0% | 0%
src/emscripten0% | 0% | 100% | 0% | 0%
src/linux0% | 0% | 21% | 22% | 56%
scripts0% | 0% | 28% | 34% | 36%
src/mach0% | 0% | 100% | 0% | 0%
src0% | 0% | 0% | 30% | 70%
include0% | 0% | 0% | 0% | 100%
bench0% | 0% | 0% | 0% | 100%
src/cpuinfo0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
230 133 2
int main()
in tools/isa-info.c
149 120 2
845 91 10
306 85 4
void cpuinfo_arm_linux_init()
in src/arm/linux/init.c
538 85 1
215 76 3
179 71 7
438 57 3
static void parse_features()
in src/arm/linux/cpuinfo.c
198 52 3
98 50 3
static bool parse_line()
in src/arm/linux/cpuinfo.c
206 50 4
void cpuinfo_x86_linux_init()
in src/x86/linux/init.c
423 49 1
void cpuinfo_arm_mach_init()
in src/arm/mach/init.c
320 49 1
192 47 6
void cpuinfo_arm_fixup_chipset()
in src/arm/linux/chipset.c
204 46 3
102 45 5
void cpuinfo_x86_mach_init()
in src/x86/mach/init.c
301 38 1
187 37 3
51 34 1
116 31 2