Global Metrics
path: .metrics.mi.mi_sei
old: 80.90327420749804
new: 40.98894487277423
path: .metrics.mi.mi_original
old: 82.19312757080608
new: 50.30085361761073
path: .metrics.mi.mi_visual_studio
old: 48.066156474155605
new: 29.41570386994779
path: .metrics.cognitive.average
old: 0.0
new: 0.07692307692307693
path: .metrics.cognitive.sum
old: 0.0
new: 1.0
path: .metrics.cyclomatic.average
old: 1.0
new: 1.0588235294117647
path: .metrics.cyclomatic.sum
old: 5.0
new: 18.0
path: .metrics.halstead.time
old: 65.62535730260053
new: 1429.7698283152797
path: .metrics.halstead.n2
old: 19.0
new: 36.0
path: .metrics.halstead.purity_ratio
old: 2.5893159932795853
new: 1.2556536061436772
path: .metrics.halstead.bugs
old: 0.0372484497658234
new: 0.29056134294297764
path: .metrics.halstead.n1
old: 10.0
new: 18.0
path: .metrics.halstead.vocabulary
old: 29.0
new: 54.0
path: .metrics.halstead.estimated_program_length
old: 113.92990370430176
new: 261.17595007788486
path: .metrics.halstead.length
old: 44.0
new: 208.0
path: .metrics.halstead.N2
old: 21.0
new: 86.0
path: .metrics.halstead.N1
old: 23.0
new: 122.0
path: .metrics.halstead.effort
old: 1181.2564314468095
new: 25735.85690967503
path: .metrics.halstead.volume
old: 213.75116378561316
new: 1197.0166004500013
path: .metrics.halstead.level
old: 0.18095238095238095
new: 0.046511627906976744
path: .metrics.halstead.difficulty
old: 5.526315789473684
new: 21.5
path: .metrics.nom.functions
old: 1.0
new: 13.0
path: .metrics.nom.total
old: 1.0
new: 13.0
path: .metrics.nargs.sum
old: 0.0
new: 6.0
path: .metrics.nargs.average
old: 0.0
new: 0.4615384615384616
path: .metrics.loc.blank
old: 6.0
new: 15.0
path: .metrics.loc.cloc
old: 12.0
new: 58.0
path: .metrics.loc.ploc
old: 22.0
new: 64.0
path: .metrics.loc.lloc
old: 0.0
new: 9.0
path: .metrics.loc.sloc
old: 40.0
new: 137.0
path: .metrics.nexits.average
old: 0.0
new: 0.07692307692307693
path: .metrics.nexits.sum
old: 0.0
new: 1.0
Spaces Data
Minimal test - lines (40, 41)
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n1
old: 10.0
new: 7.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N2
old: 14.0
new: 9.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.bugs
old: 0.029395995827303116
new: 0.01686225011146998
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.vocabulary
old: 23.0
new: 14.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.volume
old: 153.80110650593844
new: 79.9544533632097
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.time
old: 46.008878014596974
new: 19.988613340802424
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.length
old: 34.0
new: 21.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.N1
old: 20.0
new: 12.0
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 2.391911684844348
new: 1.8715699480384027
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.level
old: 0.1857142857142857
new: 0.2222222222222222
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 81.32499728470782
new: 39.302968908806456
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.effort
old: 828.1598042627455
new: 359.79504013444364
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.difficulty
old: 5.384615384615385
new: 4.5
path: .spaces[0].spaces[0].spaces[0].metrics.halstead.n2
old: 13.0
new: 7.0
path: .spaces[0].spaces[0].spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].spaces[0].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_original
old: 100.48415343438268
new: 136.75743854910016
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_sei
old: 88.9416946899383
new: 121.70024626685564
path: .spaces[0].spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 58.76266282712437
new: 79.97511026263167
path: .spaces[0].spaces[0].spaces[0].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.ploc
old: 12.0
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.sloc
old: 15.0
new: 2.0
path: .spaces[0].spaces[0].spaces[0].metrics.loc.blank
old: 2.0
new: 0.0
Code
OffTheBooksCondVar(OffTheBooksMutex& aLock, const char* aName)
: BlockingResourceBase(aName, eCondVar), mLock(&aLock) {}
Minimal test - lines (27, 113)
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 0.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 0.0
new: 0.3333333333333333
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: 0.08333333333333333
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 3.0
new: 13.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 90.23279709869324
new: 56.55458026751417
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 93.5398730895066
new: 60.91491340056997
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 54.701680169302115
new: 35.622756374602325
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 4.0
new: 39.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 22.0
new: 87.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 4.0
new: 8.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 14.0
new: 40.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 0.0
new: 8.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 2.338439185342705
new: 1.2581853558896512
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 22.0
new: 90.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 5.357142857142857
new: 17.846153846153847
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 14.0
new: 26.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 10.0
new: 16.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 169.64361252668277
new: 798.0629785712566
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 908.8050671072292
new: 14242.354694502426
path: .spaces[0].spaces[0].metrics.halstead.length
old: 37.0
new: 148.0
path: .spaces[0].spaces[0].metrics.halstead.time
old: 50.48917039484606
new: 791.241927472357
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.18666666666666668
new: 0.05603448275862069
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.03127465818742369
new: 0.19585437480070325
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 15.0
new: 58.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 24.0
new: 42.0
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 86.52224985768008
new: 186.2114326716684
path: .spaces[0].spaces[0].metrics.nom.total
old: 1.0
new: 12.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 1.0
new: 12.0
Code
class OffTheBooksCondVar : BlockingResourceBase {
public:
/**
* OffTheBooksCondVar
*
* The CALLER owns |aLock|.
*
* @param aLock A Mutex to associate with this condition variable.
* @param aName A name which can reference this monitor
* @returns If failure, nullptr.
* If success, a valid Monitor* which must be destroyed
* by Monitor::DestroyMonitor()
**/
OffTheBooksCondVar(OffTheBooksMutex& aLock, const char* aName)
: BlockingResourceBase(aName, eCondVar), mLock(&aLock) {}
/**
* ~OffTheBooksCondVar
* Clean up after this OffTheBooksCondVar, but NOT its associated Mutex.
**/
~OffTheBooksCondVar() = default;
/**
* Wait
* @see prcvar.h
**/
#ifndef DEBUG
void Wait() {
# ifdef MOZILLA_INTERNAL_API
AUTO_PROFILER_THREAD_SLEEP;
# endif // MOZILLA_INTERNAL_API
mImpl.wait(*mLock);
}
CVStatus Wait(TimeDuration aDuration) {
# ifdef MOZILLA_INTERNAL_API
AUTO_PROFILER_THREAD_SLEEP;
# endif // MOZILLA_INTERNAL_API
return mImpl.wait_for(*mLock, aDuration);
}
#else
// NOTE: debug impl is in BlockingResourceBase.cpp
void Wait();
CVStatus Wait(TimeDuration aDuration);
#endif
/**
* Notify
* @see prcvar.h
**/
void Notify() { mImpl.notify_one(); }
/**
* NotifyAll
* @see prcvar.h
**/
void NotifyAll() { mImpl.notify_all(); }
#ifdef DEBUG
/**
* AssertCurrentThreadOwnsMutex
* @see Mutex::AssertCurrentThreadOwns
**/
void AssertCurrentThreadOwnsMutex() { mLock->AssertCurrentThreadOwns(); }
/**
* AssertNotCurrentThreadOwnsMutex
* @see Mutex::AssertNotCurrentThreadOwns
**/
void AssertNotCurrentThreadOwnsMutex() {
mLock->AssertNotCurrentThreadOwns();
}
#else
void AssertCurrentThreadOwnsMutex() {}
void AssertNotCurrentThreadOwnsMutex() {}
#endif // ifdef DEBUG
private:
OffTheBooksCondVar();
OffTheBooksCondVar(const OffTheBooksCondVar&) = delete;
OffTheBooksCondVar& operator=(const OffTheBooksCondVar&) = delete;
OffTheBooksMutex* mLock;
detail::ConditionVariableImpl mImpl;
};
Minimal test - lines (19, 135)
path: .spaces[0].metrics.mi.mi_visual_studio
old: 53.54396075254491
new: 31.50073993832539
path: .spaces[0].metrics.mi.mi_original
old: 91.5601728868518
new: 53.86626529453642
path: .spaces[0].metrics.mi.mi_sei
old: 89.2816817664054
new: 46.05514092919787
path: .spaces[0].metrics.nom.total
old: 1.0
new: 13.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 13.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 0.07692307692307693
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 16.0
new: 54.0
path: .spaces[0].metrics.loc.blank
old: 3.0
new: 13.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 9.0
path: .spaces[0].metrics.loc.cloc
old: 5.0
new: 50.0
path: .spaces[0].metrics.loc.sloc
old: 24.0
new: 117.0
path: .spaces[0].metrics.halstead.time
old: 53.662338192952376
new: 1228.6856706695714
path: .spaces[0].metrics.halstead.vocabulary
old: 25.0
new: 46.0
path: .spaces[0].metrics.halstead.effort
old: 965.9220874731428
new: 22116.342072052284
path: .spaces[0].metrics.halstead.n2
old: 15.0
new: 30.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 2.354426663666703
new: 1.083111373683362
path: .spaces[0].metrics.halstead.N2
old: 16.0
new: 77.0
path: .spaces[0].metrics.halstead.difficulty
old: 5.333333333333333
new: 20.533333333333335
path: .spaces[0].metrics.halstead.length
old: 39.0
new: 195.0
path: .spaces[0].metrics.halstead.level
old: 0.1875
new: 0.0487012987012987
path: .spaces[0].metrics.halstead.volume
old: 181.11039140121423
new: 1077.0945814311176
path: .spaces[0].metrics.halstead.n1
old: 10.0
new: 16.0
path: .spaces[0].metrics.halstead.N1
old: 23.0
new: 118.0
path: .spaces[0].metrics.halstead.bugs
old: 0.0325716787930348
new: 0.26263601345647686
path: .spaces[0].metrics.halstead.estimated_program_length
old: 91.8226398830014
new: 211.20671786825557
path: .spaces[0].metrics.nargs.average
old: 0.0
new: 0.4615384615384616
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 6.0
path: .spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 16.0
Code
namespace mozilla {
/**
* Similarly to OffTheBooksMutex, OffTheBooksCondvar is identical to CondVar,
* except that OffTheBooksCondVar doesn't include leak checking. Sometimes
* you want to intentionally "leak" a CondVar until shutdown; in these cases,
* OffTheBooksCondVar is for you.
*/
class OffTheBooksCondVar : BlockingResourceBase {
public:
/**
* OffTheBooksCondVar
*
* The CALLER owns |aLock|.
*
* @param aLock A Mutex to associate with this condition variable.
* @param aName A name which can reference this monitor
* @returns If failure, nullptr.
* If success, a valid Monitor* which must be destroyed
* by Monitor::DestroyMonitor()
**/
OffTheBooksCondVar(OffTheBooksMutex& aLock, const char* aName)
: BlockingResourceBase(aName, eCondVar), mLock(&aLock) {}
/**
* ~OffTheBooksCondVar
* Clean up after this OffTheBooksCondVar, but NOT its associated Mutex.
**/
~OffTheBooksCondVar() = default;
/**
* Wait
* @see prcvar.h
**/
#ifndef DEBUG
void Wait() {
# ifdef MOZILLA_INTERNAL_API
AUTO_PROFILER_THREAD_SLEEP;
# endif // MOZILLA_INTERNAL_API
mImpl.wait(*mLock);
}
CVStatus Wait(TimeDuration aDuration) {
# ifdef MOZILLA_INTERNAL_API
AUTO_PROFILER_THREAD_SLEEP;
# endif // MOZILLA_INTERNAL_API
return mImpl.wait_for(*mLock, aDuration);
}
#else
// NOTE: debug impl is in BlockingResourceBase.cpp
void Wait();
CVStatus Wait(TimeDuration aDuration);
#endif
/**
* Notify
* @see prcvar.h
**/
void Notify() { mImpl.notify_one(); }
/**
* NotifyAll
* @see prcvar.h
**/
void NotifyAll() { mImpl.notify_all(); }
#ifdef DEBUG
/**
* AssertCurrentThreadOwnsMutex
* @see Mutex::AssertCurrentThreadOwns
**/
void AssertCurrentThreadOwnsMutex() { mLock->AssertCurrentThreadOwns(); }
/**
* AssertNotCurrentThreadOwnsMutex
* @see Mutex::AssertNotCurrentThreadOwns
**/
void AssertNotCurrentThreadOwnsMutex() {
mLock->AssertNotCurrentThreadOwns();
}
#else
void AssertCurrentThreadOwnsMutex() {}
void AssertNotCurrentThreadOwnsMutex() {}
#endif // ifdef DEBUG
private:
OffTheBooksCondVar();
OffTheBooksCondVar(const OffTheBooksCondVar&) = delete;
OffTheBooksCondVar& operator=(const OffTheBooksCondVar&) = delete;
OffTheBooksMutex* mLock;
detail::ConditionVariableImpl mImpl;
};
/**
* CondVar
* Vanilla condition variable. Please don't use this unless you have a
* compelling reason --- Monitor provides a simpler API.
*/
class CondVar : public OffTheBooksCondVar {
public:
CondVar(OffTheBooksMutex& aLock, const char* aName)
: OffTheBooksCondVar(aLock, aName) {
MOZ_COUNT_CTOR(CondVar);
}
MOZ_COUNTED_DTOR(CondVar)
private:
CondVar();
CondVar(const CondVar&);
CondVar& operator=(const CondVar&);
};
} // namespace mozilla