# Global Metrics

path: .metrics.cognitive.average
old: 0.0
new: 0.1
path: .metrics.cognitive.sum
old: 0.0
new: 1.0
path: .metrics.halstead.purity_ratio
old: 2.3455532121088987
new: 1.3898773002021771
path: .metrics.halstead.time
old: 459.2815862071593
new: 2136.4082141912786
path: .metrics.halstead.N2
old: 74.0
new: 132.0
path: .metrics.halstead.N1
old: 79.0
new: 177.0
path: .metrics.halstead.volume
old: 928.1116461400392
new: 1942.1892856284348
path: .metrics.halstead.vocabulary
old: 67.0
new: 78.0
path: .metrics.halstead.n2
old: 54.0
new: 60.0
path: .metrics.halstead.level
old: 0.11226611226611229
new: 0.050505050505050504
path: .metrics.halstead.bugs
old: 0.13628449143039165
new: 0.3797664323946158
path: .metrics.halstead.effort
old: 8267.068551728868
new: 38455.34785544301
path: .metrics.halstead.n1
old: 13.0
new: 18.0
path: .metrics.halstead.estimated_program_length
old: 358.8696414526615
new: 429.4720857624727
path: .metrics.halstead.difficulty
old: 8.907407407407407
new: 19.8
path: .metrics.halstead.length
old: 153.0
new: 309.0
path: .metrics.nom.functions
old: 1.0
new: 10.0
path: .metrics.nom.total
old: 1.0
new: 10.0
path: .metrics.cyclomatic.average
old: 1.0
new: 1.1111111111111112
path: .metrics.cyclomatic.sum
old: 7.0
new: 20.0
path: .metrics.loc.blank
old: 17.0
new: 21.0
path: .metrics.loc.ploc
old: 42.0
new: 77.0
path: .metrics.loc.sloc
old: 83.0
new: 132.0
path: .metrics.loc.lloc
old: 1.0
new: 6.0
path: .metrics.loc.cloc
old: 24.0
new: 34.0
path: .metrics.mi.mi_sei
old: 51.85134556142588
new: 30.864061621199586
path: .metrics.mi.mi_visual_studio
old: 36.41660326167578
new: 28.027157347222055
path: .metrics.mi.mi_original
old: 62.272391577465584
new: 47.926439063749726
path: .metrics.nexits.sum
old: 1.0
new: 4.0
path: .metrics.nexits.average
old: 1.0
new: 0.4
path: .metrics.nargs.average
old: 0.0
new: 1.0
path: .metrics.nargs.sum
old: 0.0
new: 10.0

# Spaces Data

## Minimal test - lines (17, 130)

path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 4.0
path: .spaces[1].metrics.nexits.average
old: null
new: 0.4
path: .spaces[1].metrics.mi.mi_sei
old: null
new: 33.902594874200474
path: .spaces[1].metrics.mi.mi_visual_studio
old: null
new: 29.811401574537825
path: .spaces[1].metrics.mi.mi_original
old: null
new: 50.97749669245968
path: .spaces[1].metrics.nom.functions
old: 0.0
new: 10.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 10.0
path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 27.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 18.0
path: .spaces[1].metrics.loc.ploc
old: 1.0
new: 69.0
path: .spaces[1].metrics.loc.sloc
old: 1.0
new: 114.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 6.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 1.125
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 18.0
path: .spaces[1].metrics.halstead.N2
old: 1.0
new: 125.0
path: .spaces[1].metrics.halstead.effort
old: 0.0
new: 38109.6243863772
path: .spaces[1].metrics.halstead.estimated_program_length
old: null
new: 393.0334342698179
path: .spaces[1].metrics.halstead.level
old: null
new: 0.04888888888888889
path: .spaces[1].metrics.halstead.purity_ratio
old: null
new: 1.3057589178399267
path: .spaces[1].metrics.halstead.volume
old: 0.0
new: 1863.1371922228852
path: .spaces[1].metrics.halstead.N1
old: 0.0
new: 176.0
path: .spaces[1].metrics.halstead.n1
old: 0.0
new: 18.0
path: .spaces[1].metrics.halstead.difficulty
old: 0.0
new: 20.454545454545453
path: .spaces[1].metrics.halstead.vocabulary
old: 1.0
new: 73.0
path: .spaces[1].metrics.halstead.n2
old: 1.0
new: 55.0
path: .spaces[1].metrics.halstead.bugs
old: 0.0
new: 0.37748687625066185
path: .spaces[1].metrics.halstead.length
old: 1.0
new: 301.0
path: .spaces[1].metrics.halstead.time
old: 0.0
new: 2117.201354798733
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[1].metrics.cognitive.average
old: null
new: 0.1
path: .spaces[1].metrics.nargs.average
old: null
new: 1.0
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 10.0

