Global Metrics

path: .metrics.nom.total
old: 42.0
new: 20.0

path: .metrics.nom.functions
old: 42.0
new: 20.0

path: .metrics.halstead.estimated_program_length
old: 2960.037996800253
new: 1115.5823128530003

path: .metrics.halstead.length
old: 3558.0
new: 958.0

path: .metrics.halstead.vocabulary
old: 367.0
new: 166.0

path: .metrics.halstead.difficulty
old: 76.37801204819277
new: 42.507246376811594

path: .metrics.halstead.level
old: 0.013092773341220543
new: 0.0235254006137061

path: .metrics.halstead.time
old: 128624.24601898872
new: 16684.77378804398

path: .metrics.halstead.purity_ratio
old: 0.8319387287240734
new: 1.1644909319968688

path: .metrics.halstead.n2
old: 332.0
new: 138.0

path: .metrics.halstead.n1
old: 35.0
new: 28.0

path: .metrics.halstead.volume
old: 30312.865787616152
new: 7065.287775230354

path: .metrics.halstead.N1
old: 2109.0
new: 539.0

path: .metrics.halstead.effort
old: 2315236.428341797
new: 300325.9281847917

path: .metrics.halstead.N2
old: 1449.0
new: 419.0

path: .metrics.halstead.bugs
old: 5.833676068432277
new: 1.494883324234945

path: .metrics.mi.mi_original
old: -28.86093663491316
new: 23.574927482469377

path: .metrics.mi.mi_sei
old: -75.81952359280164
new: -13.099376949396976

path: .metrics.mi.mi_visual_studio
old: 0.0
new: 13.786507299689692

path: .metrics.nargs.sum
old: 20.0
new: 16.0

path: .metrics.nargs.average
old: 0.47619047619047616
new: 0.8

path: .metrics.cyclomatic.average
old: 3.6511627906976742
new: 1.434782608695652

path: .metrics.cyclomatic.sum
old: 157.0
new: 33.0

path: .metrics.loc.sloc
old: 894.0
new: 326.0

path: .metrics.loc.ploc
old: 637.0
new: 232.0

path: .metrics.loc.cloc
old: 107.0
new: 38.0

path: .metrics.loc.blank
old: 150.0
new: 56.0

path: .metrics.loc.lloc
old: 283.0
new: 80.0

path: .metrics.nexits.sum
old: 63.0
new: 8.0

path: .metrics.nexits.average
old: 1.5
new: 0.4

path: .metrics.cognitive.average
old: 3.3095238095238093
new: 0.6

path: .metrics.cognitive.sum
old: 139.0
new: 12.0

Spaces Data

Minimal test - lines (56, 56)

path: .spaces[2].metrics.cognitive.average
old: 10.0
new: 0.0

path: .spaces[2].metrics.cognitive.sum
old: 10.0
new: 0.0

path: .spaces[2].metrics.halstead.n1
old: 16.0
new: 6.0

path: .spaces[2].metrics.halstead.level
old: 0.0625
new: 0.3333333333333333

path: .spaces[2].metrics.halstead.N2
old: 58.0
new: 2.0

path: .spaces[2].metrics.halstead.N1
old: 85.0
new: 6.0

path: .spaces[2].metrics.halstead.length
old: 143.0
new: 8.0

path: .spaces[2].metrics.halstead.estimated_program_length
old: 204.88144885869957
new: 17.509775004326936

path: .spaces[2].metrics.halstead.n2
old: 29.0
new: 2.0

path: .spaces[2].metrics.halstead.purity_ratio
old: 1.4327374046062906
new: 2.188721875540867

path: .spaces[2].metrics.halstead.time
old: 698.0755491334609
new: 4.0

path: .spaces[2].metrics.halstead.effort
old: 12565.359884402296
new: 72.0

path: .spaces[2].metrics.halstead.bugs
old: 0.18016151826913984
new: 0.0057689982812296325

path: .spaces[2].metrics.halstead.difficulty
old: 16.0
new: 3.0

path: .spaces[2].metrics.halstead.volume
old: 785.3349927751435
new: 24.0

path: .spaces[2].metrics.halstead.vocabulary
old: 45.0
new: 8.0

path: .spaces[2].metrics.nexits.sum
old: 2.0
new: 0.0

path: .spaces[2].metrics.nexits.average
old: 2.0
new: 0.0

path: .spaces[2].metrics.cyclomatic.sum
old: 6.0
new: 1.0

path: .spaces[2].metrics.cyclomatic.average
old: 6.0
new: 1.0

path: .spaces[2].metrics.mi.mi_original
old: 78.8113044551035
new: 154.24412008219068

path: .spaces[2].metrics.mi.mi_visual_studio
old: 46.088482137487425
new: 90.2012398141466

path: .spaces[2].metrics.mi.mi_sei
old: 38.61074526778209
new: 146.92819499625

path: .spaces[2].metrics.loc.blank
old: 4.0
new: 0.0

path: .spaces[2].metrics.loc.lloc
old: 13.0
new: 1.0

path: .spaces[2].metrics.loc.ploc
old: 28.0
new: 1.0

path: .spaces[2].metrics.loc.sloc
old: 32.0
new: 1.0

Code

  void TearDown() final { ::_gdb_sleep_duration = mOldSleepDuration; }

Minimal test - lines (106, 116)

path: .spaces[7].metrics.cognitive.sum
old: 3.0
new: 0.0

path: .spaces[7].metrics.cognitive.average
old: 3.0
new: 0.0

path: .spaces[7].metrics.halstead.vocabulary
old: 39.0
new: 20.0

path: .spaces[7].metrics.halstead.volume
old: 544.3964285428116
new: 121.01398665684616

path: .spaces[7].metrics.halstead.N2
old: 38.0
new: 15.0

path: .spaces[7].metrics.halstead.n1
old: 18.0
new: 7.0

path: .spaces[7].metrics.halstead.bugs
old: 0.14278857663588265
new: 0.020681391614985965

path: .spaces[7].metrics.halstead.difficulty
old: 16.285714285714285
new: 4.038461538461538

path: .spaces[7].metrics.halstead.n2
old: 21.0
new: 13.0

path: .spaces[7].metrics.halstead.purity_ratio
old: 1.624245785478792
new: 2.419900028222765

path: .spaces[7].metrics.halstead.time
old: 492.5491496339724
new: 27.150573929420613

path: .spaces[7].metrics.halstead.length
old: 103.0
new: 28.0

path: .spaces[7].metrics.halstead.N1
old: 65.0
new: 13.0

path: .spaces[7].metrics.halstead.effort
old: 8865.884693411503
new: 488.710330729571

path: .spaces[7].metrics.halstead.estimated_program_length
old: 167.29731590431558
new: 67.75720079023742

path: .spaces[7].metrics.halstead.level
old: 0.06140350877192983
new: 0.24761904761904763

path: .spaces[7].metrics.mi.mi_original
old: 89.85176444341884
new: 106.98538469883296

path: .spaces[7].metrics.mi.mi_sei
old: 54.23330256384432
new: 101.26316536704007

path: .spaces[7].metrics.mi.mi_visual_studio
old: 52.544891487379445
new: 62.564552455457864

path: .spaces[7].metrics.nexits.average
old: 2.0
new: 0.0

path: .spaces[7].metrics.nexits.sum
old: 2.0
new: 0.0

path: .spaces[7].metrics.nargs.sum
old: 0.0
new: 2.0

path: .spaces[7].metrics.nargs.average
old: 0.0
new: 2.0

path: .spaces[7].metrics.cyclomatic.sum
old: 3.0
new: 1.0

path: .spaces[7].metrics.cyclomatic.average
old: 3.0
new: 1.0

path: .spaces[7].metrics.loc.blank
old: 3.0
new: 0.0

path: .spaces[7].metrics.loc.cloc
old: 0.0
new: 1.0

path: .spaces[7].metrics.loc.sloc
old: 19.0
new: 11.0

path: .spaces[7].metrics.loc.ploc
old: 16.0
new: 10.0

