Global Metrics
path: .metrics.nexits.sum
old: 14.0
new: 1.0
path: .metrics.nexits.average
old: 1.0769230769230769
new: 0.25
path: .metrics.halstead.bugs
old: 0.6899285773195479
new: 0.29954937302158313
path: .metrics.halstead.n2
old: 84.0
new: 40.0
path: .metrics.halstead.difficulty
old: 29.160714285714285
new: 22.05
path: .metrics.halstead.purity_ratio
old: 1.338197470778136
new: 1.4811446100672254
path: .metrics.halstead.N2
old: 213.0
new: 84.0
path: .metrics.halstead.time
old: 5231.371693484009
new: 1496.6215671339946
path: .metrics.halstead.volume
old: 3229.162686486149
new: 1221.7318915379549
path: .metrics.halstead.N1
old: 266.0
new: 122.0
path: .metrics.halstead.effort
old: 94164.69048271216
new: 26939.188208411902
path: .metrics.halstead.level
old: 0.034292712798530314
new: 0.045351473922902494
path: .metrics.halstead.estimated_program_length
old: 640.9965885027271
new: 305.11578967384844
path: .metrics.halstead.length
old: 479.0
new: 206.0
path: .metrics.halstead.vocabulary
old: 107.0
new: 61.0
path: .metrics.halstead.n1
old: 23.0
new: 21.0
path: .metrics.cognitive.average
old: 0.4615384615384616
new: 1.75
path: .metrics.cognitive.sum
old: 6.0
new: 7.0
path: .metrics.nom.closures
old: 1.0
new: 0.0
path: .metrics.nom.functions
old: 12.0
new: 4.0
path: .metrics.nom.total
old: 13.0
new: 4.0
path: .metrics.mi.mi_visual_studio
old: 26.564416758335245
new: 37.35859515399626
path: .metrics.mi.mi_original
old: 45.42515265675327
new: 63.883197713333615
path: .metrics.mi.mi_sei
old: 9.626774106171348
new: 44.83616731496888
path: .metrics.loc.cloc
old: 7.0
new: 9.0
path: .metrics.loc.ploc
old: 101.0
new: 46.0
path: .metrics.loc.blank
old: 21.0
new: 10.0
path: .metrics.loc.sloc
old: 129.0
new: 65.0
path: .metrics.loc.lloc
old: 40.0
new: 12.0
path: .metrics.cyclomatic.average
old: 1.6153846153846154
new: 1.8333333333333333
path: .metrics.cyclomatic.sum
old: 21.0
new: 11.0
path: .metrics.nargs.sum
old: 29.0
new: 2.0
path: .metrics.nargs.average
old: 2.230769230769231
new: 0.5
Spaces Data
Minimal test - lines (49, 65)
path: .spaces[1].metrics.nargs.average
old: 13.0
new: 2.0
path: .spaces[1].metrics.nargs.sum
old: 13.0
new: 2.0
path: .spaces[1].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[1].metrics.loc.lloc
old: 3.0
new: 6.0
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[1].metrics.halstead.time
old: 405.9398711631074
new: 316.3334084492383
path: .spaces[1].metrics.halstead.level
old: 0.08391608391608392
new: 0.08571428571428572
path: .spaces[1].metrics.halstead.N2
old: 55.0
new: 40.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 195.31243420408975
new: 163.3420689261142
path: .spaces[1].metrics.halstead.effort
old: 7306.917680935933
new: 5694.001352086289
path: .spaces[1].metrics.halstead.n1
old: 13.0
new: 14.0
path: .spaces[1].metrics.halstead.vocabulary
old: 43.0
new: 38.0
path: .spaces[1].metrics.halstead.n2
old: 30.0
new: 24.0
path: .spaces[1].metrics.halstead.difficulty
old: 11.916666666666666
new: 11.666666666666666
path: .spaces[1].metrics.halstead.bugs
old: 0.12551671228155722
new: 0.10628952247380592
path: .spaces[1].metrics.halstead.volume
old: 613.167917281337
new: 488.0572587502534
path: .spaces[1].metrics.halstead.length
old: 113.0
new: 93.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.7284286212751303
new: 1.7563663325388623
path: .spaces[1].metrics.halstead.N1
old: 58.0
new: 53.0
path: .spaces[1].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[1].metrics.mi.mi_original
old: 91.49502193382172
new: 92.22169361742073
path: .spaces[1].metrics.mi.mi_sei
old: 56.40038227734324
new: 57.6523876304349
path: .spaces[1].metrics.mi.mi_visual_studio
old: 53.50586078001271
new: 53.930814980947794
Code
TEST(AutoRefCnt, ThreadSafeAutoRefCntBalance)
{
static const size_t kThreadCount = 4;
nsCOMPtr threads[kThreadCount];
for (size_t i = 0; i < kThreadCount; i++) {
nsresult rv =
NS_NewNamedThread("AutoRefCnt Test", getter_AddRefs(threads[i]),
new nsThreadSafeAutoRefCntRunner);
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
for (size_t i = 0; i < kThreadCount; i++) {
threads[i]->Shutdown();
}
EXPECT_EQ(nsThreadSafeAutoRefCntRunner::sRefCnt, nsrefcnt(0));
EXPECT_EQ(nsThreadSafeAutoRefCntRunner::sIncToOne,
nsThreadSafeAutoRefCntRunner::sDecToZero);
}
Minimal test - lines (17, 39)
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 3.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 3.0
path: .spaces[0].metrics.halstead.difficulty
old: 2.5
new: 14.875
path: .spaces[0].metrics.halstead.level
old: 0.4
new: 0.06722689075630252
path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 17.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 2.045565997075035
new: 1.6897071936867818
path: .spaces[0].metrics.halstead.vocabulary
old: 8.0
new: 33.0
path: .spaces[0].metrics.halstead.bugs
old: 0.005108729549290353
new: 0.1091794233628996
path: .spaces[0].metrics.halstead.length
old: 8.0
new: 79.0
path: .spaces[0].metrics.halstead.N1
old: 5.0
new: 51.0
path: .spaces[0].metrics.halstead.N2
old: 3.0
new: 28.0
path: .spaces[0].metrics.halstead.effort
old: 60.0
new: 5927.793639511103
path: .spaces[0].metrics.halstead.estimated_program_length
old: 16.36452797660028
new: 133.48686830125575
path: .spaces[0].metrics.halstead.time
old: 3.3333333333333335
new: 329.3218688617279
path: .spaces[0].metrics.halstead.n2
old: 3.0
new: 16.0
path: .spaces[0].metrics.halstead.volume
old: 24.0
new: 398.5071354293178
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 1.6666666666666667
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 7.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 1.75
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 23.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 20.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 6.0
path: .spaces[0].metrics.mi.mi_original
old: 154.24412008219068
new: 87.4588216022413
path: .spaces[0].metrics.mi.mi_visual_studio
old: 90.2012398141466
new: 51.14550970891304
path: .spaces[0].metrics.mi.mi_sei
old: 146.92819499625
new: 51.18829523136455
path: .spaces[0].metrics.nexits.average
old: 1.0
new: 0.3333333333333333
Code
class nsThreadSafeAutoRefCntRunner final : public Runnable {
public:
NS_IMETHOD Run() final {
for (int i = 0; i < 10000; i++) {
if (++sRefCnt == 1) {
sIncToOne++;
}
if (--sRefCnt == 0) {
sDecToZero++;
}
}
return NS_OK;
}
static ThreadSafeAutoRefCnt sRefCnt;
static Atomic sIncToOne;
static Atomic sDecToZero;
nsThreadSafeAutoRefCntRunner() : Runnable("nsThreadSafeAutoRefCntRunner") {}
private:
~nsThreadSafeAutoRefCntRunner() = default;
};