Global Metrics

path: .metrics.halstead.bugs
old: 0.4829414793551287
new: 0.20490774443626905

path: .metrics.halstead.n2
old: 70.0
new: 38.0

path: .metrics.halstead.difficulty
old: 15.771428571428572
new: 14.36842105263158

path: .metrics.halstead.n1
old: 12.0
new: 13.0

path: .metrics.halstead.purity_ratio
old: 0.8583079294450936
new: 1.3236735927630503

path: .metrics.halstead.length
old: 550.0
new: 187.0

path: .metrics.halstead.effort
old: 55147.222531487154
new: 15241.20979647299

path: .metrics.halstead.volume
old: 3496.653602539946
new: 1060.7435389486695

path: .metrics.halstead.estimated_program_length
old: 472.0693611948015
new: 247.52696184669043

path: .metrics.halstead.N2
old: 184.0
new: 84.0

path: .metrics.halstead.time
old: 3063.7345850826196
new: 846.7338775818328

path: .metrics.halstead.N1
old: 366.0
new: 103.0

path: .metrics.halstead.level
old: 0.06340579710144927
new: 0.0695970695970696

path: .metrics.halstead.vocabulary
old: 82.0
new: 51.0

path: .metrics.nom.total
old: 1.0
new: 7.0

path: .metrics.nom.functions
old: 1.0
new: 7.0

path: .metrics.nexits.average
old: 1.0
new: 0.14285714285714285

path: .metrics.cyclomatic.sum
old: 2.0
new: 9.0

path: .metrics.nargs.average
old: 1.0
new: 0.14285714285714285

path: .metrics.loc.lloc
old: 1.0
new: 12.0

path: .metrics.loc.sloc
old: 112.0
new: 87.0

path: .metrics.loc.ploc
old: 75.0
new: 68.0

path: .metrics.loc.blank
old: 14.0
new: 13.0

path: .metrics.loc.cloc
old: 23.0
new: 6.0

path: .metrics.mi.mi_visual_studio
old: 30.21672372337004
new: 35.29550668653609

path: .metrics.mi.mi_sei
old: 31.33645170441979
new: 32.07521734885345

path: .metrics.mi.mi_original
old: 51.67059756696277
new: 60.35531643397671

Spaces Data

Minimal test - lines (19, 85)

path: .spaces[0].metrics.nom.functions
old: 1.0
new: 7.0

path: .spaces[0].metrics.nom.total
old: 1.0
new: 7.0

path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 8.0

path: .spaces[0].metrics.mi.mi_visual_studio
old: 69.79307396284685
new: 38.34703502871919

path: .spaces[0].metrics.mi.mi_sei
old: 141.03767817151473
new: 19.716169012748736

path: .spaces[0].metrics.mi.mi_original
old: 119.34615647646812
new: 65.57342989910981

path: .spaces[0].metrics.nexits.average
old: 1.0
new: 0.14285714285714285

path: .spaces[0].metrics.loc.cloc
old: 3.0
new: 0.0

path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 12.0

path: .spaces[0].metrics.loc.blank
old: 0.0
new: 8.0

path: .spaces[0].metrics.loc.ploc
old: 3.0
new: 59.0

path: .spaces[0].metrics.loc.sloc
old: 6.0
new: 67.0

path: .spaces[0].metrics.halstead.length
old: 19.0
new: 167.0

path: .spaces[0].metrics.halstead.n1
old: 8.0
new: 11.0

path: .spaces[0].metrics.halstead.difficulty
old: 5.142857142857143
new: 12.294117647058824

path: .spaces[0].metrics.halstead.purity_ratio
old: 2.297446550231749
new: 1.2636376311827653

path: .spaces[0].metrics.halstead.estimated_program_length
old: 43.65148445440323
new: 211.0274844075218

path: .spaces[0].metrics.halstead.bugs
old: 0.017541697587933284
new: 0.16761025119137485

path: .spaces[0].metrics.halstead.N2
old: 9.0
new: 76.0

path: .spaces[0].metrics.halstead.effort
old: 381.7590239137467
new: 11275.420507129096

path: .spaces[0].metrics.halstead.vocabulary
old: 15.0
new: 45.0

path: .spaces[0].metrics.halstead.level
old: 0.1944444444444444
new: 0.08133971291866028

path: .spaces[0].metrics.halstead.volume
old: 74.23092131656186
new: 917.1394670870556

path: .spaces[0].metrics.halstead.n2
old: 7.0
new: 34.0

path: .spaces[0].metrics.halstead.time
old: 21.208834661874818
new: 626.4122503960609

path: .spaces[0].metrics.halstead.N1
old: 10.0
new: 91.0

path: .spaces[0].metrics.nargs.average
old: 1.0
new: 0.14285714285714285

Code

namespace mozilla {

RWLock::RWLock(const char* aName)
    : BlockingResourceBase(aName, eMutex)
#ifdef DEBUG
      ,
      mOwningThread(nullptr)
#endif
{
#ifdef XP_WIN
  InitializeSRWLock(NativeHandle(mRWLock));
#else
  MOZ_RELEASE_ASSERT(pthread_rwlock_init(NativeHandle(mRWLock), nullptr) == 0,
                     "pthread_rwlock_init failed");
#endif
}

#ifdef DEBUG
bool RWLock::LockedForWritingByCurrentThread() {
  return mOwningThread == PR_GetCurrentThread();
}
#endif

#ifndef XP_WIN
RWLock::~RWLock() {
  MOZ_RELEASE_ASSERT(pthread_rwlock_destroy(NativeHandle(mRWLock)) == 0,
                     "pthread_rwlock_destroy failed");
}
#endif

void RWLock::ReadLockInternal() {
#ifdef XP_WIN
  AcquireSRWLockShared(NativeHandle(mRWLock));
#else
  MOZ_RELEASE_ASSERT(pthread_rwlock_rdlock(NativeHandle(mRWLock)) == 0,
                     "pthread_rwlock_rdlock failed");
#endif
}

void RWLock::ReadUnlockInternal() {
#ifdef XP_WIN
  ReleaseSRWLockShared(NativeHandle(mRWLock));
#else
  MOZ_RELEASE_ASSERT(pthread_rwlock_unlock(NativeHandle(mRWLock)) == 0,
                     "pthread_rwlock_unlock failed");
#endif
}

void RWLock::WriteLockInternal() {
#ifdef XP_WIN
  AcquireSRWLockExclusive(NativeHandle(mRWLock));
#else
  MOZ_RELEASE_ASSERT(pthread_rwlock_wrlock(NativeHandle(mRWLock)) == 0,
                     "pthread_rwlock_wrlock failed");
#endif
}

void RWLock::WriteUnlockInternal() {
#ifdef XP_WIN
  ReleaseSRWLockExclusive(NativeHandle(mRWLock));
#else
  MOZ_RELEASE_ASSERT(pthread_rwlock_unlock(NativeHandle(mRWLock)) == 0,
                     "pthread_rwlock_unlock failed");
#endif
}

}  // namespace mozilla