path: .spaces[7].metrics.loc.lloc
old: 5.0
new: 1.0

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity2DeathTest)) {
  const char* const regex =
      "###!!! ERROR: Potential deadlock detected.*"
      "=== Cyclical dependency starts at.*--- Mutex : dd.sanity2.m1.*"
      "--- Next dependency:.*--- Mutex : dd.sanity2.m2.*"
      "=== Cycle completed at.*--- Mutex : dd.sanity2.m1.*"
      "###!!! Deadlock may happen NOW!.*"  // better catch these easy cases...
      "###!!! ASSERTION: Potential deadlock detected.*";

  ASSERT_DEATH_IF_SUPPORTED(Sanity2_Child(), regex);
}

Minimal test - lines (120, 142)

path: .spaces[8].metrics.cyclomatic.average
old: 6.0
new: 1.0

path: .spaces[8].metrics.cyclomatic.sum
old: 6.0
new: 1.0

path: .spaces[8].metrics.cognitive.average
old: 13.0
new: 0.0

path: .spaces[8].metrics.cognitive.sum
old: 13.0
new: 0.0

path: .spaces[8].metrics.loc.blank
old: 2.0
new: 3.0

path: .spaces[8].metrics.loc.lloc
old: 14.0
new: 12.0

path: .spaces[8].metrics.loc.sloc
old: 32.0
new: 23.0

path: .spaces[8].metrics.loc.ploc
old: 23.0
new: 20.0

path: .spaces[8].metrics.loc.cloc
old: 7.0
new: 0.0

path: .spaces[8].metrics.mi.mi_original
old: 79.62378815779077
new: 89.57720677272121

path: .spaces[8].metrics.mi.mi_visual_studio
old: 46.5636188057256
new: 52.3843314460358

path: .spaces[8].metrics.mi.mi_sei
old: 72.923544276945
new: 53.633559855081856

path: .spaces[8].metrics.halstead.N2
old: 51.0
new: 35.0

path: .spaces[8].metrics.halstead.effort
old: 11171.240480791212
new: 2593.1568569324177

path: .spaces[8].metrics.halstead.level
old: 0.06013071895424837
new: 0.13333333333333333

path: .spaces[8].metrics.halstead.vocabulary
old: 38.0
new: 20.0

path: .spaces[8].metrics.halstead.estimated_program_length
old: 162.64528392343908
new: 68.81274391313339

path: .spaces[8].metrics.halstead.length
old: 128.0
new: 80.0

path: .spaces[8].metrics.halstead.purity_ratio
old: 1.2706662806518678
new: 0.8601592989141673

path: .spaces[8].metrics.halstead.time
old: 620.6244711550675
new: 144.06426982957876

path: .spaces[8].metrics.halstead.volume
old: 671.7347217207789
new: 345.754247590989

path: .spaces[8].metrics.halstead.N1
old: 77.0
new: 45.0

path: .spaces[8].metrics.halstead.bugs
old: 0.16657622376477485
new: 0.0629165070250158

path: .spaces[8].metrics.halstead.n2
old: 23.0
new: 14.0

path: .spaces[8].metrics.halstead.n1
old: 15.0
new: 6.0

path: .spaces[8].metrics.halstead.difficulty
old: 16.630434782608695
new: 7.5

path: .spaces[8].metrics.nexits.average
old: 2.0
new: 1.0

path: .spaces[8].metrics.nexits.sum
old: 2.0
new: 1.0

Code

int
Sanity3_Child()
{
    DisableCrashReporter();

    MUTEX m1("dd.sanity3.m1");
    MUTEX m2("dd.sanity3.m2");
    MUTEX m3("dd.sanity3.m3");
    MUTEX m4("dd.sanity3.m4");

    m1.Lock();
    m2.Lock();
    m3.Lock();
    m4.Lock();
    m4.Unlock();
    m3.Unlock();
    m2.Unlock();
    m1.Unlock();

    m4.Lock();
    m1.Lock();
    return 0;
}

Minimal test - lines (144, 156)

path: .spaces[9].metrics.nargs.sum
old: 1.0
new: 2.0

path: .spaces[9].metrics.nargs.average
old: 1.0
new: 2.0

path: .spaces[9].metrics.cyclomatic.sum
old: 4.0
new: 1.0

path: .spaces[9].metrics.cyclomatic.average
old: 4.0
new: 1.0

path: .spaces[9].metrics.loc.ploc
old: 14.0
new: 12.0

path: .spaces[9].metrics.loc.sloc
old: 21.0
new: 13.0

path: .spaces[9].metrics.loc.blank
old: 4.0
new: 1.0

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

path: .spaces[9].metrics.loc.lloc
old: 9.0
new: 1.0

path: .spaces[9].metrics.mi.mi_original
old: 90.81132269940268
new: 104.01262582557686

path: .spaces[9].metrics.mi.mi_sei
old: 83.35194950069292
new: 74.45946733579079

path: .spaces[9].metrics.mi.mi_visual_studio
old: 53.106036666317344
new: 60.82609697402156

path: .spaces[9].metrics.cognitive.average
old: 3.0
new: 0.0

path: .spaces[9].metrics.cognitive.sum
old: 3.0
new: 0.0

path: .spaces[9].metrics.nexits.sum
old: 2.0
new: 0.0

path: .spaces[9].metrics.nexits.average
old: 2.0
new: 0.0

path: .spaces[9].metrics.halstead.length
old: 64.0
new: 29.0

path: .spaces[9].metrics.halstead.purity_ratio
old: 1.9156774833457464
new: 2.51567080562792

path: .spaces[9].metrics.halstead.effort
old: 3382.0646812241066
new: 509.50882104233625

path: .spaces[9].metrics.halstead.volume
old: 317.06856386476
new: 127.37720526058406

path: .spaces[9].metrics.halstead.level
old: 0.09375
new: 0.25

path: .spaces[9].metrics.halstead.n2
old: 15.0
new: 14.0

path: .spaces[9].metrics.halstead.time
old: 187.89248229022817
new: 28.306045613463127

path: .spaces[9].metrics.halstead.n1
old: 16.0
new: 7.0

path: .spaces[9].metrics.halstead.N1
old: 44.0
new: 13.0

path: .spaces[9].metrics.halstead.estimated_program_length
old: 122.60335893412778
new: 72.95445336320968

path: .spaces[9].metrics.halstead.vocabulary
old: 31.0
new: 21.0

path: .spaces[9].metrics.halstead.bugs
old: 0.07510462546424738
new: 0.021264077680220456

path: .spaces[9].metrics.halstead.difficulty
old: 10.666666666666666
new: 4.0

path: .spaces[9].metrics.halstead.N2
old: 20.0
new: 16.0

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity3DeathTest))
{
    const char* const regex =
        "###!!! ERROR: Potential deadlock detected.*"
        "=== Cyclical dependency starts at.*--- Mutex : dd.sanity3.m1.*"
        "--- Next dependency:.*--- Mutex : dd.sanity3.m2.*"
        "--- Next dependency:.*--- Mutex : dd.sanity3.m3.*"
        "--- Next dependency:.*--- Mutex : dd.sanity3.m4.*"
        "=== Cycle completed at.*--- Mutex : dd.sanity3.m1.*"
        "###!!! ASSERTION: Potential deadlock detected.*";

    ASSERT_DEATH_IF_SUPPORTED(Sanity3_Child(), regex);
}

Minimal test - lines (159, 168)

path: .spaces[10].metrics.mi.mi_sei
old: 58.59416555881934
new: 79.35904338717278

path: .spaces[10].metrics.mi.mi_original
old: 74.98604640115296
new: 107.40875315153131

path: .spaces[10].metrics.mi.mi_visual_studio
old: 43.851489123481265
new: 62.81213634592474

path: .spaces[10].metrics.nargs.average
old: 2.0
new: 0.0

path: .spaces[10].metrics.nargs.sum
old: 2.0
new: 0.0

path: .spaces[10].metrics.nexits.average
old: 3.0
new: 1.0

path: .spaces[10].metrics.nexits.sum
old: 3.0
new: 1.0

path: .spaces[10].metrics.halstead.N2
old: 53.0
new: 15.0

path: .spaces[10].metrics.halstead.difficulty
old: 13.70689655172414
new: 4.7727272727272725

path: .spaces[10].metrics.halstead.purity_ratio
old: 1.3663342999508723
new: 1.6029231183170414

path: .spaces[10].metrics.halstead.n1
old: 15.0
new: 7.0

path: .spaces[10].metrics.halstead.level
old: 0.0729559748427673
new: 0.20952380952380953

path: .spaces[10].metrics.halstead.time
old: 606.9695670260835
new: 39.803829559222066

