# Global Metrics

path: .metrics.nexits.average
old: 1.375
new: 0.2
path: .metrics.nexits.sum
old: 11.0
new: 1.0
path: .metrics.mi.mi_original
old: 37.528227018587344
new: 43.05260374411695
path: .metrics.mi.mi_visual_studio
old: 21.94633158981716
new: 25.17696125386956
path: .metrics.mi.mi_sei
old: 5.865250911515101
new: 21.674887529192915
path: .metrics.nargs.sum
old: 64.0
new: 4.0
path: .metrics.nargs.average
old: 8.0
new: 0.8
path: .metrics.halstead.difficulty
old: 51.295081967213115
new: 15.06315789473684
path: .metrics.halstead.n1
old: 21.0
new: 18.0
path: .metrics.halstead.length
old: 644.0
new: 368.0
path: .metrics.halstead.estimated_program_length
old: 454.01364346969007
new: 699.1949328174017
path: .metrics.halstead.effort
old: 210015.5813648818
new: 37805.90318988987
path: .metrics.halstead.n2
old: 61.0
new: 95.0
path: .metrics.halstead.N2
old: 298.0
new: 159.0
path: .metrics.halstead.N1
old: 346.0
new: 209.0
path: .metrics.halstead.level
old: 0.019495046340683924
new: 0.06638714185883998
path: .metrics.halstead.vocabulary
old: 82.0
new: 113.0
path: .metrics.halstead.time
old: 11667.53229804899
new: 2100.3279549938816
path: .metrics.halstead.bugs
old: 1.1777318585108651
new: 0.3754785717403569
path: .metrics.halstead.volume
old: 4094.263490974046
new: 2509.825858168789
path: .metrics.halstead.purity_ratio
old: 0.70499012961132
new: 1.8999862304820696
path: .metrics.loc.cloc
old: 25.0
new: 43.0
path: .metrics.loc.sloc
old: 206.0
new: 184.0
path: .metrics.loc.lloc
old: 28.0
new: 7.0
path: .metrics.loc.ploc
old: 163.0
new: 100.0
path: .metrics.loc.blank
old: 18.0
new: 41.0
path: .metrics.nom.functions
old: 8.0
new: 5.0
path: .metrics.nom.total
old: 8.0
new: 5.0
path: .metrics.cyclomatic.average
old: 1.8888888888888888
new: 1.0
path: .metrics.cyclomatic.sum
old: 17.0
new: 12.0
path: .metrics.cognitive.sum
old: 10.0
new: 0.0
path: .metrics.cognitive.average
old: 1.25
new: 0.0

# Spaces Data

## Minimal test - lines (168, 182)

path: .spaces[5].metrics.loc.lloc
old: 8.0
new: 0.0
path: .spaces[5].metrics.loc.sloc
old: 30.0
new: 15.0
path: .spaces[5].metrics.loc.ploc
old: 27.0
new: 7.0
path: .spaces[5].metrics.loc.blank
old: 3.0
new: 1.0
path: .spaces[5].metrics.loc.cloc
old: 0.0
new: 7.0
path: .spaces[5].metrics.mi.mi_visual_studio
old: 47.3946671967252
new: 59.03136641413612
path: .spaces[5].metrics.mi.mi_sei
old: 41.52765535930067
new: 113.60802159394964
path: .spaces[5].metrics.mi.mi_original
old: 81.0448809064001
new: 100.94363656817276
path: .spaces[5].metrics.nexits.average
old: 2.0
new: null
path: .spaces[5].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[5].metrics.cyclomatic.sum
old: 3.0
new: 1.0
path: .spaces[5].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[5].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[5].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[5].metrics.halstead.N1
old: 66.0
new: 16.0
path: .spaces[5].metrics.halstead.N2
old: 58.0
new: 17.0
path: .spaces[5].metrics.halstead.volume
old: 713.6060502682701
new: 147.1612434150308
path: .spaces[5].metrics.halstead.bugs
old: 0.14114776864252368
new: 0.026647816499510507
path: .spaces[5].metrics.halstead.purity_ratio
old: 2.1243648831520665
new: 2.3425142093577715
path: .spaces[5].metrics.halstead.difficulty
old: 12.210526315789474
new: 4.857142857142857
path: .spaces[5].metrics.halstead.length
old: 124.0
new: 33.0
path: .spaces[5].metrics.halstead.vocabulary
old: 54.0
new: 22.0
path: .spaces[5].metrics.halstead.n1
old: 16.0
new: 8.0
path: .spaces[5].metrics.halstead.effort
old: 8713.505455907298
new: 714.7831823015782
path: .spaces[5].metrics.halstead.time
old: 484.0836364392943
new: 39.71017679453213
path: .spaces[5].metrics.halstead.level
old: 0.08189655172413793
new: 0.2058823529411765
path: .spaces[5].metrics.halstead.estimated_program_length
old: 263.42124551085624
new: 77.30296890880646
path: .spaces[5].metrics.halstead.n2
old: 38.0
new: 14.0
path: .spaces[5].metrics.nargs.sum
old: 10.0
new: 0.0
path: .spaces[5].metrics.nargs.average
old: 10.0
new: null
path: .spaces[5].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[5].metrics.cognitive.average
old: 3.0
new: null

