# Global Metrics

path: .metrics.nexits.average
old: 0.4615384615384616
new: 0.8
path: .metrics.nexits.sum
old: 6.0
new: 8.0
path: .metrics.cognitive.sum
old: 5.0
new: 0.0
path: .metrics.cognitive.average
old: 0.38461538461538464
new: 0.0
path: .metrics.loc.lloc
old: 61.0
new: 8.0
path: .metrics.loc.ploc
old: 129.0
new: 48.0
path: .metrics.loc.sloc
old: 163.0
new: 81.0
path: .metrics.loc.cloc
old: 10.0
new: 19.0
path: .metrics.loc.blank
old: 24.0
new: 14.0
path: .metrics.halstead.N2
old: 279.0
new: 65.0
path: .metrics.halstead.N1
old: 368.0
new: 106.0
path: .metrics.halstead.length
old: 647.0
new: 171.0
path: .metrics.halstead.time
old: 7448.673098009117
new: 574.761018112576
path: .metrics.halstead.difficulty
old: 28.822314049586776
new: 10.5625
path: .metrics.halstead.effort
old: 134076.1157641641
new: 10345.698326026368
path: .metrics.halstead.bugs
old: 0.8731985887592187
new: 0.15826514705253225
path: .metrics.halstead.n2
old: 121.0
new: 40.0
path: .metrics.halstead.level
old: 0.03469534050179211
new: 0.09467455621301776
path: .metrics.halstead.purity_ratio
old: 1.4733830857103465
new: 1.526215439364495
path: .metrics.halstead.n1
old: 25.0
new: 13.0
path: .metrics.halstead.vocabulary
old: 146.0
new: 53.0
path: .metrics.halstead.volume
old: 4651.816489595371
new: 979.474397730307
path: .metrics.halstead.estimated_program_length
old: 953.278856454594
new: 260.9828401313287
path: .metrics.mi.mi_original
old: 39.96717880776536
new: 61.00743997980689
path: .metrics.mi.mi_visual_studio
old: 23.3726191858277
new: 35.676865485267186
path: .metrics.mi.mi_sei
old: 2.714515020971888
new: 47.73116284727132
path: .metrics.nom.functions
old: 13.0
new: 10.0
path: .metrics.nom.total
old: 13.0
new: 10.0
path: .metrics.cyclomatic.average
old: 1.25
new: 1.0
path: .metrics.cyclomatic.sum
old: 20.0
new: 13.0
path: .metrics.nargs.average
old: 1.7692307692307692
new: 0.1
path: .metrics.nargs.sum
old: 23.0
new: 1.0

# Spaces Data

## Minimal test - lines (23, 77)

path: .spaces[0].spaces[0].metrics.nexits.average
old: 0.0
new: 0.8
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 8.0
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 827.1071577663389
new: 9975.467823044688
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.19117647058823528
new: 0.0923076923076923
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 2.002936564884283
new: 1.428189124315594
path: .spaces[0].spaces[0].metrics.halstead.time
old: 45.95039765368549
new: 554.192656835816
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 72.10571633583419
new: 234.2230163877574
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 13.0
new: 36.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 36.0
new: 164.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 8.0
new: 13.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.029371081029626187
new: 0.1544664835943495
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 5.230769230769231
new: 10.833333333333334
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 21.0
new: 49.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 158.12342722003538
new: 920.8124144348942
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 19.0
new: 104.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 17.0
new: 60.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 11.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 4.0
new: 0.1
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 4.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 1.0
new: 10.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 1.0
new: 10.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 81.43169691347437
new: 48.0910159321798
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 63.65228485354672
new: 39.80109323602617
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 108.8454070995649
new: 68.05986943360475
path: .spaces[0].spaces[0].metrics.loc.blank
old: 0.0
new: 10.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 4.0
new: 8.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 9.0
new: 39.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 9.0
new: 55.0

### Code

    class MemoryInfo final {
     public:
      enum class Perm : uint8_t {
        Read,
        Write,
        Execute,
        CopyOnWrite,
        Guard,
        NoCache,
        WriteCombine,
      };
      enum class PageType : uint8_t {
        Image,
        Mapped,
        Private,
      };

      using PermSet = EnumSet;
      using PageTypeSet = EnumSet;

      MemoryInfo() = default;
      MOZ_IMPLICIT MemoryInfo(const MemoryInfo&) = default;

      uintptr_t Start() const { return mStart; }
      uintptr_t End() const { return mEnd; }

      PageTypeSet Type() const { return mType; }
      PermSet Perms() const { return mPerms; }

      size_t Reserved() const { return mReserved; }
      size_t Committed() const { return mCommitted; }
      size_t Free() const { return mFree; }
      size_t Size() const { return mSize; }

      // Returns a MemoryInfo object containing the sums of all region sizes,
      // divided into Reserved, Committed, and Free, depending on their State
      // properties.
      //
      // The entire range of aSize bytes starting at aPtr must correspond to a
      // single allocation. This restriction is enforced in debug builds.
      static MemoryInfo Get(const void* aPtr, size_t aSize);

     private:
      uintptr_t mStart = 0;
      uintptr_t mEnd = 0;

      size_t mReserved = 0;
      size_t mCommitted = 0;
      size_t mFree = 0;
      size_t mSize = 0;

      PageTypeSet mType{};

      PermSet mPerms{};
    };