path: .spaces[10].metrics.halstead.N1
old: 93.0
new: 21.0

path: .spaces[10].metrics.halstead.volume
old: 797.0770163210454
new: 150.11730005192322

path: .spaces[10].metrics.halstead.effort
old: 10925.452206469505
new: 716.4689320659971

path: .spaces[10].metrics.halstead.length
old: 146.0
new: 36.0

path: .spaces[10].metrics.halstead.vocabulary
old: 44.0
new: 18.0

path: .spaces[10].metrics.halstead.estimated_program_length
old: 199.48480779282735
new: 57.70523225941349

path: .spaces[10].metrics.halstead.n2
old: 29.0
new: 11.0

path: .spaces[10].metrics.halstead.bugs
old: 0.1641238488386275
new: 0.02668969764870665

path: .spaces[10].metrics.cognitive.average
old: 15.0
new: 0.0

path: .spaces[10].metrics.cognitive.sum
old: 15.0
new: 0.0

path: .spaces[10].metrics.loc.lloc
old: 14.0
new: 5.0

path: .spaces[10].metrics.loc.sloc
old: 36.0
new: 10.0

path: .spaces[10].metrics.loc.blank
old: 4.0
new: 1.0

path: .spaces[10].metrics.loc.cloc
old: 4.0
new: 0.0

path: .spaces[10].metrics.loc.ploc
old: 28.0
new: 9.0

path: .spaces[10].metrics.cyclomatic.sum
old: 14.0
new: 1.0

path: .spaces[10].metrics.cyclomatic.average
old: 14.0
new: 1.0

Code

static int Sanity4_Child() {
  DisableCrashReporter();

  mozilla::ReentrantMonitor m1("dd.sanity4.m1");
  MUTEX m2("dd.sanity4.m2");
  m1.Enter();
  m2.Lock();
  m1.Enter();
  return 0;
}

Minimal test - lines (249, 272)

path: .spaces[16].metrics.loc.blank
old: 1.0
new: 5.0

path: .spaces[16].metrics.loc.cloc
old: 2.0
new: 0.0

path: .spaces[16].metrics.loc.ploc
old: 6.0
new: 19.0

path: .spaces[16].metrics.loc.lloc
old: 2.0
new: 5.0

path: .spaces[16].metrics.loc.sloc
old: 9.0
new: 24.0

path: .spaces[16].metrics.mi.mi_visual_studio
old: 63.12626963739892
new: 51.27563495858038

path: .spaces[16].metrics.mi.mi_original
old: 107.94592107995216
new: 87.68133577917246

path: .spaces[16].metrics.mi.mi_sei
old: 113.48854945265572
new: 51.00021603392834

path: .spaces[16].metrics.halstead.N2
old: 17.0
new: 35.0

path: .spaces[16].metrics.halstead.purity_ratio
old: 2.1102987770165873
new: 1.6989509962140965

path: .spaces[16].metrics.halstead.time
old: 63.40712029767154
new: 320.1977709295718

path: .spaces[16].metrics.halstead.difficulty
old: 6.071428571428571
new: 13.81578947368421

path: .spaces[16].metrics.halstead.effort
old: 1141.3281653580875
new: 5763.559876732292

path: .spaces[16].metrics.halstead.estimated_program_length
old: 86.52224985768008
new: 139.3139816895559

path: .spaces[16].metrics.halstead.n1
old: 10.0
new: 15.0

path: .spaces[16].metrics.halstead.n2
old: 14.0
new: 19.0

path: .spaces[16].metrics.halstead.volume
old: 187.9834625295674
new: 417.1719529825278

path: .spaces[16].metrics.halstead.N1
old: 24.0
new: 47.0

path: .spaces[16].metrics.halstead.length
old: 41.0
new: 82.0

path: .spaces[16].metrics.halstead.bugs
old: 0.03640427908609246
new: 0.10715339892754504

path: .spaces[16].metrics.halstead.level
old: 0.16470588235294115
new: 0.07238095238095238

path: .spaces[16].metrics.halstead.vocabulary
old: 24.0
new: 34.0

path: .spaces[16].metrics.cyclomatic.sum
old: 1.0
new: 2.0

path: .spaces[16].metrics.cyclomatic.average
old: 1.0
new: 2.0

Code

int
TwoThreads_Child()
{
    DisableCrashReporter();

    nsTArray locks = {
      new MUTEX("dd.twothreads.m1"),
      new MUTEX("dd.twothreads.m2")
    };

    ThreadState state_1 {locks, 0};
    PRThread* t1 = spawn(TwoThreads_thread, &state_1);
    PR_JoinThread(t1);

    ThreadState state_2 {locks, 1};
    PRThread* t2 = spawn(TwoThreads_thread, &state_2);
    PR_JoinThread(t2);

    for (auto& lock : locks) {
      delete lock;
    }

    return 0;
}

Minimal test - lines (182, 191)

path: .spaces[12].metrics.loc.sloc
old: 15.0
new: 10.0

path: .spaces[12].metrics.loc.ploc
old: 14.0
new: 9.0

path: .spaces[12].metrics.mi.mi_original
old: 95.94692489922085
new: 107.51261589767118

path: .spaces[12].metrics.mi.mi_visual_studio
old: 56.1093128065619
new: 62.87287479395976

path: .spaces[12].metrics.mi.mi_sei
old: 63.12858018625681
new: 79.50888565596186

path: .spaces[12].metrics.cyclomatic.average
old: 4.0
new: 1.0

path: .spaces[12].metrics.cyclomatic.sum
old: 4.0
new: 1.0

path: .spaces[12].metrics.nargs.sum
old: 2.0
new: 0.0

path: .spaces[12].metrics.nargs.average
old: 2.0
new: 0.0

path: .spaces[12].metrics.cognitive.average
old: 4.0
new: 0.0

path: .spaces[12].metrics.cognitive.sum
old: 4.0
new: 0.0

path: .spaces[12].metrics.halstead.volume
old: 336.8853491063075
new: 147.14866228501222

path: .spaces[12].metrics.halstead.length
old: 68.0
new: 36.0

path: .spaces[12].metrics.halstead.N2
old: 25.0
new: 15.0

path: .spaces[12].metrics.halstead.N1
old: 43.0
new: 21.0

path: .spaces[12].metrics.halstead.bugs
old: 0.08326344090821394
new: 0.02806440418305697

path: .spaces[12].metrics.halstead.level
old: 0.08533333333333333
new: 0.1904761904761905

path: .spaces[12].metrics.halstead.estimated_program_length
old: 122.60335893412778
new: 52.87076540327685

path: .spaces[12].metrics.halstead.n1
old: 15.0
new: 7.0

path: .spaces[12].metrics.halstead.effort
old: 3947.875184839541
new: 772.5304769963142

path: .spaces[12].metrics.halstead.difficulty
old: 11.71875
new: 5.25

path: .spaces[12].metrics.halstead.vocabulary
old: 31.0
new: 17.0

path: .spaces[12].metrics.halstead.n2
old: 16.0
new: 10.0

path: .spaces[12].metrics.halstead.purity_ratio
old: 1.8029905725607027
new: 1.4686323723132455

path: .spaces[12].metrics.halstead.time
old: 219.32639915775223
new: 42.91835983312856

Code

static int Sanity5_Child() {
  DisableCrashReporter();

  mozilla::RecursiveMutex m1("dd.sanity4.m1");
  MUTEX m2("dd.sanity4.m2");
  m1.Lock();
  m2.Lock();
  m1.Lock();
  return 0;
}

Minimal test - lines (49, 54)

path: .spaces[1].metrics.nexits.sum
old: 3.0
new: 0.0

path: .spaces[1].metrics.nexits.average
old: 3.0
new: 0.0

path: .spaces[1].metrics.cognitive.sum
old: 5.0
new: 0.0

path: .spaces[1].metrics.cognitive.average
old: 5.0
new: 0.0

path: .spaces[1].metrics.cyclomatic.average
old: 5.0
new: 1.0

path: .spaces[1].metrics.cyclomatic.sum
old: 5.0
new: 2.0

path: .spaces[1].metrics.halstead.n2
old: 26.0
new: 8.0

path: .spaces[1].metrics.halstead.volume
old: 691.8506523353572
new: 93.76537429460444

path: .spaces[1].metrics.halstead.difficulty
old: 13.73076923076923
new: 3.5