### Code

    class nsDumpUtils {
     public:
      enum Mode { CREATE, CREATE_UNIQUE };

      /**
       * This function creates a new unique file based on |aFilename| in a
       * world-readable temp directory. This is the system temp directory
       * or, in the case of Android, the downloads directory. If |aFile| is
       * non-null, it is assumed to point to a folder, and that folder is used
       * instead.
       */
      static nsresult OpenTempFile(const nsACString& aFilename, nsIFile** aFile,
                                   const nsACString& aFoldername = ""_ns,
                                   Mode aMode = CREATE_UNIQUE);
    };

## Minimal test - lines (98, 130)

path: .spaces[2].metrics.mi.mi_sei
old: 65.3412757473995
new: 76.8742027602253
path: .spaces[2].metrics.mi.mi_visual_studio
old: 57.1300450492854
new: 48.49881250490888
path: .spaces[2].metrics.mi.mi_original
old: 97.69237703427802
new: 82.93296938339417
path: .spaces[2].metrics.nargs.average
old: 9.0
new: 1.0
path: .spaces[2].metrics.nargs.sum
old: 9.0
new: 1.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 2.437074545769232
new: 2.1370921128802967
path: .spaces[2].metrics.halstead.difficulty
old: 4.5
new: 8.666666666666666
path: .spaces[2].metrics.halstead.volume
old: 275.0
new: 385.4995490565423
path: .spaces[2].metrics.halstead.N1
old: 28.0
new: 42.0
path: .spaces[2].metrics.halstead.time
old: 68.75
new: 185.61089399018704
path: .spaces[2].metrics.halstead.effort
old: 1237.5
new: 3340.9960918233664
path: .spaces[2].metrics.halstead.vocabulary
old: 32.0
new: 37.0
path: .spaces[2].metrics.halstead.length
old: 55.0
new: 74.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 134.03910001730776
new: 158.14481635314195
path: .spaces[2].metrics.halstead.level
old: 0.2222222222222222
new: 0.1153846153846154
path: .spaces[2].metrics.halstead.N2
old: 27.0
new: 32.0
path: .spaces[2].metrics.halstead.bugs
old: 0.038421609202381427
new: 0.07449538866787052
path: .spaces[2].metrics.halstead.n1
old: 8.0
new: 13.0
path: .spaces[2].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[2].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[2].metrics.loc.lloc
old: 1.0
new: 0.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 7.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 9.0
path: .spaces[2].metrics.loc.sloc
old: 15.0
new: 33.0
path: .spaces[2].metrics.loc.ploc
old: 15.0
new: 17.0

### Code

    class FifoWatcher : public FdWatcher {
     public:
      /**
       * The name of the preference used to enable/disable the FifoWatcher.
       */
      // The length of this array must match the size of the string constant in
      // the definition in nsDumpUtils.cpp. A mismatch will result in a compile-time
      // error.
      static const char kPrefName[38];

      static FifoWatcher* GetSingleton();

      static bool MaybeCreate();

      void RegisterCallback(const nsCString& aCommand, FifoCallback aCallback);

      virtual ~FifoWatcher();

      virtual int OpenFd() override;

      virtual void OnFileCanReadWithoutBlocking(int aFd) override;

     private:
      nsAutoCString mDirPath;

      static mozilla::StaticRefPtr sSingleton;

      explicit FifoWatcher(nsCString aPath)
          : mDirPath(aPath), mFifoInfoLock("FifoWatcher.mFifoInfoLock") {}

      mozilla::Mutex mFifoInfoLock;  // protects mFifoInfo
      FifoInfoArray mFifoInfo;
    };

