Global Metrics
path: .metrics.mi.mi_sei
old: 28.834010323295814
new: 54.47838847146867
path: .metrics.mi.mi_original
old: 57.639174335403936
new: 65.1360699264139
path: .metrics.mi.mi_visual_studio
old: 33.707119494388266
new: 38.09126896281514
path: .metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .metrics.cyclomatic.sum
old: 9.0
new: 10.0
path: .metrics.loc.lloc
old: 26.0
new: 17.0
path: .metrics.loc.ploc
old: 58.0
new: 38.0
path: .metrics.loc.sloc
old: 81.0
new: 63.0
path: .metrics.loc.blank
old: 17.0
new: 9.0
path: .metrics.loc.cloc
old: 6.0
new: 16.0
path: .metrics.nexits.average
old: 0.7142857142857143
new: 0.5
path: .metrics.nexits.sum
old: 5.0
new: 1.0
path: .metrics.halstead.n1
old: 15.0
new: 21.0
path: .metrics.halstead.volume
old: 2234.2984586335565
new: 1106.195813195846
path: .metrics.halstead.time
old: 3146.6369959089257
new: 1579.825629765332
path: .metrics.halstead.effort
old: 56639.46592636066
new: 28436.861335775975
path: .metrics.halstead.n2
old: 50.0
new: 29.0
path: .metrics.halstead.bugs
old: 0.4916146825142704
new: 0.3105511812120511
path: .metrics.halstead.N2
old: 169.0
new: 71.0
path: .metrics.halstead.difficulty
old: 25.35
new: 25.70689655172414
path: .metrics.halstead.purity_ratio
old: 0.9185880550481508
new: 1.189388340495171
path: .metrics.halstead.N1
old: 202.0
new: 125.0
path: .metrics.halstead.length
old: 371.0
new: 196.0
path: .metrics.halstead.vocabulary
old: 65.0
new: 50.0
path: .metrics.halstead.estimated_program_length
old: 340.79616842286396
new: 233.1201147370535
path: .metrics.halstead.level
old: 0.03944773175542406
new: 0.038900067069081154
path: .metrics.nom.total
old: 7.0
new: 2.0
path: .metrics.nom.functions
old: 7.0
new: 2.0
path: .metrics.nargs.sum
old: 16.0
new: 3.0
path: .metrics.nargs.average
old: 2.2857142857142856
new: 1.5
path: .metrics.cognitive.average
old: 0.0
new: 4.0
path: .metrics.cognitive.sum
old: 0.0
new: 8.0
Spaces Data
Minimal test - lines (10, 32)
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 5.0
new: 23.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 5.0
new: 18.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 3.0
new: 8.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 30.0
new: 96.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 19.0
new: 37.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 13.0
new: 35.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 5.85
new: 14.875
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 745.5112786093491
new: 7439.099406118141
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.17094017094017094
new: 0.06722689075630252
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 9.0
new: 17.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 10.0
new: 20.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 61.74860596185444
new: 155.92543019900302
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 2.058286865395148
new: 1.6242232312396148
path: .spaces[0].spaces[0].metrics.halstead.time
old: 41.41729325607495
new: 413.2833003398967
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 127.43782540330756
new: 500.1075231003792
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 17.0
new: 61.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.027406162220640837
new: 0.12702591151042264
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 119.4894370893849
new: 86.96791347012788
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 69.87686379496193
new: 50.85842892989935
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 96.78778619486108
new: 66.0466289845615
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 4.0
Code
namespace ClearOnShutdown_Internal {
Array,
static_cast(ShutdownPhase::ShutdownPhase_Length)>
sShutdownObservers;
ShutdownPhase sCurrentShutdownPhase = ShutdownPhase::NotInShutdown;
void InsertIntoShutdownList(ShutdownObserver* aObserver, ShutdownPhase aPhase) {
// Adding a ClearOnShutdown for a "past" phase is an error.
if (PastShutdownPhase(aPhase)) {
MOZ_ASSERT(false, "ClearOnShutdown for phase that already was cleared");
aObserver->Shutdown();
delete aObserver;
return;
}
if (!(sShutdownObservers[static_cast(aPhase)])) {
sShutdownObservers[static_cast(aPhase)] = new ShutdownList();
}
sShutdownObservers[static_cast(aPhase)]->insertBack(aObserver);
}
} // namespace ClearOnShutdown_Internal
Minimal test - lines (9, 63)
path: .spaces[0].metrics.nom.functions
old: 7.0
new: 2.0
path: .spaces[0].metrics.nom.total
old: 7.0
new: 2.0
path: .spaces[0].metrics.mi.mi_original
old: 60.56814293426615
new: 67.61957715375908
path: .spaces[0].metrics.mi.mi_sei
old: 12.495066330342668
new: 53.448633850242686
path: .spaces[0].metrics.mi.mi_visual_studio
old: 35.41996662822582
new: 39.54361237061935
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 4.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 8.0
path: .spaces[0].metrics.halstead.length
old: 368.0
new: 195.0
path: .spaces[0].metrics.halstead.effort
old: 58042.01237376278
new: 28740.29601456472
path: .spaces[0].metrics.halstead.N1
old: 202.0
new: 125.0
path: .spaces[0].metrics.halstead.time
old: 3224.556242986821
new: 1596.6831119202625
path: .spaces[0].metrics.halstead.N2
old: 166.0
new: 70.0
path: .spaces[0].metrics.halstead.level
old: 0.03775100401606426
new: 0.0380952380952381
path: .spaces[0].metrics.halstead.n1
old: 15.0
new: 21.0
path: .spaces[0].metrics.halstead.difficulty
old: 26.48936170212766
new: 26.25
path: .spaces[0].metrics.halstead.estimated_program_length
old: 319.66903496297675
new: 226.84460369596687
path: .spaces[0].metrics.halstead.bugs
old: 0.49969735761242784
new: 0.3127564223451925
path: .spaces[0].metrics.halstead.vocabulary
old: 62.0
new: 49.0
path: .spaces[0].metrics.halstead.n2
old: 47.0
new: 28.0
path: .spaces[0].metrics.halstead.volume
old: 2191.14424222237
new: 1094.8684196024656
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.8686658558776542
new: 1.1633056599793172
path: .spaces[0].metrics.nexits.average
old: 0.7142857142857143
new: 0.5
path: .spaces[0].metrics.nexits.sum
old: 5.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: 2.2857142857142856
new: 1.5
path: .spaces[0].metrics.nargs.sum
old: 16.0
new: 3.0
path: .spaces[0].metrics.loc.lloc
old: 26.0
new: 17.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 10.0
path: .spaces[0].metrics.loc.blank
old: 15.0
new: 8.0
path: .spaces[0].metrics.loc.ploc
old: 54.0
new: 37.0
path: .spaces[0].metrics.loc.sloc
old: 69.0
new: 55.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.25
path: .spaces[0].metrics.cyclomatic.sum
old: 8.0
new: 9.0
Code
namespace mozilla {
namespace ClearOnShutdown_Internal {
Array,
static_cast(ShutdownPhase::ShutdownPhase_Length)>
sShutdownObservers;
ShutdownPhase sCurrentShutdownPhase = ShutdownPhase::NotInShutdown;
void InsertIntoShutdownList(ShutdownObserver* aObserver, ShutdownPhase aPhase) {
// Adding a ClearOnShutdown for a "past" phase is an error.
if (PastShutdownPhase(aPhase)) {
MOZ_ASSERT(false, "ClearOnShutdown for phase that already was cleared");
aObserver->Shutdown();
delete aObserver;
return;
}
if (!(sShutdownObservers[static_cast(aPhase)])) {
sShutdownObservers[static_cast(aPhase)] = new ShutdownList();
}
sShutdownObservers[static_cast(aPhase)]->insertBack(aObserver);
}
} // namespace ClearOnShutdown_Internal
// Called when XPCOM is shutting down, after all shutdown notifications have
// been sent and after all threads' event loops have been purged.
void KillClearOnShutdown(ShutdownPhase aPhase) {
using namespace ClearOnShutdown_Internal;
MOZ_ASSERT(NS_IsMainThread());
// Shutdown only goes one direction...
MOZ_ASSERT(!PastShutdownPhase(aPhase));
// Set the phase before notifying observers to make sure that they can't run
// any code which isn't allowed to run after the start of this phase.
sCurrentShutdownPhase = aPhase;
// It's impossible to add an entry for a "past" phase; this is blocked in
// ClearOnShutdown, but clear them out anyways in case there are phases
// that weren't passed to KillClearOnShutdown.
for (size_t phase = static_cast(ShutdownPhase::First);
phase <= static_cast(aPhase); phase++) {
if (sShutdownObservers[static_cast(phase)]) {
while (ShutdownObserver* observer =
sShutdownObservers[static_cast(phase)]->popLast()) {
observer->Shutdown();
delete observer;
}
sShutdownObservers[static_cast(phase)] = nullptr;
}
}
}
} // namespace mozilla
Minimal test - lines (36, 61)
path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 69.53451349123948
new: 49.71258268147731
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 95.94320507878057
new: 81.2172778709014
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 118.9040180700195
new: 85.0085163853262
path: .spaces[0].spaces[1].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[0].spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 2.0132897544771895
new: 1.4901599827548184
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 19.0
new: 63.0
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 7.0
new: 18.0
path: .spaces[0].spaces[1].metrics.halstead.length
old: 33.0
new: 97.0
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 142.62362713128297
new: 497.54045264366175
path: .spaces[0].spaces[1].metrics.halstead.time
old: 55.46474388438782
new: 497.5404526436617
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.033296998761558366
new: 0.14375159760012693
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 14.0
new: 34.0
path: .spaces[0].spaces[1].metrics.halstead.n1
old: 10.0
new: 18.0
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 20.0
new: 35.0
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 66.43856189774725
new: 144.5455183272174
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.14285714285714285
new: 0.05555555555555555
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 998.3653899189808
new: 8955.72814758591
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 10.0
new: 17.0
path: .spaces[0].spaces[1].metrics.loc.lloc
old: 3.0
new: 9.0
path: .spaces[0].spaces[1].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[0].spaces[1].metrics.loc.sloc
old: 5.0
new: 26.0
path: .spaces[0].spaces[1].metrics.loc.ploc
old: 5.0
new: 17.0
path: .spaces[0].spaces[1].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[0].spaces[1].metrics.cognitive.sum
old: 0.0
new: 6.0
path: .spaces[0].spaces[1].metrics.cognitive.average
old: 0.0
new: 6.0
Code
void KillClearOnShutdown(ShutdownPhase aPhase) {
using namespace ClearOnShutdown_Internal;
MOZ_ASSERT(NS_IsMainThread());
// Shutdown only goes one direction...
MOZ_ASSERT(!PastShutdownPhase(aPhase));
// Set the phase before notifying observers to make sure that they can't run
// any code which isn't allowed to run after the start of this phase.
sCurrentShutdownPhase = aPhase;
// It's impossible to add an entry for a "past" phase; this is blocked in
// ClearOnShutdown, but clear them out anyways in case there are phases
// that weren't passed to KillClearOnShutdown.
for (size_t phase = static_cast(ShutdownPhase::First);
phase <= static_cast(aPhase); phase++) {
if (sShutdownObservers[static_cast(phase)]) {
while (ShutdownObserver* observer =
sShutdownObservers[static_cast(phase)]->popLast()) {
observer->Shutdown();
delete observer;
}
sShutdownObservers[static_cast(phase)] = nullptr;
}
}
}