path: .spaces[1].metrics.halstead.n1
old: 14.0
new: 7.0

path: .spaces[1].metrics.halstead.purity_ratio
old: 1.350110781388268
new: 1.8188118522668013

path: .spaces[1].metrics.halstead.level
old: 0.07282913165266107
new: 0.2857142857142857

path: .spaces[1].metrics.halstead.vocabulary
old: 40.0
new: 15.0

path: .spaces[1].metrics.halstead.bugs
old: 0.14951458528462663
new: 0.0158593640802942

path: .spaces[1].metrics.halstead.effort
old: 9499.641649373942
new: 328.1788100311155

path: .spaces[1].metrics.halstead.time
old: 527.7578694096634
new: 18.23215611283975

path: .spaces[1].metrics.halstead.N1
old: 79.0
new: 16.0

path: .spaces[1].metrics.halstead.estimated_program_length
old: 175.51440158047484
new: 43.65148445440323

path: .spaces[1].metrics.halstead.N2
old: 51.0
new: 8.0

path: .spaces[1].metrics.halstead.length
old: 130.0
new: 24.0

path: .spaces[1].metrics.mi.mi_sei
old: 60.806331719103255
new: 94.59849403130713

path: .spaces[1].metrics.mi.mi_original
old: 83.69948705473264
new: 117.90135925032428

path: .spaces[1].metrics.mi.mi_visual_studio
old: 48.94706845306002
new: 68.9481633042832

path: .spaces[1].metrics.loc.sloc
old: 25.0
new: 6.0

path: .spaces[1].metrics.loc.blank
old: 4.0
new: 0.0

path: .spaces[1].metrics.loc.lloc
old: 11.0
new: 5.0

path: .spaces[1].metrics.loc.ploc
old: 20.0
new: 6.0

path: .spaces[1].metrics.loc.cloc
old: 1.0
new: 0.0

Code

class TESTNAME(DeadlockDetectorTest) : public ::testing::Test {
 protected:
  void SetUp() final {
    mOldSleepDuration = ::_gdb_sleep_duration;
    ::_gdb_sleep_duration = 0;
  }

Minimal test - lines (212, 223)

path: .spaces[14].metrics.halstead.N1
old: 17.0
new: 8.0

path: .spaces[14].metrics.halstead.effort
old: 776.9131012981511
new: 163.1157937828126

path: .spaces[14].metrics.halstead.vocabulary
old: 15.0
new: 12.0

path: .spaces[14].metrics.halstead.n1
old: 8.0
new: 7.0

path: .spaces[14].metrics.halstead.N2
old: 12.0
new: 5.0

path: .spaces[14].metrics.halstead.time
old: 43.16183896100839
new: 9.061988543489589

path: .spaces[14].metrics.halstead.n2
old: 7.0
new: 5.0

path: .spaces[14].metrics.halstead.purity_ratio
old: 1.5052236018759737
new: 2.40470191760308

path: .spaces[14].metrics.halstead.estimated_program_length
old: 43.65148445440323
new: 31.26112492884004

path: .spaces[14].metrics.halstead.difficulty
old: 6.857142857142857
new: 3.5

path: .spaces[14].metrics.halstead.volume
old: 113.29982727264704
new: 46.60451250937503

path: .spaces[14].metrics.halstead.level
old: 0.14583333333333334
new: 0.2857142857142857

path: .spaces[14].metrics.halstead.bugs
old: 0.028170445080830765
new: 0.009951214505750776

path: .spaces[14].metrics.halstead.length
old: 29.0
new: 13.0

path: .spaces[14].metrics.nargs.average
old: 0.0
new: null

path: .spaces[14].metrics.cognitive.average
old: 1.0
new: null

path: .spaces[14].metrics.cognitive.sum
old: 1.0
new: 0.0

path: .spaces[14].metrics.mi.mi_visual_studio
old: 64.53144216424074
new: 64.64192160357314

path: .spaces[14].metrics.mi.mi_original
old: 110.34876610085168
new: 110.53768594211007

path: .spaces[14].metrics.mi.mi_sei
old: 117.05694190773669
new: 130.1644525423733

path: .spaces[14].metrics.cyclomatic.average
old: 2.0
new: 1.0

path: .spaces[14].metrics.cyclomatic.sum
old: 2.0
new: 1.0

path: .spaces[14].metrics.loc.cloc
old: 2.0
new: 7.0

path: .spaces[14].metrics.loc.ploc
old: 7.0
new: 4.0

path: .spaces[14].metrics.loc.blank
old: 0.0
new: 1.0

path: .spaces[14].metrics.loc.lloc
old: 3.0
new: 0.0

path: .spaces[14].metrics.loc.sloc
old: 9.0
new: 12.0

path: .spaces[14].metrics.nexits.average
old: 0.0
new: null

path: .spaces[14].metrics.nom.functions
old: 1.0
new: 0.0

path: .spaces[14].metrics.nom.total
old: 1.0
new: 0.0

Code

struct ThreadState {
  /**
   * Locks to use during the test. This is just a reference and is owned by
   * the main test thread.
   */
  const nsTArray& locks;

  /**
   * Integer argument used to identify each thread.
   */
  int id;
};

Minimal test - lines (323, 326)

path: .spaces[20].metrics.mi.mi_original
old: 111.59798104673588
new: 127.12557958253764

path: .spaces[20].metrics.mi.mi_sei
old: 85.50464155614253
new: 142.77580462442648

path: .spaces[20].metrics.mi.mi_visual_studio
old: 65.26197722031338
new: 74.3424442003144

path: .spaces[20].metrics.halstead.level
old: 0.11336032388663968
new: 0.4375

path: .spaces[20].metrics.halstead.N2
old: 19.0
new: 8.0

path: .spaces[20].metrics.halstead.volume
old: 194.9503875887022
new: 58.81033751683405

path: .spaces[20].metrics.halstead.effort
old: 1719.7409190860517
new: 134.4236286099064

path: .spaces[20].metrics.halstead.time
old: 95.5411621714473
new: 7.467979367217022

path: .spaces[20].metrics.halstead.vocabulary
old: 27.0
new: 11.0

path: .spaces[20].metrics.halstead.purity_ratio
old: 2.4733825669424547
new: 1.6265579090825428

path: .spaces[20].metrics.halstead.n1
old: 13.0
new: 4.0

path: .spaces[20].metrics.halstead.difficulty
old: 8.821428571428571
new: 2.2857142857142856

path: .spaces[20].metrics.halstead.estimated_program_length
old: 101.40868524464064
new: 27.651484454403228

path: .spaces[20].metrics.halstead.n2
old: 14.0
new: 7.0

path: .spaces[20].metrics.halstead.bugs
old: 0.0478469319618791
new: 0.008747067708382439

path: .spaces[20].metrics.halstead.N1
old: 22.0
new: 9.0

path: .spaces[20].metrics.halstead.length
old: 41.0
new: 17.0

path: .spaces[20].metrics.loc.cloc
old: 0.0
new: 1.0

path: .spaces[20].metrics.loc.blank
old: 1.0
new: 0.0

path: .spaces[20].metrics.loc.sloc
old: 7.0
new: 4.0

path: .spaces[20].metrics.loc.lloc
old: 2.0
new: 1.0

path: .spaces[20].metrics.loc.ploc
old: 6.0
new: 3.0

path: .spaces[20].metrics.cyclomatic.average
old: 2.0
new: 1.0

path: .spaces[20].metrics.cyclomatic.sum
old: 2.0
new: 1.0

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(ContentionNoDeadlock)) {
  // Just check that this test runs to completion.
  ASSERT_EQ(ContentionNoDeadlock_Child(), 0);
}

Minimal test - lines (303, 321)

path: .spaces[19].metrics.cyclomatic.sum
old: 6.0
new: 5.0

path: .spaces[19].metrics.cyclomatic.average
old: 6.0
new: 5.0

path: .spaces[19].metrics.halstead.n2
old: 34.0
new: 22.0

path: .spaces[19].metrics.halstead.N2
old: 70.0
new: 56.0

path: .spaces[19].metrics.halstead.time
old: 846.9473079557363
new: 876.7361135167257

path: .spaces[19].metrics.halstead.estimated_program_length
old: 236.9737366025115
new: 167.5943639112763

