# Global Metrics

path: .metrics.nexits.average
old: 0.6
new: 0.6521739130434783
path: .metrics.nexits.sum
old: 3.0
new: 30.0
path: .metrics.cognitive.sum
old: 3.0
new: 19.0
path: .metrics.cognitive.average
old: 0.6
new: 0.4130434782608696
path: .metrics.loc.lloc
old: 13.0
new: 101.0
path: .metrics.loc.blank
old: 8.0
new: 80.0
path: .metrics.loc.cloc
old: 11.0
new: 50.0
path: .metrics.loc.ploc
old: 40.0
new: 294.0
path: .metrics.loc.sloc
old: 59.0
new: 424.0
path: .metrics.halstead.n2
old: 36.0
new: 166.0
path: .metrics.halstead.bugs
old: 0.2345812482752907
new: 2.3718970726033106
path: .metrics.halstead.N1
old: 92.0
new: 902.0
path: .metrics.halstead.estimated_program_length
old: 272.5558619496705
new: 1365.137994462289
path: .metrics.halstead.purity_ratio
old: 1.672121852451966
new: 0.908275445417358
path: .metrics.halstead.effort
old: 18669.03292027018
new: 600240.9775229758
path: .metrics.halstead.time
old: 1037.1684955705657
new: 33346.72097349865
path: .metrics.halstead.difficulty
old: 19.72222222222222
new: 52.49698795180723
path: .metrics.halstead.length
old: 163.0
new: 1503.0
path: .metrics.halstead.level
old: 0.05070422535211268
new: 0.019048711916920077
path: .metrics.halstead.vocabulary
old: 56.0
new: 195.0
path: .metrics.halstead.n1
old: 20.0
new: 29.0
path: .metrics.halstead.volume
old: 946.5988522953894
new: 11433.817461565664
path: .metrics.halstead.N2
old: 71.0
new: 601.0
path: .metrics.cyclomatic.sum
old: 14.0
new: 68.0
path: .metrics.cyclomatic.average
old: 1.75
new: 1.36
path: .metrics.mi.mi_original
old: 66.08894130261294
new: 8.763798451975816
path: .metrics.mi.mi_sei
old: 52.07787612622067
new: -30.7709236693047
path: .metrics.mi.mi_visual_studio
old: 38.64850368573856
new: 5.125028334488781
path: .metrics.nom.functions
old: 5.0
new: 46.0
path: .metrics.nom.total
old: 5.0
new: 46.0
path: .metrics.nargs.average
old: 0.6
new: 1.326086956521739
path: .metrics.nargs.sum
old: 3.0
new: 61.0

# Spaces Data

## Minimal test - lines (54, 55)

path: .spaces[0].spaces[0].metrics.halstead.time
old: 1051.169727814303
new: 10.519438967143312
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.04516129032258065
new: 0.3333333333333333
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 91.0
new: 10.0
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 18921.05510065746
new: 189.34990140857963
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 221.04449971536013
new: 23.509775004326936
path: .spaces[0].spaces[0].metrics.halstead.length
old: 153.0
new: 19.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 22.142857142857142
new: 3.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.23668767609167157
new: 0.0109914621192158
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 48.0
new: 10.0
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 28.0
new: 6.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.4447352922572558
new: 1.237356579175102
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 62.0
new: 9.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 20.0
new: 4.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 854.4992626103369
new: 63.11663380285988
path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.6
new: 0.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 3.0
new: 0.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 39.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 7.0
new: 0.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 13.0
new: 0.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 29.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 3.0
new: 0.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 12.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 52.80251194499388
new: 123.47426853274132
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 73.78762000674556
new: 137.98709708094938
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 43.150654974705006
new: 80.69420881926865
path: .spaces[0].spaces[0].metrics.nom.functions
old: 5.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 5.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.6
new: 0.0
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 3.0
new: 0.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 0.6
new: 0.0

### Code

      nsStringStats()
          : mAllocCount(0), mReallocCount(0), mFreeCount(0), mShareCount(0) {}

## Minimal test - lines (52, 99)

