Global Metrics
path: .metrics.nom.total
old: 0.0
new: 3.0
path: .metrics.nom.functions
old: 0.0
new: 3.0
path: .metrics.mi.mi_sei
old: 39.3915502845437
new: 36.6798428908176
path: .metrics.mi.mi_original
old: 62.682884944284
new: 58.56408689061831
path: .metrics.mi.mi_visual_studio
old: 36.65665786215438
new: 34.248004029601354
path: .metrics.nargs.average
old: null
new: 1.3333333333333333
path: .metrics.nargs.sum
old: 0.0
new: 4.0
path: .metrics.cyclomatic.sum
old: 5.0
new: 10.0
path: .metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .metrics.halstead.bugs
old: 0.08797763511458057
new: 0.4082612642519561
path: .metrics.halstead.n2
old: 56.0
new: 54.0
path: .metrics.halstead.length
old: 145.0
new: 274.0
path: .metrics.halstead.n1
old: 8.0
new: 24.0
path: .metrics.halstead.purity_ratio
old: 2.408357763001557
new: 1.5357774639931936
path: .metrics.halstead.level
old: 0.20289855072463767
new: 0.040178571428571425
path: .metrics.halstead.vocabulary
old: 64.0
new: 78.0
path: .metrics.halstead.N1
old: 76.0
new: 162.0
path: .metrics.halstead.estimated_program_length
old: 349.2118756352258
new: 420.80302513413505
path: .metrics.halstead.volume
old: 870.0
new: 1722.200207968256
path: .metrics.halstead.time
old: 238.21428571428572
new: 2381.313867807959
path: .metrics.halstead.N2
old: 69.0
new: 112.0
path: .metrics.halstead.difficulty
old: 4.928571428571429
new: 24.88888888888889
path: .metrics.halstead.effort
old: 4287.857142857143
new: 42863.64962054326
path: .metrics.nexits.average
old: null
new: 0.3333333333333333
path: .metrics.nexits.sum
old: 0.0
new: 1.0
path: .metrics.cognitive.sum
old: 0.0
new: 9.0
path: .metrics.cognitive.average
old: null
new: 3.0
path: .metrics.loc.cloc
old: 9.0
new: 11.0
path: .metrics.loc.ploc
old: 60.0
new: 54.0
path: .metrics.loc.blank
old: 16.0
new: 17.0
path: .metrics.loc.sloc
old: 85.0
new: 82.0
path: .metrics.loc.lloc
old: 0.0
new: 12.0
Spaces Data
Minimal test - lines (64, 82)
path: .spaces[2].metrics.cognitive.average
old: null
new: 2.0
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[2].metrics.nexits.average
old: null
new: 0.0
path: .spaces[2].metrics.halstead.difficulty
old: 1.5
new: 15.11111111111111
path: .spaces[2].metrics.halstead.N1
old: 3.0
new: 62.0
path: .spaces[2].metrics.halstead.n1
old: 3.0
new: 17.0
path: .spaces[2].metrics.halstead.bugs
old: 0.002239505320238735
new: 0.14502284536501403
path: .spaces[2].metrics.halstead.time
old: 0.9674700395364008
new: 504.15491984453064
path: .spaces[2].metrics.halstead.effort
old: 17.414460711655217
new: 9074.788557201551
path: .spaces[2].metrics.halstead.n2
old: 2.0
new: 27.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.3509775004326936
new: 1.798807553269722
path: .spaces[2].metrics.halstead.N2
old: 2.0
new: 48.0
path: .spaces[2].metrics.halstead.level
old: 0.6666666666666666
new: 0.0661764705882353
path: .spaces[2].metrics.halstead.length
old: 5.0
new: 110.0
path: .spaces[2].metrics.halstead.volume
old: 11.60964047443681
new: 600.5374780501027
path: .spaces[2].metrics.halstead.vocabulary
old: 5.0
new: 44.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 6.754887502163468
new: 197.8688308596694
path: .spaces[2].metrics.nargs.average
old: null
new: 2.0
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[2].metrics.mi.mi_original
old: 140.22293461619367
new: 89.3413982724084
path: .spaces[2].metrics.mi.mi_sei
old: 126.6999002570717
new: 70.89570681025234
path: .spaces[2].metrics.mi.mi_visual_studio
old: 82.00171614982087
new: 52.24643173825053
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.lloc
old: 0.0
new: 5.0
path: .spaces[2].metrics.loc.sloc
old: 3.0
new: 19.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[2].metrics.loc.ploc
old: 3.0
new: 15.0
path: .spaces[2].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[2].metrics.nom.functions
old: 0.0
new: 1.0
Code
TEST(RWLock, SmokeTest)
{
nsCOMPtr threads[sNumThreads];
RWLock rwlock("test lock");
mozilla::Atomic data(0);
for (size_t i = 0; i < sNumThreads; ++i) {
nsCOMPtr event = new RWLockRunnable(&rwlock, &data);
NS_NewNamedThread("RWLockTester", getter_AddRefs(threads[i]), event);
}
// Wait for all the threads to finish.
for (size_t i = 0; i < sNumThreads; ++i) {
nsresult rv = threads[i]->Shutdown();
EXPECT_TRUE(NS_SUCCEEDED(rv));
}
EXPECT_EQ(data, (sOuterIterations / sWriteLockIteration) * sNumThreads);
}
Minimal test - lines (23, 37)
path: .spaces[0].metrics.loc.sloc
old: 10.0
new: 15.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[0].metrics.loc.ploc
old: 10.0
new: 12.0
path: .spaces[0].metrics.halstead.volume
old: 96.2114326716684
new: 247.58797503894243
path: .spaces[0].metrics.halstead.bugs
old: 0.009171155120168624
new: 0.06302187353766961
path: .spaces[0].metrics.halstead.effort
old: 144.3171490075026
new: 2599.6737379088954
path: .spaces[0].metrics.halstead.length
old: 26.0
new: 54.0
path: .spaces[0].metrics.halstead.vocabulary
old: 13.0
new: 24.0
path: .spaces[0].metrics.halstead.n2
old: 10.0
new: 12.0
path: .spaces[0].metrics.halstead.difficulty
old: 1.5
new: 10.5
path: .spaces[0].metrics.halstead.n1
old: 3.0
new: 12.0
path: .spaces[0].metrics.halstead.time
old: 8.0176193893057
new: 144.4263187727164
path: .spaces[0].metrics.halstead.level
old: 0.6666666666666666
new: 0.09523809523809525
path: .spaces[0].metrics.halstead.estimated_program_length
old: 37.974168451037094
new: 86.03910001730775
path: .spaces[0].metrics.halstead.N1
old: 16.0
new: 33.0
path: .spaces[0].metrics.halstead.N2
old: 10.0
new: 21.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4605449404245037
new: 1.5933166669871806
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].metrics.mi.mi_original
old: 109.72207088806992
new: 98.00840367967126
path: .spaces[0].metrics.mi.mi_visual_studio
old: 64.16495373571341
new: 57.31485595302413
path: .spaces[0].metrics.mi.mi_sei
old: 82.6964554136775
new: 65.89902568090156
path: .spaces[0].metrics.nargs.average
old: null
new: 2.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
Code
class RWLockRunnable : public mozilla::Runnable {
public:
RWLockRunnable(RWLock* aRWLock, mozilla::Atomic* aSharedData)
: mozilla::Runnable("RWLockRunnable"),
mRWLock(aRWLock),
mSharedData(aSharedData) {}
NS_DECL_NSIRUNNABLE
private:
~RWLockRunnable() = default;
RWLock* mRWLock;
mozilla::Atomic* mSharedData;
};
Minimal test - lines (40, 62)
path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[1].metrics.nexits.average
old: null
new: 1.0
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[1].metrics.halstead.length
old: 13.0
new: 81.0
path: .spaces[1].metrics.halstead.N1
old: 7.0
new: 52.0
path: .spaces[1].metrics.halstead.effort
old: 86.37013046707142
new: 5576.132605352003
path: .spaces[1].metrics.halstead.vocabulary
old: 10.0
new: 33.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 23.509775004326936
new: 133.48686830125575
path: .spaces[1].metrics.halstead.level
old: 0.5
new: 0.07327586206896552
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.808444231102072
new: 1.647986028410565
path: .spaces[1].metrics.halstead.difficulty
old: 2.0
new: 13.647058823529411
path: .spaces[1].metrics.halstead.volume
old: 43.18506523353571
new: 408.59592366803474
path: .spaces[1].metrics.halstead.N2
old: 6.0
new: 29.0
path: .spaces[1].metrics.halstead.bugs
old: 0.006513100741703149
new: 0.10481758291654523
path: .spaces[1].metrics.halstead.time
old: 4.798340581503968
new: 309.78514474177797
path: .spaces[1].metrics.halstead.n1
old: 4.0
new: 16.0
path: .spaces[1].metrics.halstead.n2
old: 6.0
new: 17.0
path: .spaces[1].metrics.mi.mi_sei
old: 104.90596993113904
new: 78.22898255849393
path: .spaces[1].metrics.mi.mi_original
old: 125.11653325745355
new: 88.01881483077315
path: .spaces[1].metrics.mi.mi_visual_studio
old: 73.16756330845239
new: 51.47299112910711
path: .spaces[1].metrics.cognitive.average
old: null
new: 7.0
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 7.0
path: .spaces[1].metrics.nargs.average
old: null
new: 0.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 7.0
path: .spaces[1].metrics.loc.ploc
old: 5.0
new: 16.0
path: .spaces[1].metrics.loc.sloc
old: 5.0
new: 23.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 4.0
path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0
Code
RWLockRunnable::Run() {
for (size_t i = 0; i < sOuterIterations; ++i) {
if (i % sWriteLockIteration == 0) {
mozilla::AutoWriteLock lock(*mRWLock);
++(*mSharedData);
} else {
mozilla::AutoReadLock lock(*mRWLock);
// Loop and try to force other threads to run, but check that our
// shared data isn't being modified by them.
size_t initialValue = *mSharedData;
for (size_t j = 0; j < sInnerIterations; ++j) {
EXPECT_EQ(initialValue, *mSharedData);
// This is a magic yield call.
PR_Sleep(PR_INTERVAL_NO_WAIT);
}
}
}
return NS_OK;
}