## Minimal test - lines (36, 89)

path: .spaces[0].metrics.nexits.average
old: 1.0
new: 0.3333333333333333
path: .spaces[0].metrics.mi.mi_visual_studio
old: 59.834817471876335
new: 41.924543490621815
path: .spaces[0].metrics.mi.mi_original
old: 102.31753787690856
new: 71.69096936896331
path: .spaces[0].metrics.mi.mi_sei
old: 72.01397235837636
new: 66.32614591282814
path: .spaces[0].metrics.nargs.average
old: 8.0
new: 1.0
path: .spaces[0].metrics.nargs.sum
old: 8.0
new: 3.0
path: .spaces[0].metrics.loc.sloc
old: 13.0
new: 54.0
path: .spaces[0].metrics.loc.ploc
old: 13.0
new: 25.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 12.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 17.0
path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 6.0
path: .spaces[0].metrics.nom.total
old: 1.0
new: 3.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 3.0
path: .spaces[0].metrics.halstead.volume
old: 176.46653521143952
new: 660.9960733496389
path: .spaces[0].metrics.halstead.estimated_program_length
old: 96.22039775975506
new: 218.60335893412775
path: .spaces[0].metrics.halstead.bugs
old: 0.021813958751237063
new: 0.12164488837690224
path: .spaces[0].metrics.halstead.effort
old: 529.3996056343185
new: 6971.442961109473
path: .spaces[0].metrics.halstead.level
old: 0.3333333333333333
new: 0.0948148148148148
path: .spaces[0].metrics.halstead.difficulty
old: 3.0
new: 10.546875
path: .spaces[0].metrics.halstead.time
old: 29.411089201906584
new: 387.302386728304
path: .spaces[0].metrics.halstead.N2
old: 19.0
new: 45.0
path: .spaces[0].metrics.halstead.n2
old: 19.0
new: 32.0
path: .spaces[0].metrics.halstead.length
old: 38.0
new: 119.0
path: .spaces[0].metrics.halstead.N1
old: 19.0
new: 74.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 2.53211573051987
new: 1.8370030162531747
path: .spaces[0].metrics.halstead.n1
old: 6.0
new: 15.0
path: .spaces[0].metrics.halstead.vocabulary
old: 25.0
new: 47.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 4.0

### Code

    class FdWatcher : public MessageLoopForIO::Watcher, public nsIObserver {
     protected:
      MessageLoopForIO::FileDescriptorWatcher mReadWatcher;
      int mFd;

      virtual ~FdWatcher() {
        // StopWatching should have run.
        MOZ_ASSERT(mFd == -1);
      }

     public:
      FdWatcher() : mFd(-1) { MOZ_ASSERT(NS_IsMainThread()); }

      /**
       * Open the fd to watch.  If we encounter an error, return -1.
       */
      virtual int OpenFd() = 0;

      /**
       * Called when you can read() from the fd without blocking.  Note that this
       * function is also called when you're at eof (read() returns 0 in this case).
       */
      virtual void OnFileCanReadWithoutBlocking(int aFd) override = 0;
      virtual void OnFileCanWriteWithoutBlocking(int aFd) override{};

      NS_DECL_THREADSAFE_ISUPPORTS

      /**
       * Initialize this object.  This should be called right after the object is
       * constructed.  (This would go in the constructor, except we interact with
       * XPCOM, which we can't do from a constructor because our refcount is 0 at
       * that point.)
       */
      void Init();

      // Implementations may call this function multiple times if they ensure that

      virtual void StartWatching();

      // Since implementations can call StartWatching() multiple times, they can of
      // course call StopWatching() multiple times.
      virtual void StopWatching();

      NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                         const char16_t* aData) override {
        MOZ_ASSERT(NS_IsMainThread());
        MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown"));

        XRE_GetIOMessageLoop()->PostTask(mozilla::NewRunnableMethod(
            "FdWatcher::StopWatching", this, &FdWatcher::StopWatching));

        return NS_OK;
      }
    };