path: .spaces[19].metrics.halstead.vocabulary
old: 50.0
new: 39.0

path: .spaces[19].metrics.halstead.difficulty
old: 16.470588235294116
new: 21.636363636363637

path: .spaces[19].metrics.halstead.purity_ratio
old: 1.4449618085518996
new: 1.2144519124005528

path: .spaces[19].metrics.halstead.effort
old: 15245.051543203252
new: 15781.250043301065

path: .spaces[19].metrics.halstead.level
old: 0.06071428571428572
new: 0.046218487394957986

path: .spaces[19].metrics.halstead.volume
old: 925.5924151230548
new: 729.3855062029903

path: .spaces[19].metrics.halstead.n1
old: 16.0
new: 17.0

path: .spaces[19].metrics.halstead.length
old: 164.0
new: 138.0

path: .spaces[19].metrics.halstead.bugs
old: 0.20494217611199456
new: 0.2097199180194805

path: .spaces[19].metrics.halstead.N1
old: 94.0
new: 82.0

path: .spaces[19].metrics.loc.blank
old: 10.0
new: 6.0

path: .spaces[19].metrics.loc.lloc
old: 15.0
new: 9.0

path: .spaces[19].metrics.loc.cloc
old: 6.0
new: 0.0

path: .spaces[19].metrics.loc.ploc
old: 29.0
new: 13.0

path: .spaces[19].metrics.loc.sloc
old: 45.0
new: 19.0

path: .spaces[19].metrics.mi.mi_sei
old: 56.20969664807322
new: 51.57877812995056

path: .spaces[19].metrics.mi.mi_original
old: 72.43381096299042
new: 87.87063601939549

path: .spaces[19].metrics.mi.mi_visual_studio
old: 42.35895377952656
new: 51.38633685344766

path: .spaces[19].metrics.nexits.sum
old: 4.0
new: 1.0

path: .spaces[19].metrics.nexits.average
old: 4.0
new: 1.0

path: .spaces[19].metrics.cognitive.average
old: 5.0
new: 4.0

path: .spaces[19].metrics.cognitive.sum
old: 5.0
new: 4.0

Code

static int ContentionNoDeadlock_Child() {
  const size_t kMutexCount = 4;

  PRThread* threads[3];
  nsTArray locks;
  ThreadState states[] = {{locks, 0}, {locks, 1}, {locks, 2}};

  for (uint32_t i = 0; i < kMutexCount; ++i)
    locks.AppendElement(new MUTEX("dd.cnd.ms"));

  for (int32_t i = 0; i < (int32_t)ArrayLength(threads); ++i)
    threads[i] = spawn(ContentionNoDeadlock_thread, states + i);

  for (uint32_t i = 0; i < ArrayLength(threads); ++i) PR_JoinThread(threads[i]);

  for (uint32_t i = 0; i < locks.Length(); ++i) delete locks[i];

  return 0;
}

Minimal test - lines (74, 81)

path: .spaces[4].metrics.nexits.average
old: 5.0
new: 1.0

path: .spaces[4].metrics.nexits.sum
old: 5.0
new: 1.0

path: .spaces[4].metrics.loc.lloc
old: 14.0
new: 4.0

path: .spaces[4].metrics.loc.cloc
old: 6.0
new: 1.0

path: .spaces[4].metrics.loc.blank
old: 6.0
new: 0.0

path: .spaces[4].metrics.loc.ploc
old: 32.0
new: 7.0

path: .spaces[4].metrics.loc.sloc
old: 44.0
new: 8.0

path: .spaces[4].metrics.mi.mi_visual_studio
old: 40.81309720160542
new: 66.39821294020888

path: .spaces[4].metrics.mi.mi_original
old: 69.79039621474527
new: 113.5409441277572

path: .spaces[4].metrics.mi.mi_sei
old: 53.2762437038262
new: 114.24313987399393

path: .spaces[4].metrics.cyclomatic.sum
old: 12.0
new: 1.0

path: .spaces[4].metrics.cyclomatic.average
old: 12.0
new: 1.0

path: .spaces[4].metrics.halstead.difficulty
old: 22.7027027027027
new: 4.285714285714286

path: .spaces[4].metrics.halstead.effort
old: 28735.653831944568
new: 396.4756840865456

path: .spaces[4].metrics.halstead.level
old: 0.04404761904761905
new: 0.23333333333333336

path: .spaces[4].metrics.halstead.estimated_program_length
old: 279.1883364260184
new: 35.161259458730164

path: .spaces[4].metrics.halstead.n2
old: 37.0
new: 7.0

path: .spaces[4].metrics.halstead.length
old: 217.0
new: 25.0

path: .spaces[4].metrics.halstead.N1
old: 133.0
new: 15.0

path: .spaces[4].metrics.halstead.bugs
old: 0.31272274346415274
new: 0.017989666682676705

path: .spaces[4].metrics.halstead.volume
old: 1265.737133073749
new: 92.5109929535273

path: .spaces[4].metrics.halstead.N2
old: 84.0
new: 10.0

path: .spaces[4].metrics.halstead.time
old: 1596.4252128858093
new: 22.02642689369698

path: .spaces[4].metrics.halstead.n1
old: 20.0
new: 6.0

path: .spaces[4].metrics.halstead.vocabulary
old: 57.0
new: 13.0

path: .spaces[4].metrics.halstead.purity_ratio
old: 1.2865821955116057
new: 1.4064503783492066

path: .spaces[4].metrics.cognitive.sum
old: 12.0
new: 0.0

path: .spaces[4].metrics.cognitive.average
old: 12.0
new: 0.0

Code

static int Sanity_Child() {
  DisableCrashReporter();

  MUTEX m1("dd.sanity.m1");
  m1.Lock();
  m1.Lock();
  return 0;  // not reached
}

Minimal test - lines (194, 203)

path: .spaces[13].metrics.nexits.average
old: 1.0
new: 0.0

path: .spaces[13].metrics.nexits.sum
old: 1.0
new: 0.0

path: .spaces[13].metrics.loc.lloc
old: 5.0
new: 1.0

path: .spaces[13].metrics.loc.sloc
old: 11.0
new: 10.0

path: .spaces[13].metrics.loc.ploc
old: 11.0
new: 10.0

path: .spaces[13].metrics.halstead.N2
old: 25.0
new: 15.0

path: .spaces[13].metrics.halstead.volume
old: 275.7834751254812
new: 121.01398665684616

path: .spaces[13].metrics.halstead.n2
old: 15.0
new: 13.0

path: .spaces[13].metrics.halstead.purity_ratio
old: 1.752119119703132
new: 2.419900028222765

path: .spaces[13].metrics.halstead.vocabulary
old: 27.0
new: 20.0

path: .spaces[13].metrics.halstead.level
old: 0.1
new: 0.24761904761904763

path: .spaces[13].metrics.halstead.length
old: 58.0
new: 28.0

path: .spaces[13].metrics.halstead.bugs
old: 0.06555274844196018
new: 0.020681391614985965

path: .spaces[13].metrics.halstead.effort
old: 2757.8347512548116
new: 488.710330729571

path: .spaces[13].metrics.halstead.N1
old: 33.0
new: 13.0

path: .spaces[13].metrics.halstead.n1
old: 12.0
new: 7.0

path: .spaces[13].metrics.halstead.time
old: 153.2130417363784
new: 27.150573929420613

path: .spaces[13].metrics.halstead.estimated_program_length
old: 101.62290894278166
new: 67.75720079023742

path: .spaces[13].metrics.halstead.difficulty
old: 10.0
new: 4.038461538461538

path: .spaces[13].metrics.mi.mi_original
old: 102.24209313411936
new: 108.529409611663

path: .spaces[13].metrics.mi.mi_sei
old: 72.10876832090217
new: 80.97580890474497

path: .spaces[13].metrics.mi.mi_visual_studio
old: 59.79069773925108
new: 63.46749100097252

path: .spaces[13].metrics.nargs.average
old: 0.0
new: 2.0

path: .spaces[13].metrics.nargs.sum
old: 0.0
new: 2.0

path: .spaces[13].metrics.cyclomatic.average
old: 3.0
new: 1.0

path: .spaces[13].metrics.cyclomatic.sum
old: 3.0
new: 1.0

path: .spaces[13].metrics.cognitive.average
old: 3.0
new: 0.0

