# Global Metrics

path: .metrics.halstead.volume
old: 531.7739459608056
new: 1000.1752304397662
path: .metrics.halstead.length
old: 98.0
new: 173.0
path: .metrics.halstead.purity_ratio
old: 2.185007005465589
new: 1.5480255754579928
path: .metrics.halstead.n2
old: 39.0
new: 37.0
path: .metrics.halstead.estimated_program_length
old: 214.1306865356277
new: 267.8084245542328
path: .metrics.halstead.vocabulary
old: 43.0
new: 55.0
path: .metrics.halstead.level
old: 0.4642857142857143
new: 0.057902973395931145
path: .metrics.halstead.n1
old: 4.0
new: 18.0
path: .metrics.halstead.N2
old: 42.0
new: 71.0
path: .metrics.halstead.N1
old: 56.0
new: 102.0
path: .metrics.halstead.time
old: 63.63107045684853
new: 959.6275859624784
path: .metrics.halstead.bugs
old: 0.03648994719832063
new: 0.22273864052608475
path: .metrics.halstead.difficulty
old: 2.1538461538461537
new: 17.27027027027027
path: .metrics.halstead.effort
old: 1145.3592682232736
new: 17273.29654732461
path: .metrics.nexits.sum
old: 0.0
new: 2.0
path: .metrics.nexits.average
old: null
new: 1.0
path: .metrics.nargs.average
old: null
new: 0.5
path: .metrics.nargs.sum
old: 0.0
new: 1.0
path: .metrics.mi.mi_sei
old: 77.26369407076155
new: 51.607549012614285
path: .metrics.mi.mi_visual_studio
old: 44.37407792551243
new: 36.611376603241744
path: .metrics.mi.mi_original
old: 75.87967325262626
new: 62.605453991543385
path: .metrics.cognitive.sum
old: 0.0
new: 5.0
path: .metrics.cognitive.average
old: null
new: 2.5
path: .metrics.nom.functions
old: 0.0
new: 2.0
path: .metrics.nom.total
old: 0.0
new: 2.0
path: .metrics.loc.cloc
old: 21.0
new: 20.0
path: .metrics.loc.lloc
old: 0.0
new: 12.0
path: .metrics.loc.blank
old: 0.0
new: 12.0
path: .metrics.loc.ploc
old: 27.0
new: 43.0
path: .metrics.loc.sloc
old: 46.0
new: 75.0
path: .metrics.cyclomatic.sum
old: 2.0
new: 11.0
path: .metrics.cyclomatic.average
old: 1.0
new: 2.75

# Spaces Data

## Minimal test - lines (31, 75)

path: .spaces[0].metrics.loc.sloc
old: 30.0
new: 45.0
path: .spaces[0].metrics.loc.ploc
old: 24.0
new: 32.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 9.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 12.0
path: .spaces[0].metrics.loc.cloc
old: 9.0
new: 4.0
path: .spaces[0].metrics.halstead.n1
old: 4.0
new: 18.0
path: .spaces[0].metrics.halstead.vocabulary
old: 42.0
new: 43.0
path: .spaces[0].metrics.halstead.n2
old: 38.0
new: 25.0
path: .spaces[0].metrics.halstead.N2
old: 40.0
new: 57.0
path: .spaces[0].metrics.halstead.length
old: 96.0
new: 150.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 207.42124551085624
new: 191.15505477032977
path: .spaces[0].metrics.halstead.N1
old: 56.0
new: 93.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 2.160637974071419
new: 1.2743670318021982
path: .spaces[0].metrics.halstead.time
old: 60.54531843120011
new: 927.8912730540586
path: .spaces[0].metrics.halstead.difficulty
old: 2.1052631578947367
new: 20.52
path: .spaces[0].metrics.halstead.effort
old: 1089.815731761602
new: 16702.042914973055
path: .spaces[0].metrics.halstead.level
old: 0.475
new: 0.04873294346978558
path: .spaces[0].metrics.halstead.bugs
old: 0.03530049487631704
new: 0.21780030091422195
path: .spaces[0].metrics.halstead.volume
old: 517.662472586761
new: 813.9397132053147
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.5
path: .spaces[0].metrics.mi.mi_visual_studio
old: 48.63983658934969
new: 42.21184731067653
path: .spaces[0].metrics.mi.mi_original
old: 83.17412056778798
new: 72.18225890125687
path: .spaces[0].metrics.mi.mi_sei
old: 81.91126850177275
new: 51.735938204539195
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 5.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 2.5
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 10.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 3.3333333333333335
path: .spaces[0].metrics.nom.total
old: 0.0
new: 2.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 2.0

### Code

    namespace mozilla {

    NS_IMETHODIMP
    MainThreadIdlePeriod::GetIdlePeriodHint(TimeStamp* aIdleDeadline) {
      MOZ_ASSERT(NS_IsMainThread());
      MOZ_ASSERT(aIdleDeadline);

      TimeStamp now = TimeStamp::Now();
      TimeStamp currentGuess =
          now + TimeDuration::FromMilliseconds(kLongIdlePeriodMS);

      currentGuess = nsRefreshDriver::GetIdleDeadlineHint(currentGuess);
      if (XRE_IsContentProcess()) {
        currentGuess = gfx::VRManagerChild::GetIdleDeadlineHint(currentGuess);
      }
      currentGuess = NS_GetTimerDeadlineHintOnCurrentThread(currentGuess,
                                                            kMaxTimerThreadBound);

      // If the idle period is too small, then just return a null time
      // to indicate we are busy. Otherwise return the actual deadline.
      TimeDuration minIdlePeriod =
          TimeDuration::FromMilliseconds(StaticPrefs::idle_period_min());
      bool busySoon = currentGuess.IsNull() ||
                      (now >= (currentGuess - minIdlePeriod)) ||
                      currentGuess < mLastIdleDeadline;

      // During page load use higher minimum idle period.
      if (!busySoon && XRE_IsContentProcess() &&
          mozilla::dom::Document::HasRecentlyStartedForegroundLoads()) {
        TimeDuration minIdlePeriod = TimeDuration::FromMilliseconds(
            StaticPrefs::idle_period_during_page_load_min());
        busySoon = (now >= (currentGuess - minIdlePeriod));
      }

      if (!busySoon) {
        *aIdleDeadline = mLastIdleDeadline = currentGuess;
      }

      return NS_OK;
    }

    /* static */
    float MainThreadIdlePeriod::GetLongIdlePeriod() { return kLongIdlePeriodMS; }

    }  // namespace mozilla