## Minimal test - lines (92, 95)

path: .spaces[1].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[1].metrics.mi.mi_sei
old: 72.01397235837636
new: 115.02610035996176
path: .spaces[1].metrics.mi.mi_original
old: 102.31753787690856
new: 132.13127313109095
path: .spaces[1].metrics.mi.mi_visual_studio
old: 59.834817471876335
new: 77.26975036905904
path: .spaces[1].metrics.loc.sloc
old: 13.0
new: 4.0
path: .spaces[1].metrics.loc.lloc
old: 1.0
new: 0.0
path: .spaces[1].metrics.loc.ploc
old: 13.0
new: 4.0
path: .spaces[1].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[1].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[1].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 1.0
new: null
path: .spaces[1].metrics.halstead.n1
old: 6.0
new: 2.0
path: .spaces[1].metrics.halstead.effort
old: 529.3996056343185
new: 22.458839376460833
path: .spaces[1].metrics.halstead.difficulty
old: 3.0
new: 1.0
path: .spaces[1].metrics.halstead.time
old: 29.411089201906584
new: 1.2477132986922683
path: .spaces[1].metrics.halstead.volume
old: 176.46653521143952
new: 22.458839376460833
path: .spaces[1].metrics.halstead.N1
old: 19.0
new: 3.0
path: .spaces[1].metrics.halstead.length
old: 38.0
new: 8.0
path: .spaces[1].metrics.halstead.level
old: 0.3333333333333333
new: 1.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 96.22039775975506
new: 13.60964047443681
path: .spaces[1].metrics.halstead.bugs
old: 0.021813958751237063
new: 0.0026534054573181228
path: .spaces[1].metrics.halstead.N2
old: 19.0
new: 5.0
path: .spaces[1].metrics.halstead.vocabulary
old: 25.0
new: 7.0
path: .spaces[1].metrics.halstead.n2
old: 19.0
new: 5.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 2.53211573051987
new: 1.7012050593046013
path: .spaces[1].metrics.nargs.sum
old: 8.0
new: 0.0
path: .spaces[1].metrics.nargs.average
old: 8.0
new: null

### Code

    struct FifoInfo {
      nsCString mCommand;
      FifoCallback mCallback;
    };

## Minimal test - lines (139, 164)

path: .spaces[4].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[4].metrics.cyclomatic.sum
old: 3.0
new: 2.0
path: .spaces[4].metrics.loc.blank
old: 2.0
new: 8.0
path: .spaces[4].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[4].metrics.loc.sloc
old: 25.0
new: 26.0
path: .spaces[4].metrics.loc.ploc
old: 23.0
new: 17.0
path: .spaces[4].metrics.loc.lloc
old: 5.0
new: 1.0
path: .spaces[4].metrics.nargs.sum
old: 10.0
new: 0.0
path: .spaces[4].metrics.nargs.average
old: 10.0
new: 0.0
path: .spaces[4].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[4].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[4].metrics.mi.mi_sei
old: 47.59369335032068
new: 65.0636032394582
path: .spaces[4].metrics.mi.mi_visual_studio
old: 49.85353101581585
new: 50.9128188197379
path: .spaces[4].metrics.mi.mi_original
old: 85.2495380370451
new: 87.06092018175181
path: .spaces[4].metrics.cognitive.average
old: 3.0
new: 0.0
path: .spaces[4].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[4].metrics.halstead.n2
old: 32.0
new: 22.0
path: .spaces[4].metrics.halstead.vocabulary
old: 47.0
new: 34.0
path: .spaces[4].metrics.halstead.bugs
old: 0.11225362345938106
new: 0.0661747501545528
path: .spaces[4].metrics.halstead.difficulty
old: 11.015625
new: 7.636363636363637
path: .spaces[4].metrics.halstead.purity_ratio
old: 2.1643896924171067
new: 1.9600978558149225
path: .spaces[4].metrics.halstead.estimated_program_length
old: 218.60335893412775
new: 141.1270456186744
path: .spaces[4].metrics.halstead.volume
old: 561.0134740194414
new: 366.2973245700245
path: .spaces[4].metrics.halstead.n1
old: 15.0
new: 12.0
path: .spaces[4].metrics.halstead.N1
old: 54.0
new: 44.0
path: .spaces[4].metrics.halstead.length
old: 101.0
new: 72.0
path: .spaces[4].metrics.halstead.effort
old: 6179.91404974541
new: 2797.1795694438233
path: .spaces[4].metrics.halstead.time
old: 343.3285583191894
new: 155.39886496910128
path: .spaces[4].metrics.halstead.level
old: 0.09078014184397164
new: 0.13095238095238096
path: .spaces[4].metrics.halstead.N2
old: 47.0
new: 28.0