path: .spaces[0].metrics.loc.ploc
old: 31.0
new: 39.0
path: .spaces[0].metrics.loc.lloc
old: 13.0
new: 18.0
path: .spaces[0].metrics.loc.blank
old: 6.0
new: 5.0
path: .spaces[0].metrics.loc.sloc
old: 41.0
new: 48.0
path: .spaces[0].metrics.cognitive.average
old: 0.6
new: 4.0
path: .spaces[0].metrics.cognitive.sum
old: 3.0
new: 8.0
path: .spaces[0].metrics.cyclomatic.sum
old: 13.0
new: 9.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.8571428571428572
new: 3.0
path: .spaces[0].metrics.nexits.sum
old: 3.0
new: 2.0
path: .spaces[0].metrics.nexits.average
old: 0.6
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 5.0
new: 2.0
path: .spaces[0].metrics.nom.total
old: 5.0
new: 2.0
path: .spaces[0].metrics.mi.mi_original
old: 72.6522943704667
new: 70.27618809772147
path: .spaces[0].metrics.mi.mi_visual_studio
old: 42.4867218540741
new: 41.09718602205934
path: .spaces[0].metrics.mi.mi_sei
old: 53.69906922180613
new: 48.22537675148368
path: .spaces[0].metrics.nargs.average
old: 0.6
new: 0.0
path: .spaces[0].metrics.nargs.sum
old: 3.0
new: 0.0
path: .spaces[0].metrics.halstead.N2
old: 63.0
new: 76.0
path: .spaces[0].metrics.halstead.vocabulary
old: 49.0
new: 43.0
path: .spaces[0].metrics.halstead.volume
old: 870.2800258378572
new: 1003.858979619888
path: .spaces[0].metrics.halstead.N1
old: 92.0
new: 109.0
path: .spaces[0].metrics.halstead.n1
old: 20.0
new: 17.0
path: .spaces[0].metrics.halstead.level
old: 0.04603174603174603
new: 0.04024767801857585
path: .spaces[0].metrics.halstead.n2
old: 29.0
new: 26.0
path: .spaces[0].metrics.halstead.time
old: 1050.3379622181037
new: 1385.6685915265978
path: .spaces[0].metrics.halstead.difficulty
old: 21.724137931034484
new: 24.846153846153847
path: .spaces[0].metrics.halstead.estimated_program_length
old: 227.32001075644683
new: 191.69830097292416
path: .spaces[0].metrics.halstead.length
old: 155.0
new: 185.0
path: .spaces[0].metrics.halstead.effort
old: 18906.083319925867
new: 24942.03464747876
path: .spaces[0].metrics.halstead.bugs
old: 0.23656280273528413
new: 0.2845552902179658
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4665807145577214
new: 1.0362070322860766

### Code

    class nsStringStats {
     public:
      nsStringStats()
          : mAllocCount(0), mReallocCount(0), mFreeCount(0), mShareCount(0) {}

      ~nsStringStats() {
        // this is a hack to suppress duplicate string stats printing
        // in seamonkey as a result of the string code being linked
        // into seamonkey and libxpcom! :-(
        if (!mAllocCount && !mAdoptCount) {
          return;
        }

        // Only print the stats if we detect a leak.
        if (mAllocCount <= mFreeCount && mAdoptCount <= mAdoptFreeCount) {
          return;
        }

        printf("nsStringStats\n");
        printf(" => mAllocCount:     % 10d\n", int(mAllocCount));
        printf(" => mReallocCount:   % 10d\n", int(mReallocCount));
        printf(" => mFreeCount:      % 10d", int(mFreeCount));
        if (mAllocCount > mFreeCount) {
          printf("  --  LEAKED %d !!!\n", mAllocCount - mFreeCount);
        } else {
          printf("\n");
        }
        printf(" => mShareCount:     % 10d\n", int(mShareCount));
        printf(" => mAdoptCount:     % 10d\n", int(mAdoptCount));
        printf(" => mAdoptFreeCount: % 10d", int(mAdoptFreeCount));
        if (mAdoptCount > mAdoptFreeCount) {
          printf("  --  LEAKED %d !!!\n", mAdoptCount - mAdoptFreeCount);
        } else {
          printf("\n");
        }
        printf(" => Process ID: %" PRIuPTR ", Thread ID: %" PRIuPTR "\n",
               uintptr_t(getpid()), uintptr_t(pthread_self()));
      }

      typedef Atomic AtomicInt;

      AtomicInt mAllocCount;
      AtomicInt mReallocCount;
      AtomicInt mFreeCount;
      AtomicInt mShareCount;
      AtomicInt mAdoptCount;
      AtomicInt mAdoptFreeCount;
    };