### Code

    namespace mozilla {

    enum class EventQueuePriority {
      Idle,
      DeferredTimers,
      InputLow,
      Normal,
      MediumHigh,
      InputHigh,
      High,

      Count
    };

    class IdlePeriodState;

    namespace detail {

    // EventQueue is our unsynchronized event queue implementation. It is a queue
    // of runnables used for non-main thread, as well as optionally providing
    // forwarding to TaskController.
    //
    // Since EventQueue is unsynchronized, it should be wrapped in an outer
    // SynchronizedEventQueue implementation (like ThreadEventQueue).
    template
    class EventQueueInternal {
     public:
      explicit EventQueueInternal(bool aForwardToTC) : mForwardToTC(aForwardToTC) {}

      // Add an event to the end of the queue. Implementors are free to use
      // aPriority however they wish.  If the runnable supports
      // nsIRunnablePriority and the implementing class supports
      // prioritization, aPriority represents the result of calling
      // nsIRunnablePriority::GetPriority().  *aDelay is time the event has
      // already been delayed (used when moving an event from one queue to
      // another)
      void PutEvent(already_AddRefed&& aEvent,
                    EventQueuePriority aPriority, const MutexAutoLock& aProofOfLock,
                    mozilla::TimeDuration* aDelay = nullptr);

      // Get an event from the front of the queue. This should return null if the
      // queue is non-empty but the event in front is not ready to run.
      // *aLastEventDelay is the time the event spent in queues before being
      // retrieved.
      already_AddRefed GetEvent(
          const MutexAutoLock& aProofOfLock,
          mozilla::TimeDuration* aLastEventDelay = nullptr);

      // Returns true if the queue is empty. Implies !HasReadyEvent().
      bool IsEmpty(const MutexAutoLock& aProofOfLock);

      // Returns true if the queue is non-empty and if the event in front is ready
      // to run. Implies !IsEmpty(). This should return true iff GetEvent returns a
      // non-null value.
      bool HasReadyEvent(const MutexAutoLock& aProofOfLock);

      // Returns the number of events in the queue.
      size_t Count(const MutexAutoLock& aProofOfLock) const;
      // For some reason, if we put this in the .cpp file the linker can't find it
      already_AddRefed PeekEvent(const MutexAutoLock& aProofOfLock) {
        if (mQueue.IsEmpty()) {
          return nullptr;
        }

        nsCOMPtr result = mQueue.FirstElement();
        return result.forget();
      }

      void EnableInputEventPrioritization(const MutexAutoLock& aProofOfLock) {}
      void FlushInputEventPrioritization(const MutexAutoLock& aProofOfLock) {}
      void SuspendInputEventPrioritization(const MutexAutoLock& aProofOfLock) {}
      void ResumeInputEventPrioritization(const MutexAutoLock& aProofOfLock) {}

      size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
        return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
      }

      size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
        size_t size = mQueue.ShallowSizeOfExcludingThis(aMallocSizeOf);
    #ifdef MOZ_GECKO_PROFILER
        size += mDispatchTimes.ShallowSizeOfExcludingThis(aMallocSizeOf);
    #endif
        return size;
      }

     private:
      mozilla::Queue, ItemsPerPage> mQueue;
    #ifdef MOZ_GECKO_PROFILER
      // This queue is only populated when the profiler is turned on.
      mozilla::Queue mDispatchTimes;
      TimeDuration mLastEventDelay;
    #endif
      // This indicates PutEvent forwards runnables to the TaskController. This
      // should be true for the top level event queue on the main thread.
      bool mForwardToTC;
    };

    }  // namespace detail

    class EventQueue final : public mozilla::detail::EventQueueInternal<16> {
     public:
      explicit EventQueue(bool aForwardToTC = false)
          : mozilla::detail::EventQueueInternal<16>(aForwardToTC) {}
    };

    template
    class EventQueueSized final
        : public mozilla::detail::EventQueueInternal {
     public:
      explicit EventQueueSized(bool aForwardToTC = false)
          : mozilla::detail::EventQueueInternal(aForwardToTC) {}
    };

    }  // namespace mozilla