path: .spaces[13].metrics.cognitive.sum
old: 3.0
new: 0.0

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity5DeathTest)) {
  const char* const regex =
      "Re-entering RecursiveMutex after acquiring other resources.*"
      "###!!! ERROR: Potential deadlock detected.*"
      "=== Cyclical dependency starts at.*--- RecursiveMutex : dd.sanity4.m1.*"
      "--- Next dependency:.*--- Mutex : dd.sanity4.m2.*"
      "=== Cycle completed at.*--- RecursiveMutex : dd.sanity4.m1.*"
      "###!!! ASSERTION: Potential deadlock detected.*";
  ASSERT_DEATH_IF_SUPPORTED(Sanity5_Child(), regex);
}

Minimal test - lines (83, 92)

path: .spaces[5].metrics.cognitive.sum
old: 6.0
new: 0.0

path: .spaces[5].metrics.cognitive.average
old: 6.0
new: 0.0

path: .spaces[5].metrics.cyclomatic.sum
old: 6.0
new: 1.0

path: .spaces[5].metrics.cyclomatic.average
old: 6.0
new: 1.0

path: .spaces[5].metrics.halstead.level
old: 0.06034482758620689
new: 0.2448979591836735

path: .spaces[5].metrics.halstead.time
old: 763.9737960302606
new: 26.01855601984196

path: .spaces[5].metrics.halstead.N2
old: 58.0
new: 14.0

path: .spaces[5].metrics.halstead.effort
old: 13751.528328544691
new: 468.33400835715526

path: .spaces[5].metrics.halstead.N1
old: 94.0
new: 13.0

path: .spaces[5].metrics.halstead.purity_ratio
old: 1.3066180119579796
new: 2.3211494245576705

path: .spaces[5].metrics.halstead.n1
old: 16.0
new: 7.0

path: .spaces[5].metrics.halstead.volume
old: 829.8336060328692
new: 114.6940428629768

path: .spaces[5].metrics.halstead.bugs
old: 0.1913283783240531
new: 0.0201024601068734

path: .spaces[5].metrics.halstead.estimated_program_length
old: 198.6059378176129
new: 62.6710344630571

path: .spaces[5].metrics.halstead.difficulty
old: 16.571428571428573
new: 4.083333333333333

path: .spaces[5].metrics.halstead.n2
old: 28.0
new: 12.0

path: .spaces[5].metrics.halstead.vocabulary
old: 44.0
new: 19.0

path: .spaces[5].metrics.halstead.length
old: 152.0
new: 27.0

path: .spaces[5].metrics.nargs.sum
old: 0.0
new: 2.0

path: .spaces[5].metrics.nargs.average
old: 0.0
new: 2.0

path: .spaces[5].metrics.mi.mi_sei
old: 65.1813198594273
new: 104.90499439972032

path: .spaces[5].metrics.mi.mi_original
old: 82.52384056575981
new: 108.80832744573446

path: .spaces[5].metrics.mi.mi_visual_studio
old: 48.25955588640925
new: 63.63060084545875

path: .spaces[5].metrics.nexits.sum
old: 3.0
new: 0.0

path: .spaces[5].metrics.nexits.average
old: 3.0
new: 0.0

path: .spaces[5].metrics.loc.cloc
old: 2.0
new: 1.0

path: .spaces[5].metrics.loc.blank
old: 3.0
new: 0.0

path: .spaces[5].metrics.loc.ploc
old: 20.0
new: 9.0

path: .spaces[5].metrics.loc.sloc
old: 25.0
new: 10.0

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

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(SanityDeathTest)) {
  const char* const regex =
      "###!!! ERROR: Potential deadlock detected.*"
      "=== Cyclical dependency starts at.*--- Mutex : dd.sanity.m1.*"
      "=== Cycle completed at.*--- Mutex : dd.sanity.m1.*"
      "###!!! Deadlock may happen NOW!.*"  // better catch these easy cases...
      "###!!! ASSERTION: Potential deadlock detected.*";

  ASSERT_DEATH_IF_SUPPORTED(Sanity_Child(), regex);
}

Minimal test - lines (274, 284)

path: .spaces[17].metrics.nexits.average
old: 1.0
new: 0.0

path: .spaces[17].metrics.nexits.sum
old: 1.0
new: 0.0

path: .spaces[17].metrics.halstead.estimated_program_length
old: 91.35671671381672
new: 62.6710344630571

path: .spaces[17].metrics.halstead.volume
old: 213.6173847296373
new: 114.6940428629768

path: .spaces[17].metrics.halstead.N2
old: 20.0
new: 14.0

path: .spaces[17].metrics.halstead.bugs
old: 0.04707744747146697
new: 0.0201024601068734

path: .spaces[17].metrics.halstead.n2
old: 14.0
new: 12.0

path: .spaces[17].metrics.halstead.time
old: 93.24568381055596
new: 26.01855601984196

path: .spaces[17].metrics.halstead.N1
old: 26.0
new: 13.0

path: .spaces[17].metrics.halstead.n1
old: 11.0
new: 7.0

path: .spaces[17].metrics.halstead.difficulty
old: 7.857142857142857
new: 4.083333333333333

path: .spaces[17].metrics.halstead.level
old: 0.1272727272727273
new: 0.2448979591836735

path: .spaces[17].metrics.halstead.vocabulary
old: 25.0
new: 19.0

path: .spaces[17].metrics.halstead.purity_ratio
old: 1.986015580735146
new: 2.3211494245576705

path: .spaces[17].metrics.halstead.effort
old: 1678.422308590007
new: 468.33400835715526

path: .spaces[17].metrics.halstead.length
old: 46.0
new: 27.0

path: .spaces[17].metrics.nargs.average
old: 0.0
new: 2.0

path: .spaces[17].metrics.nargs.sum
old: 0.0
new: 2.0

path: .spaces[17].metrics.loc.lloc
old: 2.0
new: 1.0

path: .spaces[17].metrics.loc.ploc
old: 7.0
new: 10.0

path: .spaces[17].metrics.loc.sloc
old: 10.0
new: 11.0

path: .spaces[17].metrics.loc.cloc
old: 2.0
new: 0.0

path: .spaces[17].metrics.mi.mi_sei
old: 108.64805208634728
new: 79.15064519602639

path: .spaces[17].metrics.mi.mi_visual_studio
old: 61.73938697667592
new: 62.72766229994409

path: .spaces[17].metrics.mi.mi_original
old: 105.57435173011582
new: 107.2643025329044

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(TwoThreadsDeathTest))
{
    const char* const regex =
        "###!!! ERROR: Potential deadlock detected.*"
        "=== Cyclical dependency starts at.*--- Mutex : dd.twothreads.m2.*"
        "--- Next dependency:.*--- Mutex : dd.twothreads.m1.*"
        "=== Cycle completed at.*--- Mutex : dd.twothreads.m2.*"
        "###!!! ASSERTION: Potential deadlock detected.*";

    ASSERT_DEATH_IF_SUPPORTED(TwoThreads_Child(), regex);
}

Minimal test - lines (287, 301)

path: .spaces[18].metrics.halstead.length
old: 55.0
new: 116.0

path: .spaces[18].metrics.halstead.effort
old: 1692.1805522405284
new: 13392.71101430803

path: .spaces[18].metrics.halstead.level
old: 0.15454545454545454
new: 0.045454545454545456

path: .spaces[18].metrics.halstead.purity_ratio
old: 1.8673845318205344
new: 1.3915624613004849

path: .spaces[18].metrics.halstead.bugs
old: 0.0473343638680008
new: 0.1879855253768112

path: .spaces[18].metrics.halstead.volume
old: 261.51881261899075
new: 608.7595915594559

path: .spaces[18].metrics.halstead.estimated_program_length
old: 102.7061492501294
new: 161.42124551085624

path: .spaces[18].metrics.halstead.n2
old: 17.0
new: 19.0

path: .spaces[18].metrics.halstead.time
old: 94.01003068002936
new: 744.0395007948905

path: .spaces[18].metrics.halstead.n1
old: 10.0
new: 19.0

path: .spaces[18].metrics.halstead.vocabulary
old: 27.0
new: 38.0

path: .spaces[18].metrics.halstead.N2
old: 22.0
new: 44.0

path: .spaces[18].metrics.halstead.N1
old: 33.0
new: 72.0

path: .spaces[18].metrics.halstead.difficulty
old: 6.470588235294118
new: 22.0