## Minimal test - lines (21, 79)

path: .spaces[0].metrics.nargs.sum
old: 23.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: 1.7692307692307692
new: 0.1
path: .spaces[0].metrics.nom.total
old: 13.0
new: 10.0
path: .spaces[0].metrics.nom.functions
old: 13.0
new: 10.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[0].metrics.loc.ploc
old: 122.0
new: 41.0
path: .spaces[0].metrics.loc.sloc
old: 143.0
new: 59.0
path: .spaces[0].metrics.loc.lloc
old: 61.0
new: 8.0
path: .spaces[0].metrics.loc.blank
old: 21.0
new: 12.0
path: .spaces[0].metrics.halstead.n1
old: 25.0
new: 13.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 919.9290769356264
new: 240.85549086410535
path: .spaces[0].metrics.halstead.effort
old: 135069.8754707709
new: 10100.29079821698
path: .spaces[0].metrics.halstead.difficulty
old: 29.38034188034188
new: 10.716216216216216
path: .spaces[0].metrics.halstead.N2
old: 275.0
new: 61.0
path: .spaces[0].metrics.halstead.level
old: 0.034036363636363635
new: 0.09331651954602777
path: .spaces[0].metrics.halstead.bugs
old: 0.8775079873815342
new: 0.15575236999455544
path: .spaces[0].metrics.halstead.length
old: 643.0
new: 167.0
path: .spaces[0].metrics.halstead.vocabulary
old: 142.0
new: 50.0
path: .spaces[0].metrics.halstead.N1
old: 368.0
new: 106.0
path: .spaces[0].metrics.halstead.n2
old: 117.0
new: 37.0
path: .spaces[0].metrics.halstead.time
old: 7503.881970598383
new: 561.12726656761
path: .spaces[0].metrics.halstead.volume
old: 4597.287397841511
new: 942.5239836923788
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.4306828568205698
new: 1.442248448288056
path: .spaces[0].metrics.cognitive.sum
old: 5.0
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: 0.38461538461538464
new: 0.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.2666666666666666
new: 1.0
path: .spaces[0].metrics.cyclomatic.sum
old: 19.0
new: 12.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 24.783136891943283
new: 38.930628249190434
path: .spaces[0].metrics.mi.mi_sei
old: -12.626064800557074
new: 45.27216685531453
path: .spaces[0].metrics.mi.mi_original
old: 42.37916408522301
new: 66.57137430611564
path: .spaces[0].metrics.nexits.average
old: 0.4615384615384616
new: 0.8
path: .spaces[0].metrics.nexits.sum
old: 6.0
new: 8.0

### Code

    namespace mozilla {

    class MemoryInfo final {
     public:
      enum class Perm : uint8_t {
        Read,
        Write,
        Execute,
        CopyOnWrite,
        Guard,
        NoCache,
        WriteCombine,
      };
      enum class PageType : uint8_t {
        Image,
        Mapped,
        Private,
      };

      using PermSet = EnumSet;
      using PageTypeSet = EnumSet;

      MemoryInfo() = default;
      MOZ_IMPLICIT MemoryInfo(const MemoryInfo&) = default;

      uintptr_t Start() const { return mStart; }
      uintptr_t End() const { return mEnd; }

      PageTypeSet Type() const { return mType; }
      PermSet Perms() const { return mPerms; }

      size_t Reserved() const { return mReserved; }
      size_t Committed() const { return mCommitted; }
      size_t Free() const { return mFree; }
      size_t Size() const { return mSize; }

      // Returns a MemoryInfo object containing the sums of all region sizes,
      // divided into Reserved, Committed, and Free, depending on their State
      // properties.
      //
      // The entire range of aSize bytes starting at aPtr must correspond to a
      // single allocation. This restriction is enforced in debug builds.
      static MemoryInfo Get(const void* aPtr, size_t aSize);

     private:
      uintptr_t mStart = 0;
      uintptr_t mEnd = 0;

      size_t mReserved = 0;
      size_t mCommitted = 0;
      size_t mFree = 0;
      size_t mSize = 0;

      PageTypeSet mType{};

      PermSet mPerms{};
    };

    }  // namespace mozilla