### Code

    class SignalPipeWatcher : public FdWatcher {
     public:
      static SignalPipeWatcher* GetSingleton();

      void RegisterCallback(uint8_t aSignal, PipeCallback aCallback);

      void RegisterSignalHandler(uint8_t aSignal = 0);

      virtual ~SignalPipeWatcher();

      virtual int OpenFd() override;

      virtual void StopWatching() override;

      virtual void OnFileCanReadWithoutBlocking(int aFd) override;

     private:
      static mozilla::StaticRefPtr sSingleton;

      SignalPipeWatcher() : mSignalInfoLock("SignalPipeWatcher.mSignalInfoLock") {
        MOZ_ASSERT(NS_IsMainThread());
      }

      mozilla::Mutex mSignalInfoLock;  // protects mSignalInfo
      SignalInfoArray mSignalInfo;
    };

## Minimal test - lines (133, 136)

path: .spaces[3].metrics.halstead.estimated_program_length
old: 206.8830545307996
new: 12.754887502163468
path: .spaces[3].metrics.halstead.length
old: 94.0
new: 8.0
path: .spaces[3].metrics.halstead.n2
old: 31.0
new: 4.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 2.2008835588382936
new: 1.5943609377704335
path: .spaces[3].metrics.halstead.vocabulary
old: 45.0
new: 7.0
path: .spaces[3].metrics.halstead.N2
old: 45.0
new: 4.0
path: .spaces[3].metrics.halstead.n1
old: 14.0
new: 3.0
path: .spaces[3].metrics.halstead.bugs
old: 0.100633480957435
new: 0.003476944758806696
path: .spaces[3].metrics.halstead.effort
old: 5245.605489752313
new: 33.68825906469125
path: .spaces[3].metrics.halstead.N1
old: 49.0
new: 4.0
path: .spaces[3].metrics.halstead.level
old: 0.0984126984126984
new: 0.6666666666666666
path: .spaces[3].metrics.halstead.difficulty
old: 10.161290322580646
new: 1.5
path: .spaces[3].metrics.halstead.volume
old: 516.2341910549894
new: 22.458839376460833
path: .spaces[3].metrics.halstead.time
old: 291.4225272084618
new: 1.871569948038403
path: .spaces[3].metrics.nargs.average
old: 10.0
new: null
path: .spaces[3].metrics.nargs.sum
old: 10.0
new: 0.0
path: .spaces[3].metrics.mi.mi_visual_studio
old: 49.7349247801512
new: 77.26975036905904
path: .spaces[3].metrics.mi.mi_original
old: 85.04672137405854
new: 132.13127313109095
path: .spaces[3].metrics.mi.mi_sei
old: 47.30109075642032
new: 115.02610035996176
path: .spaces[3].metrics.cognitive.average
old: 2.0
new: null
path: .spaces[3].metrics.cognitive.sum
old: 2.0
new: 0.0
path: .spaces[3].metrics.cyclomatic.average
old: 3.0
new: 1.0
path: .spaces[3].metrics.cyclomatic.sum
old: 3.0
new: 1.0
path: .spaces[3].metrics.loc.blank
old: 3.0
new: 0.0
path: .spaces[3].metrics.loc.lloc
old: 5.0
new: 0.0
path: .spaces[3].metrics.loc.ploc
old: 23.0
new: 4.0
path: .spaces[3].metrics.loc.sloc
old: 26.0
new: 4.0
path: .spaces[3].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[3].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[3].metrics.nexits.average
old: 2.0
new: null
path: .spaces[3].metrics.nexits.sum
old: 2.0
new: 0.0

### Code

    struct SignalInfo {
      uint8_t mSignal;
      PipeCallback mCallback;
    };