path: .spaces[18].metrics.loc.blank
old: 1.0
new: 3.0

path: .spaces[18].metrics.loc.ploc
old: 8.0
new: 11.0

path: .spaces[18].metrics.loc.lloc
old: 3.0
new: 6.0

path: .spaces[18].metrics.loc.sloc
old: 10.0
new: 15.0

path: .spaces[18].metrics.nargs.sum
old: 0.0
new: 1.0

path: .spaces[18].metrics.nargs.average
old: 0.0
new: 1.0

path: .spaces[18].metrics.cyclomatic.average
old: 1.0
new: 4.0

path: .spaces[18].metrics.cyclomatic.sum
old: 1.0
new: 4.0

path: .spaces[18].metrics.nexits.average
old: 1.0
new: 0.0

path: .spaces[18].metrics.nexits.sum
old: 1.0
new: 0.0

path: .spaces[18].metrics.mi.mi_sei
old: 98.72154818893124
new: 78.16069976836329

path: .spaces[18].metrics.mi.mi_original
old: 104.52228913858195
new: 92.87018490391948

path: .spaces[18].metrics.mi.mi_visual_studio
old: 61.124145695077175
new: 54.31004965141489

path: .spaces[18].metrics.cognitive.sum
old: 0.0
new: 5.0

path: .spaces[18].metrics.cognitive.average
old: 0.0
new: 5.0

Code

static void ContentionNoDeadlock_thread(void* arg) {
  const uint32_t K = 100000;

  ThreadState* state = static_cast(arg);
  int32_t starti = static_cast(state->id);
  auto& cndMs = state->locks;

  for (uint32_t k = 0; k < K; ++k) {
    for (int32_t i = starti; i < (int32_t)cndMs.Length(); ++i) cndMs[i]->Lock();
    // comment out the next two lines for deadlocking fun!
    for (int32_t i = cndMs.Length() - 1; i >= starti; --i) cndMs[i]->Unlock();

    starti = (starti + 1) % 3;
  }
}

Minimal test - lines (37, 40)

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

path: .spaces[0].metrics.cyclomatic.average
old: 9.0
new: 1.0

path: .spaces[0].metrics.cognitive.sum
old: 11.0
new: 0.0

path: .spaces[0].metrics.cognitive.average
old: 11.0
new: 0.0

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

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

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

path: .spaces[0].metrics.loc.ploc
old: 36.0
new: 4.0

path: .spaces[0].metrics.loc.sloc
old: 50.0
new: 4.0

path: .spaces[0].metrics.mi.mi_visual_studio
old: 40.14901994720211
new: 71.81811983296993

path: .spaces[0].metrics.mi.mi_original
old: 68.65482410971562
new: 122.80898491437858

path: .spaces[0].metrics.mi.mi_sei
old: 51.65027016917787
new: 101.5768813799732

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

path: .spaces[0].metrics.nexits.sum
old: 5.0
new: 1.0

path: .spaces[0].metrics.halstead.vocabulary
old: 57.0
new: 17.0

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.348735924763374
new: 1.6021444061599046

path: .spaces[0].metrics.halstead.N1
old: 123.0
new: 21.0

path: .spaces[0].metrics.halstead.volume
old: 1207.4082329321016
new: 134.88627376126118

path: .spaces[0].metrics.halstead.N2
old: 84.0
new: 12.0

path: .spaces[0].metrics.halstead.n1
old: 20.0
new: 7.0

path: .spaces[0].metrics.halstead.time
old: 1522.8572307251732
new: 31.473463877627612

path: .spaces[0].metrics.halstead.level
old: 0.04404761904761905
new: 0.23809523809523808

path: .spaces[0].metrics.halstead.difficulty
old: 22.7027027027027
new: 4.2

path: .spaces[0].metrics.halstead.bugs
old: 0.30303994267724327
new: 0.02282216165018836

path: .spaces[0].metrics.halstead.effort
old: 27411.430153053116
new: 566.522349797297

path: .spaces[0].metrics.halstead.estimated_program_length
old: 279.1883364260184
new: 52.87076540327685

path: .spaces[0].metrics.halstead.length
old: 207.0
new: 33.0

path: .spaces[0].metrics.halstead.n2
old: 37.0
new: 10.0

Code

