Global Metrics
path: .metrics.cyclomatic.sum
old: 39.0
new: 45.0
path: .metrics.cyclomatic.average
old: 3.25
new: 1.6666666666666667
path: .metrics.mi.mi_sei
old: -5.776706398536774
new: 3.225311589819512
path: .metrics.mi.mi_visual_studio
old: 15.964498231155764
new: 11.944412990906118
path: .metrics.mi.mi_original
old: 27.29929197527636
new: 20.424946214449463
path: .metrics.loc.lloc
old: 72.0
new: 21.0
path: .metrics.loc.ploc
old: 184.0
new: 142.0
path: .metrics.loc.blank
old: 42.0
new: 40.0
path: .metrics.loc.cloc
old: 34.0
new: 195.0
path: .metrics.loc.sloc
old: 260.0
new: 377.0
path: .metrics.nom.total
old: 8.0
new: 17.0
path: .metrics.nom.functions
old: 8.0
new: 17.0
path: .metrics.halstead.N1
old: 468.0
new: 420.0
path: .metrics.halstead.bugs
old: 1.3182461081405512
new: 1.0662897832711862
path: .metrics.halstead.estimated_program_length
old: 646.9937635307236
new: 784.688267946295
path: .metrics.halstead.length
old: 793.0
new: 694.0
path: .metrics.halstead.n2
old: 84.0
new: 99.0
path: .metrics.halstead.volume
old: 5356.62578921563
new: 4842.232266908943
path: .metrics.halstead.level
old: 0.021538461538461538
new: 0.0267639902676399
path: .metrics.halstead.vocabulary
old: 108.0
new: 126.0
path: .metrics.halstead.N2
old: 325.0
new: 274.0
path: .metrics.halstead.n1
old: 24.0
new: 27.0
path: .metrics.halstead.purity_ratio
old: 0.8158811646036868
new: 1.1306747376747768
path: .metrics.halstead.time
old: 13816.693503929206
new: 10051.30031161402
path: .metrics.halstead.difficulty
old: 46.42857142857143
new: 37.36363636363637
path: .metrics.halstead.effort
old: 248700.4830707257
new: 180923.4056090523
path: .metrics.nargs.sum
old: 11.0
new: 10.0
path: .metrics.nargs.average
old: 1.375
new: 0.5882352941176471
path: .metrics.nexits.average
old: 2.125
new: 0.8235294117647058
path: .metrics.nexits.sum
old: 17.0
new: 14.0
path: .metrics.cognitive.sum
old: 37.0
new: 13.0
path: .metrics.cognitive.average
old: 4.625
new: 0.7647058823529411
Spaces Data
Minimal test - lines (234, 234)
path: .spaces[0].spaces[6].metrics.nargs.average
old: 1.0
new: null
path: .spaces[0].spaces[6].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[6].metrics.loc.sloc
old: 8.0
new: 1.0
path: .spaces[0].spaces[6].metrics.loc.lloc
old: 3.0
new: 0.0
path: .spaces[0].spaces[6].metrics.loc.blank
old: 2.0
new: 0.0
path: .spaces[0].spaces[6].metrics.loc.ploc
old: 6.0
new: 1.0
path: .spaces[0].spaces[6].metrics.halstead.bugs
old: 0.02945118944516573
new: 0.0
path: .spaces[0].spaces[6].metrics.halstead.estimated_program_length
old: 43.65148445440323
new: null
path: .spaces[0].spaces[6].metrics.halstead.level
old: 0.14583333333333334
new: null
path: .spaces[0].spaces[6].metrics.halstead.effort
old: 830.4933151807822
new: 0.0
path: .spaces[0].spaces[6].metrics.halstead.purity_ratio
old: 1.408112401754943
new: null
path: .spaces[0].spaces[6].metrics.halstead.n1
old: 8.0
new: 0.0
path: .spaces[0].spaces[6].metrics.halstead.n2
old: 7.0
new: 1.0
path: .spaces[0].spaces[6].metrics.halstead.time
old: 46.13851751004346
new: 0.0
path: .spaces[0].spaces[6].metrics.halstead.vocabulary
old: 15.0
new: 1.0
path: .spaces[0].spaces[6].metrics.halstead.N2
old: 12.0
new: 1.0
path: .spaces[0].spaces[6].metrics.halstead.difficulty
old: 6.857142857142857
new: 0.0
path: .spaces[0].spaces[6].metrics.halstead.N1
old: 19.0
new: 0.0
path: .spaces[0].spaces[6].metrics.halstead.length
old: 31.0
new: 1.0
path: .spaces[0].spaces[6].metrics.halstead.volume
old: 121.11360846386408
new: 0.0
path: .spaces[0].spaces[6].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].spaces[6].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[6].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].spaces[6].metrics.mi.mi_sei
old: 86.18487073272814
new: null
path: .spaces[0].spaces[6].metrics.mi.mi_visual_studio
old: 65.57898019362105
new: null
path: .spaces[0].spaces[6].metrics.mi.mi_original
old: 112.140056131092
new: null
path: .spaces[0].spaces[6].metrics.nexits.average
old: 0.0
new: null
Code
class UniqueStringUniverse;
Minimal test - lines (232, 232)
path: .spaces[0].spaces[4].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].spaces[4].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[4].metrics.cyclomatic.sum
old: 9.0
new: 1.0
path: .spaces[0].spaces[4].metrics.cyclomatic.average
old: 9.0
new: 1.0
path: .spaces[0].spaces[4].metrics.nargs.average
old: 0.0
new: null
path: .spaces[0].spaces[4].metrics.nexits.average
old: 5.0
new: null
path: .spaces[0].spaces[4].metrics.nexits.sum
old: 5.0
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.difficulty
old: 19.384615384615383
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.length
old: 150.0
new: 1.0
path: .spaces[0].spaces[4].metrics.halstead.bugs
old: 0.20881483203874915
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.N1
old: 87.0
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.volume
old: 808.847613416814
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.time
old: 871.0666606027228
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.effort
old: 15679.19989084901
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.level
old: 0.05158730158730159
new: null
path: .spaces[0].spaces[4].metrics.halstead.vocabulary
old: 42.0
new: 1.0
path: .spaces[0].spaces[4].metrics.halstead.N2
old: 63.0
new: 1.0
path: .spaces[0].spaces[4].metrics.halstead.n1
old: 16.0
new: 0.0
path: .spaces[0].spaces[4].metrics.halstead.n2
old: 26.0
new: 1.0
path: .spaces[0].spaces[4].metrics.halstead.purity_ratio
old: 1.2414095511444558
new: null
path: .spaces[0].spaces[4].metrics.halstead.estimated_program_length
old: 186.2114326716684
new: null
path: .spaces[0].spaces[4].metrics.loc.ploc
old: 35.0
new: 1.0
path: .spaces[0].spaces[4].metrics.loc.blank
old: 6.0
new: 0.0
path: .spaces[0].spaces[4].metrics.loc.sloc
old: 46.0
new: 1.0
path: .spaces[0].spaces[4].metrics.loc.cloc
old: 5.0
new: 0.0
path: .spaces[0].spaces[4].metrics.loc.lloc
old: 16.0
new: 0.0
path: .spaces[0].spaces[4].metrics.cognitive.sum
old: 10.0
new: 0.0
path: .spaces[0].spaces[4].metrics.cognitive.average
old: 10.0
new: null
path: .spaces[0].spaces[4].metrics.mi.mi_visual_studio
old: 42.15721321282092
new: null
path: .spaces[0].spaces[4].metrics.mi.mi_original
old: 72.08883459392378
new: null
path: .spaces[0].spaces[4].metrics.mi.mi_sei
old: 53.659485228412976
new: null
Code
class PriMap;
Minimal test - lines (169, 175)
path: .spaces[0].spaces[2].metrics.loc.cloc
old: 7.0
new: 2.0
path: .spaces[0].spaces[2].metrics.loc.lloc
old: 11.0
new: 0.0
path: .spaces[0].spaces[2].metrics.loc.ploc
old: 31.0
new: 5.0
path: .spaces[0].spaces[2].metrics.loc.sloc
old: 44.0
new: 7.0
path: .spaces[0].spaces[2].metrics.loc.blank
old: 6.0
new: 0.0
path: .spaces[0].spaces[2].metrics.mi.mi_original
old: 72.34843782817708
new: 119.90923769696076
path: .spaces[0].spaces[2].metrics.mi.mi_visual_studio
old: 42.3090279696942
new: 70.12236122629284
path: .spaces[0].spaces[2].metrics.mi.mi_sei
old: 58.35544236547227
new: 134.22509803171238
path: .spaces[0].spaces[2].metrics.halstead.purity_ratio
old: 1.597771992858391
new: 1.5084338826489854
path: .spaces[0].spaces[2].metrics.halstead.volume
old: 965.4870721586182
new: 41.209025018750054
path: .spaces[0].spaces[2].metrics.halstead.N2
old: 69.0
new: 5.0
path: .spaces[0].spaces[2].metrics.halstead.length
old: 167.0
new: 13.0
path: .spaces[0].spaces[2].metrics.halstead.level
old: 0.054919908466819226
new: 0.5
path: .spaces[0].spaces[2].metrics.halstead.n2
old: 36.0
new: 5.0
path: .spaces[0].spaces[2].metrics.halstead.estimated_program_length
old: 266.82792280735134
new: 19.60964047443681
path: .spaces[0].spaces[2].metrics.halstead.vocabulary
old: 55.0
new: 9.0
path: .spaces[0].spaces[2].metrics.halstead.N1
old: 98.0
new: 8.0
path: .spaces[0].spaces[2].metrics.halstead.bugs
old: 0.2253667546487059
new: 0.006312871783006906
path: .spaces[0].spaces[2].metrics.halstead.difficulty
old: 18.208333333333332
new: 2.0
path: .spaces[0].spaces[2].metrics.halstead.effort
old: 17579.91043888817
new: 82.41805003750011
path: .spaces[0].spaces[2].metrics.halstead.n1
old: 19.0
new: 4.0
path: .spaces[0].spaces[2].metrics.halstead.time
old: 976.6616910493428
new: 4.578780557638895
path: .spaces[0].spaces[2].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nexits.average
old: 1.0
new: null
path: .spaces[0].spaces[2].metrics.cyclomatic.average
old: 7.0
new: 1.0
path: .spaces[0].spaces[2].metrics.cyclomatic.sum
old: 7.0
new: 1.0
path: .spaces[0].spaces[2].metrics.cognitive.average
old: 9.0
new: null
path: .spaces[0].spaces[2].metrics.cognitive.sum
old: 9.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nargs.average
old: 2.0
new: null
Code
struct StackImage {
// [start_avma, +len) specify the address range in the buffer.
// Obviously we require 0 <= len <= N_STACK_BYTES.
uintptr_t mStartAvma;
size_t mLen;
uint8_t mContents[N_STACK_BYTES];
};
Minimal test - lines (233, 233)
path: .spaces[0].spaces[5].metrics.nargs.average
old: 2.0
new: null
path: .spaces[0].spaces[5].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.estimated_program_length
old: 39.50977500432694
new: null
path: .spaces[0].spaces[5].metrics.halstead.length
old: 17.0
new: 1.0
path: .spaces[0].spaces[5].metrics.halstead.n2
old: 6.0
new: 1.0
path: .spaces[0].spaces[5].metrics.halstead.N2
old: 7.0
new: 1.0
path: .spaces[0].spaces[5].metrics.halstead.purity_ratio
old: 2.324104412019232
new: null
path: .spaces[0].spaces[5].metrics.halstead.n1
old: 8.0
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.level
old: 0.21428571428571427
new: null
path: .spaces[0].spaces[5].metrics.halstead.bugs
old: 0.015005994719638868
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.vocabulary
old: 14.0
new: 1.0
path: .spaces[0].spaces[5].metrics.halstead.volume
old: 64.72503367497927
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.time
old: 16.780564286105736
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.N1
old: 10.0
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.difficulty
old: 4.666666666666667
new: 0.0
path: .spaces[0].spaces[5].metrics.halstead.effort
old: 302.05015714990327
new: 0.0
path: .spaces[0].spaces[5].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].spaces[5].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[5].metrics.loc.lloc
old: 2.0
new: 0.0
path: .spaces[0].spaces[5].metrics.loc.ploc
old: 5.0
new: 1.0
path: .spaces[0].spaces[5].metrics.loc.sloc
old: 5.0
new: 1.0
path: .spaces[0].spaces[5].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].spaces[5].metrics.mi.mi_visual_studio
old: 71.93703858468322
new: null
path: .spaces[0].spaces[5].metrics.mi.mi_original
old: 123.01233597980831
new: null
path: .spaces[0].spaces[5].metrics.mi.mi_sei
old: 101.87025495362818
new: null
path: .spaces[0].spaces[5].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[0].spaces[5].metrics.nexits.average
old: 1.0
new: null
Code
class SegArray;
Minimal test - lines (60, 60)
path: .spaces[0].spaces[0].spaces[0].metrics.cognitive.average
old: 2.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.cognitive.sum
old: 4.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.volume
old: 946.2729932114212
new: 43.18506523353571
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.difficulty
old: 17.470588235294116
new: 3.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.effort
old: 16531.945822576003
new: 129.55519570060713
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.4941710037859828
new: 1.78609853452874
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N2
old: 66.0
new: 6.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.level
old: 0.05723905723905724
new: 0.3333333333333333
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 248.03238662847315
new: 23.21928094887362
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.bugs
old: 0.21631903034309824
new: 0.008534576359217054
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n2
old: 34.0
new: 5.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N1
old: 100.0
new: 7.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.vocabulary
old: 52.0
new: 10.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n1
old: 18.0
new: 5.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.time
old: 918.4414345875556
new: 7.197510872255951
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.length
old: 166.0
new: 13.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.lloc
old: 13.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.cloc
old: 3.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.ploc
old: 37.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.blank
old: 5.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.sloc
old: 45.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.cyclomatic.sum
old: 5.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.6666666666666667
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nom.functions
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 42.426260775552024
new: 88.41486984730174
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_original
old: 72.54890592619397
new: 151.189427438886
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_sei
old: 48.94511122208205
new: 142.52120506831432
Code
explicit TaggedUWord(uintptr_t w) : mValue(w), mValid(true) {}
Minimal test - lines (134, 158)
path: .spaces[0].spaces[1].metrics.nexits.average
old: 8.0
new: null
path: .spaces[0].spaces[1].metrics.nexits.sum
old: 8.0
new: 0.0
path: .spaces[0].spaces[1].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[0].spaces[1].metrics.nargs.average
old: 2.0
new: null
path: .spaces[0].spaces[1].metrics.cyclomatic.average
old: 12.0
new: 2.0
path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 12.0
new: 2.0
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 50.0
new: 25.0
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 117.0
new: 23.0
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 235.0586500259616
new: 100.23866587835396
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 1089.2642446265218
new: 283.2752275762582
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 23283.023228891903
new: 1025.1865378950297
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 21.375
new: 3.619047619047619
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.04678362573099415
new: 0.2763157894736842
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.27179303686675454
new: 0.033890710607871403
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 32.0
new: 21.0
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 76.0
new: 38.0
path: .spaces[0].spaces[1].metrics.halstead.length
old: 193.0
new: 61.0
path: .spaces[0].spaces[1].metrics.halstead.n1
old: 18.0
new: 4.0
path: .spaces[0].spaces[1].metrics.halstead.time
old: 1293.5012904939947
new: 56.95480766083498
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.2179204664557597
new: 1.643256817677934
path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 37.57309120897118
new: 52.06598423496875
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 46.76084592644693
new: 52.95001443249113
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 64.24998596734072
new: 89.03283304179656
path: .spaces[0].spaces[1].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[0].spaces[1].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].spaces[1].metrics.loc.ploc
old: 45.0
new: 25.0
path: .spaces[0].spaces[1].metrics.loc.cloc
old: 10.0
new: 0.0
path: .spaces[0].spaces[1].metrics.loc.lloc
old: 22.0
new: 0.0
path: .spaces[0].spaces[1].metrics.loc.blank
old: 10.0
new: 0.0
path: .spaces[0].spaces[1].metrics.loc.sloc
old: 65.0
new: 25.0
path: .spaces[0].spaces[1].metrics.cognitive.average
old: 14.0
new: null
path: .spaces[0].spaces[1].metrics.cognitive.sum
old: 14.0
new: 1.0
Code
struct UnwindRegs {
#if defined(GP_ARCH_arm)
TaggedUWord r7;
TaggedUWord r11;
TaggedUWord r12;
TaggedUWord r13;
TaggedUWord r14;
TaggedUWord r15;
#elif defined(GP_ARCH_arm64)
TaggedUWord x29;
TaggedUWord x30;
TaggedUWord sp;
TaggedUWord pc;
#elif defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
TaggedUWord xbp;
TaggedUWord xsp;
TaggedUWord xip;
#elif defined(GP_ARCH_mips64)
TaggedUWord sp;
TaggedUWord fp;
TaggedUWord pc;
#else
# error "Unknown plat"
#endif
};
Minimal test - lines (179, 204)
path: .spaces[0].spaces[3].metrics.nexits.average
old: 0.0
new: 0.5
path: .spaces[0].spaces[3].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[0].spaces[3].metrics.cyclomatic.sum
old: 1.0
new: 5.0
path: .spaces[0].spaces[3].metrics.mi.mi_sei
old: 80.91232072984222
new: 71.09414527972203
path: .spaces[0].spaces[3].metrics.mi.mi_visual_studio
old: 63.44175611826334
new: 49.11691235784357
path: .spaces[0].spaces[3].metrics.mi.mi_original
old: 108.48540296223032
new: 83.9899201319125
path: .spaces[0].spaces[3].metrics.loc.ploc
old: 9.0
new: 22.0
path: .spaces[0].spaces[3].metrics.loc.sloc
old: 9.0
new: 26.0
path: .spaces[0].spaces[3].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[0].spaces[3].metrics.loc.lloc
old: 2.0
new: 5.0
path: .spaces[0].spaces[3].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].spaces[3].metrics.nom.functions
old: 1.0
new: 4.0
path: .spaces[0].spaces[3].metrics.nom.total
old: 1.0
new: 4.0
path: .spaces[0].spaces[3].metrics.halstead.N2
old: 16.0
new: 56.0
path: .spaces[0].spaces[3].metrics.halstead.vocabulary
old: 22.0
new: 23.0
path: .spaces[0].spaces[3].metrics.halstead.level
old: 0.125
new: 0.01904761904761905
path: .spaces[0].spaces[3].metrics.halstead.n2
old: 11.0
new: 8.0
path: .spaces[0].spaces[3].metrics.halstead.N1
old: 22.0
new: 72.0
path: .spaces[0].spaces[3].metrics.halstead.bugs
old: 0.04083013415535803
new: 0.32467233862768935
path: .spaces[0].spaces[3].metrics.halstead.effort
old: 1355.6672120657383
new: 30398.33634470313
path: .spaces[0].spaces[3].metrics.halstead.estimated_program_length
old: 76.10749561002054
new: 82.60335893412778
path: .spaces[0].spaces[3].metrics.halstead.difficulty
old: 8.0
new: 52.5
path: .spaces[0].spaces[3].metrics.halstead.n1
old: 11.0
new: 15.0
path: .spaces[0].spaces[3].metrics.halstead.volume
old: 169.4584015082173
new: 579.0159303752977
path: .spaces[0].spaces[3].metrics.halstead.time
old: 75.31484511476324
new: 1688.7964635946182
path: .spaces[0].spaces[3].metrics.halstead.purity_ratio
old: 2.0028288318426455
new: 0.6453387416728733
path: .spaces[0].spaces[3].metrics.halstead.length
old: 38.0
new: 128.0
path: .spaces[0].spaces[3].metrics.nargs.average
old: 2.0
new: 0.5
Code
class LULStats {
public:
LULStats() : mContext(0), mCFI(0), mFP(0) {}
template
explicit LULStats(const LULStats& aOther)
: mContext(aOther.mContext), mCFI(aOther.mCFI), mFP(aOther.mFP) {}
template
LULStats& operator=(const LULStats& aOther) {
mContext = aOther.mContext;
mCFI = aOther.mCFI;
mFP = aOther.mFP;
return *this;
}
template
uint32_t operator-(const LULStats& aOther) {
return (mContext - aOther.mContext) + (mCFI - aOther.mCFI) +
(mFP - aOther.mFP);
}
T mContext; // Number of context frames
T mCFI; // Number of CFI/EXIDX frames
T mFP; // Number of frame-pointer recovered frames
};
Minimal test - lines (53, 375)
path: .spaces[0].metrics.nexits.sum
old: 17.0
new: 14.0
path: .spaces[0].metrics.nexits.average
old: 2.125
new: 0.8235294117647058
path: .spaces[0].metrics.cognitive.sum
old: 37.0
new: 13.0
path: .spaces[0].metrics.cognitive.average
old: 4.625
new: 0.7647058823529411
path: .spaces[0].metrics.cyclomatic.average
old: 3.4545454545454546
new: 1.6923076923076923
path: .spaces[0].metrics.cyclomatic.sum
old: 38.0
new: 44.0
path: .spaces[0].metrics.mi.mi_original
old: 28.66878586436843
new: 23.23175348613681
path: .spaces[0].metrics.mi.mi_sei
old: -5.4660060048984676
new: 5.894649856498376
path: .spaces[0].metrics.mi.mi_visual_studio
old: 16.765371850507854
new: 13.58582075212679
path: .spaces[0].metrics.halstead.effort
old: 261775.79142546677
new: 182541.28578838715
path: .spaces[0].metrics.halstead.length
old: 781.0
new: 689.0
path: .spaces[0].metrics.halstead.volume
old: 5177.527520282175
new: 4775.278025580829
path: .spaces[0].metrics.halstead.bugs
old: 1.364054531853209
new: 1.0726371033720845
path: .spaces[0].metrics.halstead.level
old: 0.019778481012658226
new: 0.026159988985267797
path: .spaces[0].metrics.halstead.estimated_program_length
old: 577.2005018044988
new: 752.5182453498537
path: .spaces[0].metrics.halstead.difficulty
old: 50.56
new: 38.22631578947368
path: .spaces[0].metrics.halstead.time
old: 14543.099523637044
new: 10141.182543799288
path: .spaces[0].metrics.halstead.vocabulary
old: 99.0
new: 122.0
path: .spaces[0].metrics.halstead.N2
old: 316.0
new: 269.0
path: .spaces[0].metrics.halstead.N1
old: 465.0
new: 420.0
path: .spaces[0].metrics.halstead.n2
old: 75.0
new: 95.0
path: .spaces[0].metrics.halstead.n1
old: 24.0
new: 27.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.739053139314339
new: 1.0921890353408616
path: .spaces[0].metrics.nargs.average
old: 1.375
new: 0.5882352941176471
path: .spaces[0].metrics.nargs.sum
old: 11.0
new: 10.0
path: .spaces[0].metrics.nom.functions
old: 8.0
new: 17.0
path: .spaces[0].metrics.nom.total
old: 8.0
new: 17.0
path: .spaces[0].metrics.loc.blank
old: 40.0
new: 36.0
path: .spaces[0].metrics.loc.cloc
old: 28.0
new: 151.0
path: .spaces[0].metrics.loc.ploc
old: 177.0
new: 136.0
path: .spaces[0].metrics.loc.sloc
old: 245.0
new: 323.0
path: .spaces[0].metrics.loc.lloc
old: 71.0
new: 21.0
Code
namespace lul {
// A machine word plus validity tag.
class TaggedUWord {
public:
// RUNS IN NO-MALLOC CONTEXT
// Construct a valid one.
explicit TaggedUWord(uintptr_t w) : mValue(w), mValid(true) {}
// RUNS IN NO-MALLOC CONTEXT
// Construct an invalid one.
TaggedUWord() : mValue(0), mValid(false) {}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator+(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() + rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator-(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() - rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator&(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() & rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator|(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() | rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord CmpGEs(TaggedUWord rhs) const {
if (Valid() && rhs.Valid()) {
intptr_t s1 = (intptr_t)Value();
intptr_t s2 = (intptr_t)rhs.Value();
return TaggedUWord(s1 >= s2 ? 1 : 0);
}
return TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator<<(TaggedUWord rhs) const {
if (Valid() && rhs.Valid()) {
uintptr_t shift = rhs.Value();
if (shift < 8 * sizeof(uintptr_t)) return TaggedUWord(Value() << shift);
}
return TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
// Is equal? Note: non-validity on either side gives non-equality.
bool operator==(TaggedUWord other) const {
return (mValid && other.Valid()) ? (mValue == other.Value()) : false;
}
// RUNS IN NO-MALLOC CONTEXT
// Is it word-aligned?
bool IsAligned() const {
return mValid && (mValue & (sizeof(uintptr_t) - 1)) == 0;
}
// RUNS IN NO-MALLOC CONTEXT
uintptr_t Value() const { return mValue; }
// RUNS IN NO-MALLOC CONTEXT
bool Valid() const { return mValid; }
private:
uintptr_t mValue;
bool mValid;
};
// The registers, with validity tags, that will be unwound.
struct UnwindRegs {
#if defined(GP_ARCH_arm)
TaggedUWord r7;
TaggedUWord r11;
TaggedUWord r12;
TaggedUWord r13;
TaggedUWord r14;
TaggedUWord r15;
#elif defined(GP_ARCH_arm64)
TaggedUWord x29;
TaggedUWord x30;
TaggedUWord sp;
TaggedUWord pc;
#elif defined(GP_ARCH_amd64) || defined(GP_ARCH_x86)
TaggedUWord xbp;
TaggedUWord xsp;
TaggedUWord xip;
#elif defined(GP_ARCH_mips64)
TaggedUWord sp;
TaggedUWord fp;
TaggedUWord pc;
#else
# error "Unknown plat"
#endif
};
// The maximum number of bytes in a stack snapshot. This value can be increased
// if necessary, but testing showed that 160k is enough to obtain good
// backtraces on x86_64 Linux. Most backtraces fit comfortably into 4-8k of
// stack space, but we do have some very deep stacks occasionally. Please see
// the comments in DoNativeBacktrace as to why it's OK to have this value be so
// large.
static const size_t N_STACK_BYTES = 160 * 1024;
// The stack chunk image that will be unwound.
struct StackImage {
// [start_avma, +len) specify the address range in the buffer.
// Obviously we require 0 <= len <= N_STACK_BYTES.
uintptr_t mStartAvma;
size_t mLen;
uint8_t mContents[N_STACK_BYTES];
};
// Statistics collection for the unwinder.
template
class LULStats {
public:
LULStats() : mContext(0), mCFI(0), mFP(0) {}
template
explicit LULStats(const LULStats& aOther)
: mContext(aOther.mContext), mCFI(aOther.mCFI), mFP(aOther.mFP) {}
template
LULStats& operator=(const LULStats& aOther) {
mContext = aOther.mContext;
mCFI = aOther.mCFI;
mFP = aOther.mFP;
return *this;
}
template
uint32_t operator-(const LULStats& aOther) {
return (mContext - aOther.mContext) + (mCFI - aOther.mCFI) +
(mFP - aOther.mFP);
}
T mContext; // Number of context frames
T mCFI; // Number of CFI/EXIDX frames
T mFP; // Number of frame-pointer recovered frames
};
// The core unwinder library class. Just one of these is needed, and
// it can be shared by multiple unwinder threads.
//
// The library operates in one of two modes.
//
// * Admin mode. The library is this state after creation. In Admin
// mode, no unwinding may be performed. It is however allowable to
// perform administrative tasks -- primarily, loading of unwind info
// -- in this mode. In particular, it is safe for the library to
// perform dynamic memory allocation in this mode. Safe in the
// sense that there is no risk of deadlock against unwinding threads
// that might -- because of where they have been sampled -- hold the
// system's malloc lock.
//
// * Unwind mode. In this mode, calls to ::Unwind may be made, but
// nothing else. ::Unwind guarantees not to make any dynamic memory
// requests, so as to guarantee that the calling thread won't
// deadlock in the case where it already holds the system's malloc lock.
//
// The library is created in Admin mode. After debuginfo is loaded,
// the caller must switch it into Unwind mode by calling
// ::EnableUnwinding. There is no way to switch it back to Admin mode
// after that. To safely switch back to Admin mode would require the
// caller (or other external agent) to guarantee that there are no
// pending ::Unwind calls.
class PriMap;
class SegArray;
class UniqueStringUniverse;
class LUL {
public:
// Create; supply a logging sink. Sets the object in Admin mode.
explicit LUL(void (*aLog)(const char*));
// Destroy. Caller is responsible for ensuring that no other
// threads are in Unwind calls. All resources are freed and all
// registered unwinder threads are deregistered. Can be called
// either in Admin or Unwind mode.
~LUL();
// Notify the library that unwinding is now allowed and so
// admin-mode calls are no longer allowed. The object is initially
// created in admin mode. The only possible transition is
// admin->unwinding, therefore.
void EnableUnwinding();
// Notify of a new r-x mapping, and load the associated unwind info.
// The filename is strdup'd and used for debug printing. If
// aMappedImage is NULL, this function will mmap/munmap the file
// itself, so as to be able to read the unwind info. If
// aMappedImage is non-NULL then it is assumed to point to a
// called-supplied and caller-managed mapped image of the file.
// May only be called in Admin mode.
void NotifyAfterMap(uintptr_t aRXavma, size_t aSize, const char* aFileName,
const void* aMappedImage);
// In rare cases we know an executable area exists but don't know
// what the associated file is. This call notifies LUL of such
// areas. This is important for correct functioning of stack
// scanning and of the x86-{linux,android} special-case
// __kernel_syscall function handling.
// This must be called only after the code area in
// question really has been mapped.
// May only be called in Admin mode.
void NotifyExecutableArea(uintptr_t aRXavma, size_t aSize);
// Notify that a mapped area has been unmapped; discard any
// associated unwind info. Acquires mRWlock for writing. Note that
// to avoid segfaulting the stack-scan unwinder, which inspects code
// areas, this must be called before the code area in question is
// really unmapped. Note that, unlike NotifyAfterMap(), this
// function takes the start and end addresses of the range to be
// unmapped, rather than a start and a length parameter. This is so
// as to make it possible to notify an unmap for the entire address
// space using a single call.
// May only be called in Admin mode.
void NotifyBeforeUnmap(uintptr_t aAvmaMin, uintptr_t aAvmaMax);
// Apply NotifyBeforeUnmap to the entire address space. This causes
// LUL to discard all unwind and executable-area information for the
// entire address space.
// May only be called in Admin mode.
void NotifyBeforeUnmapAll() { NotifyBeforeUnmap(0, UINTPTR_MAX); }
// Returns the number of mappings currently registered.
// May only be called in Admin mode.
size_t CountMappings();
// Unwind |aStackImg| starting with the context in |aStartRegs|.
// Write the number of frames recovered in *aFramesUsed. Put
// the PC values in aFramePCs[0 .. *aFramesUsed-1] and
// the SP values in aFrameSPs[0 .. *aFramesUsed-1].
// |aFramesAvail| is the size of the two output arrays and hence the
// largest possible value of *aFramesUsed. PC values are always
// valid, and the unwind will stop when the PC becomes invalid, but
// the SP values might be invalid, in which case the value zero will
// be written in the relevant frameSPs[] slot.
//
// This function assumes that the SP values increase as it unwinds
// away from the innermost frame -- that is, that the stack grows
// down. It monitors SP values as it unwinds to check they
// decrease, so as to avoid looping on corrupted stacks.
//
// May only be called in Unwind mode. Multiple threads may unwind
// at once. LUL user is responsible for ensuring that no thread makes
// any Admin calls whilst in Unwind mode.
// MOZ_CRASHes if the calling thread is not registered for unwinding.
//
// The calling thread must previously have been registered via a call to
// RegisterSampledThread.
void Unwind(/*OUT*/ uintptr_t* aFramePCs,
/*OUT*/ uintptr_t* aFrameSPs,
/*OUT*/ size_t* aFramesUsed,
/*OUT*/ size_t* aFramePointerFramesAcquired, size_t aFramesAvail,
UnwindRegs* aStartRegs, StackImage* aStackImg);
// The logging sink. Call to send debug strings to the caller-
// specified destination. Can only be called by the Admin thread.
void (*mLog)(const char*);
// Statistics relating to unwinding. These have to be atomic since
// unwinding can occur on different threads simultaneously.
LULStats> mStats;
// Possibly show the statistics. This may not be called from any
// registered sampling thread, since it involves I/O.
void MaybeShowStats();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf) const;
private:
// The statistics counters at the point where they were last printed.
LULStats mStatsPrevious;
// Are we in admin mode? Initially |true| but changes to |false|
// once unwinding begins.
bool mAdminMode;
// The thread ID associated with admin mode. This is the only thread
// that is allowed do perform non-Unwind calls on this object. Conversely,
// no registered Unwinding thread may be the admin thread. This is so
// as to clearly partition the one thread that may do dynamic memory
// allocation from the threads that are being sampled, since the latter
// absolutely may not do dynamic memory allocation.
int mAdminThreadId;
// The top level mapping from code address ranges to postprocessed
// unwind info. Basically a sorted array of (addr, len, info)
// records. This field is updated by NotifyAfterMap and NotifyBeforeUnmap.
PriMap* mPriMap;
// An auxiliary structure that records which address ranges are
// mapped r-x, for the benefit of the stack scanner.
SegArray* mSegArray;
// A UniqueStringUniverse that holds all the strdup'd strings created
// whilst reading unwind information. This is included so as to make
// it possible to free them in ~LUL.
UniqueStringUniverse* mUSU;
};
// Run unit tests on an initialised, loaded-up LUL instance, and print
// summary results on |aLUL|'s logging sink. Also return the number
// of tests run in *aNTests and the number that passed in
// *aNTestsPassed.
void RunLulUnitTests(/*OUT*/ int* aNTests, /*OUT*/ int* aNTestsPassed,
LUL* aLUL);
} // namespace lul
Minimal test - lines (56, 130)
path: .spaces[0].spaces[0].metrics.nargs.average
old: 1.0
new: 0.6666666666666666
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 2.0
new: 8.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 3.0
new: 16.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 13.0
new: 15.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 7.0
new: 12.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 39.0
new: 47.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 49.0
new: 75.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 2.0
new: 12.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 2.0
new: 12.0
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 41.44858084072404
new: 32.67443155449893
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 70.87707323763811
new: 55.87327795819317
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 45.86442394271563
new: 40.763164535826675
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 2.0
new: 12.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 6.0
new: 30.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.5
new: 2.3076923076923075
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 248.03238662847315
new: 173.16614563598216
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.05723905723905724
new: 0.01501251042535446
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.4763832537409116
new: 0.5850207622837236
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 16731.125892727523
new: 104931.86492155024
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.21805306218676643
new: 0.7415669049205453
path: .spaces[0].spaces[0].metrics.halstead.time
old: 929.506994040418
new: 5829.548051197236
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 102.0
new: 187.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 18.0
new: 22.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 52.0
new: 40.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 66.0
new: 109.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 957.6738726477034
new: 1575.2907160866594
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 17.470588235294116
new: 66.61111111111111
path: .spaces[0].spaces[0].metrics.halstead.length
old: 168.0
new: 296.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 34.0
new: 18.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 4.0
new: 12.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 2.0
new: 1.0
Code
class TaggedUWord {
public:
// RUNS IN NO-MALLOC CONTEXT
// Construct a valid one.
explicit TaggedUWord(uintptr_t w) : mValue(w), mValid(true) {}
// RUNS IN NO-MALLOC CONTEXT
// Construct an invalid one.
TaggedUWord() : mValue(0), mValid(false) {}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator+(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() + rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator-(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() - rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator&(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() & rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator|(TaggedUWord rhs) const {
return (Valid() && rhs.Valid()) ? TaggedUWord(Value() | rhs.Value())
: TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord CmpGEs(TaggedUWord rhs) const {
if (Valid() && rhs.Valid()) {
intptr_t s1 = (intptr_t)Value();
intptr_t s2 = (intptr_t)rhs.Value();
return TaggedUWord(s1 >= s2 ? 1 : 0);
}
return TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
TaggedUWord operator<<(TaggedUWord rhs) const {
if (Valid() && rhs.Valid()) {
uintptr_t shift = rhs.Value();
if (shift < 8 * sizeof(uintptr_t)) return TaggedUWord(Value() << shift);
}
return TaggedUWord();
}
// RUNS IN NO-MALLOC CONTEXT
// Is equal? Note: non-validity on either side gives non-equality.
bool operator==(TaggedUWord other) const {
return (mValid && other.Valid()) ? (mValue == other.Value()) : false;
}
// RUNS IN NO-MALLOC CONTEXT
// Is it word-aligned?
bool IsAligned() const {
return mValid && (mValue & (sizeof(uintptr_t) - 1)) == 0;
}
// RUNS IN NO-MALLOC CONTEXT
uintptr_t Value() const { return mValue; }
// RUNS IN NO-MALLOC CONTEXT
bool Valid() const { return mValid; }
private:
uintptr_t mValue;
bool mValid;
};