static PRThread* spawn(void (*run)(void*), void* arg) {
  return PR_CreateThread(PR_SYSTEM_THREAD, run, arg, PR_PRIORITY_NORMAL,
                         PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
}

Minimal test - lines (227, 247)

path: .spaces[15].metrics.loc.ploc
old: 8.0
new: 19.0

path: .spaces[15].metrics.loc.sloc
old: 10.0
new: 21.0

path: .spaces[15].metrics.loc.lloc
old: 4.0
new: 9.0

path: .spaces[15].metrics.halstead.level
old: 0.11483253588516744
new: 0.06666666666666667

path: .spaces[15].metrics.halstead.volume
old: 203.5602880225656
new: 408.938255478275

path: .spaces[15].metrics.halstead.N2
old: 19.0
new: 35.0

path: .spaces[15].metrics.halstead.difficulty
old: 8.708333333333334
new: 15.0

path: .spaces[15].metrics.halstead.N1
old: 26.0
new: 52.0

path: .spaces[15].metrics.halstead.bugs
old: 0.04882371397025653
new: 0.11169783222436078

path: .spaces[15].metrics.halstead.vocabulary
old: 23.0
new: 26.0

path: .spaces[15].metrics.halstead.n1
old: 11.0
new: 12.0

path: .spaces[15].metrics.halstead.estimated_program_length
old: 81.07329781366414
new: 96.32251891746031

path: .spaces[15].metrics.halstead.purity_ratio
old: 1.8016288403036476
new: 1.107155389855866

path: .spaces[15].metrics.halstead.length
old: 45.0
new: 87.0

path: .spaces[15].metrics.halstead.effort
old: 1772.6708415298422
new: 6134.073832174125

path: .spaces[15].metrics.halstead.n2
old: 12.0
new: 14.0

path: .spaces[15].metrics.halstead.time
old: 98.48171341832456
new: 340.78187956522913

path: .spaces[15].metrics.mi.mi_original
old: 105.59511796693332
new: 89.94820277264287

path: .spaces[15].metrics.mi.mi_visual_studio
old: 61.751530974814806
new: 52.60128817113618

path: .spaces[15].metrics.mi.mi_sei
old: 76.84434075977596
new: 54.27061380376297

path: .spaces[15].metrics.nexits.sum
old: 2.0
new: 0.0

path: .spaces[15].metrics.nexits.average
old: 2.0
new: 0.0

path: .spaces[15].metrics.cognitive.sum
old: 1.0
new: 2.0

path: .spaces[15].metrics.cognitive.average
old: 1.0
new: 2.0

path: .spaces[15].metrics.nargs.sum
old: 0.0
new: 1.0

path: .spaces[15].metrics.nargs.average
old: 0.0
new: 1.0

Code

static void
TwoThreads_thread(void* arg)
{
    ThreadState* state = static_cast(arg);

    MUTEX* ttM1 = state->locks[0];
    MUTEX* ttM2 = state->locks[1];

    if (state->id) {
        ttM1->Lock();
        ttM2->Lock();
        ttM2->Unlock();
        ttM1->Unlock();
    }
    else {
        ttM2->Lock();
        ttM1->Lock();
        ttM1->Unlock();
        ttM2->Unlock();
    }
}

Minimal test - lines (95, 104)

path: .spaces[6].metrics.cyclomatic.average
old: 11.0
new: 1.0

path: .spaces[6].metrics.cyclomatic.sum
old: 11.0
new: 1.0

path: .spaces[6].metrics.nexits.average
old: 5.0
new: 1.0

path: .spaces[6].metrics.nexits.sum
old: 5.0
new: 1.0

path: .spaces[6].metrics.loc.lloc
old: 13.0
new: 5.0

path: .spaces[6].metrics.loc.cloc
old: 6.0
new: 1.0

path: .spaces[6].metrics.loc.ploc
old: 29.0
new: 9.0

path: .spaces[6].metrics.loc.sloc
old: 40.0
new: 10.0

path: .spaces[6].metrics.loc.blank
old: 5.0
new: 0.0

path: .spaces[6].metrics.halstead.bugs
old: 0.27923879390127887
new: 0.025869713019774816

path: .spaces[6].metrics.halstead.n2
old: 33.0
new: 9.0

path: .spaces[6].metrics.halstead.vocabulary
old: 52.0
new: 15.0

path: .spaces[6].metrics.halstead.N2
old: 75.0
new: 15.0

path: .spaces[6].metrics.halstead.level
old: 0.04631578947368421
new: 0.2

path: .spaces[6].metrics.halstead.N1
old: 122.0
new: 20.0

path: .spaces[6].metrics.halstead.time
old: 1347.0167844066984
new: 37.98365856841615

path: .spaces[6].metrics.halstead.purity_ratio
old: 1.2546986228134878
new: 1.258260000494507

path: .spaces[6].metrics.halstead.estimated_program_length
old: 247.17562869425709
new: 44.039100017307746

path: .spaces[6].metrics.halstead.difficulty
old: 21.59090909090909
new: 5.0

path: .spaces[6].metrics.halstead.length
old: 197.0
new: 35.0

path: .spaces[6].metrics.halstead.effort
old: 24246.30211932057
new: 683.7058542314908

path: .spaces[6].metrics.halstead.volume
old: 1122.986624473795
new: 136.74117084629816

path: .spaces[6].metrics.halstead.n1
old: 19.0
new: 6.0

path: .spaces[6].metrics.cognitive.sum
old: 11.0
new: 0.0

path: .spaces[6].metrics.cognitive.average
old: 11.0
new: 0.0

path: .spaces[6].metrics.mi.mi_visual_studio
old: 42.214425856049054
new: 63.09593809554362

path: .spaces[6].metrics.mi.mi_original
old: 72.18666821384387
new: 107.8940541433796

path: .spaces[6].metrics.mi.mi_sei
old: 57.79463838159762
new: 103.58597684039576

Code

static int Sanity2_Child() {
  DisableCrashReporter();

  MUTEX m1("dd.sanity2.m1");
  MUTEX m2("dd.sanity2.m2");
  m1.Lock();
  m2.Lock();
  m1.Lock();
  return 0;  // not reached
}

Minimal test - lines (62, 68)

path: .spaces[3].metrics.loc.ploc
old: 20.0
new: 7.0

path: .spaces[3].metrics.loc.lloc
old: 12.0
new: 2.0

path: .spaces[3].metrics.loc.sloc
old: 25.0
new: 7.0

path: .spaces[3].metrics.loc.blank
old: 3.0
new: 0.0

path: .spaces[3].metrics.loc.cloc
old: 2.0
new: 0.0

path: .spaces[3].metrics.mi.mi_original
old: 82.62749848324405
new: 115.16916855164108

path: .spaces[3].metrics.mi.mi_visual_studio
old: 48.32017455160471
new: 67.35039096587198

path: .spaces[3].metrics.mi.mi_sei
old: 65.3308666229307
new: 90.65677605955392

path: .spaces[3].metrics.nexits.sum
old: 3.0
new: 0.0

path: .spaces[3].metrics.nexits.average
old: 3.0
new: 0.0

path: .spaces[3].metrics.cyclomatic.sum
old: 6.0
new: 2.0

path: .spaces[3].metrics.cyclomatic.average
old: 6.0
new: 2.0

path: .spaces[3].metrics.cognitive.average
old: 6.0
new: 1.0

path: .spaces[3].metrics.cognitive.sum
old: 6.0
new: 1.0

path: .spaces[3].metrics.halstead.volume
old: 813.4553111769573
new: 98.09910819000814

path: .spaces[3].metrics.halstead.N1
old: 91.0
new: 14.0

path: .spaces[3].metrics.halstead.vocabulary
old: 44.0
new: 17.0

path: .spaces[3].metrics.halstead.length
old: 149.0
new: 24.0

path: .spaces[3].metrics.halstead.effort
old: 13480.11658521815
new: 551.8074835687958

path: .spaces[3].metrics.halstead.time
old: 748.8953658454527
new: 30.65597130937754

path: .spaces[3].metrics.halstead.n1
old: 16.0
new: 9.0

path: .spaces[3].metrics.halstead.n2
old: 28.0
new: 8.0

path: .spaces[3].metrics.halstead.difficulty
old: 16.571428571428573
new: 5.625

path: .spaces[3].metrics.halstead.level
old: 0.06034482758620689
new: 0.17777777777777778

path: .spaces[3].metrics.halstead.bugs
old: 0.18880254499265492
new: 0.022425241875491945

path: .spaces[3].metrics.halstead.N2
old: 58.0
new: 10.0

path: .spaces[3].metrics.halstead.estimated_program_length
old: 198.6059378176129
new: 52.529325012980806

path: .spaces[3].metrics.halstead.purity_ratio
old: 1.3329257571651871
new: 2.188721875540867

Code

static void DisableCrashReporter() {
  nsCOMPtr crashreporter =
      do_GetService("@mozilla.org/toolkit/crash-reporter;1");
  if (crashreporter) {
    crashreporter->SetEnabled(false);
  }
}

Minimal test - lines (170, 180)

path: .spaces[11].metrics.cyclomatic.sum
old: 3.0
new: 1.0

path: .spaces[11].metrics.cyclomatic.average
old: 3.0
new: 1.0

path: .spaces[11].metrics.halstead.vocabulary
old: 18.0
new: 21.0

path: .spaces[11].metrics.halstead.estimated_program_length
old: 57.05865002596162
new: 72.95445336320968

path: .spaces[11].metrics.halstead.effort
old: 625.4887502163468
new: 509.50882104233625

path: .spaces[11].metrics.halstead.time
old: 34.74937501201927
new: 28.306045613463127

path: .spaces[11].metrics.halstead.N2
old: 10.0
new: 16.0

path: .spaces[11].metrics.halstead.level
old: 0.2
new: 0.25

path: .spaces[11].metrics.halstead.length
old: 30.0
new: 29.0

path: .spaces[11].metrics.halstead.volume
old: 125.09775004326936
new: 127.37720526058406

path: .spaces[11].metrics.halstead.n1
old: 9.0
new: 7.0

path: .spaces[11].metrics.halstead.n2
old: 9.0
new: 14.0

path: .spaces[11].metrics.halstead.purity_ratio
old: 1.9019550008653872
new: 2.51567080562792

path: .spaces[11].metrics.halstead.difficulty
old: 5.0
new: 4.0

path: .spaces[11].metrics.halstead.bugs
old: 0.024379516068267628
new: 0.021264077680220456

path: .spaces[11].metrics.halstead.N1
old: 20.0
new: 13.0

path: .spaces[11].metrics.cognitive.average
old: 2.0
new: 0.0

path: .spaces[11].metrics.cognitive.sum
old: 2.0
new: 0.0

path: .spaces[11].metrics.nexits.sum
old: 1.0
new: 0.0

path: .spaces[11].metrics.nexits.average
old: 1.0
new: 0.0

path: .spaces[11].metrics.nargs.average
old: 1.0
new: 2.0

path: .spaces[11].metrics.nargs.sum
old: 1.0
new: 2.0

path: .spaces[11].metrics.loc.cloc
old: 2.0
new: 0.0

path: .spaces[11].metrics.loc.blank
old: 2.0
new: 0.0

path: .spaces[11].metrics.loc.sloc
old: 15.0
new: 11.0

path: .spaces[11].metrics.loc.lloc
old: 5.0
new: 1.0

path: .spaces[11].metrics.mi.mi_visual_studio
old: 59.25631023129099
new: 62.40871461819892

path: .spaces[11].metrics.mi.mi_sei
old: 97.59015940049008
new: 78.36379854775227

path: .spaces[11].metrics.mi.mi_original
old: 101.32829049550762
new: 106.71890199712016

Code

TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity4DeathTest)) {
  const char* const regex =
      "Re-entering ReentrantMonitor after acquiring other resources.*"
      "###!!! ERROR: Potential deadlock detected.*"
      "=== Cyclical dependency starts at.*--- ReentrantMonitor : "
      "dd.sanity4.m1.*"
      "--- Next dependency:.*--- Mutex : dd.sanity4.m2.*"
      "=== Cycle completed at.*--- ReentrantMonitor : dd.sanity4.m1.*"
      "###!!! ASSERTION: Potential deadlock detected.*";
  ASSERT_DEATH_IF_SUPPORTED(Sanity4_Child(), regex);
}