# Global Metrics

path: .metrics.cognitive.average
old: 8.214285714285714
new: 2.25
path: .metrics.cognitive.sum
old: 115.0
new: 9.0
path: .metrics.nargs.average
old: 0.8571428571428571
new: 0.75
path: .metrics.nargs.sum
old: 12.0
new: 3.0
path: .metrics.halstead.volume
old: 22913.330715284283
new: 1319.4412826640846
path: .metrics.halstead.difficulty
old: 60.41167664670659
new: 20.75
path: .metrics.halstead.length
old: 2687.0
new: 216.0
path: .metrics.halstead.estimated_program_length
old: 2979.6821392794072
new: 358.1257749679339
path: .metrics.halstead.purity_ratio
old: 1.1089252472197273
new: 1.65798969892562
path: .metrics.halstead.vocabulary
old: 369.0
new: 69.0
path: .metrics.halstead.n1
old: 35.0
new: 23.0
path: .metrics.halstead.bugs
old: 4.1401698054927545
new: 0.302796505021149
path: .metrics.halstead.n2
old: 334.0
new: 46.0
path: .metrics.halstead.effort
old: 1384232.7260708043
new: 27378.406615279757
path: .metrics.halstead.N1
old: 1534.0
new: 133.0
path: .metrics.halstead.time
old: 76901.81811504468
new: 1521.0225897377643
path: .metrics.halstead.level
old: 0.016553091314583074
new: 0.04819277108433735
path: .metrics.halstead.N2
old: 1153.0
new: 83.0
path: .metrics.cyclomatic.average
old: 11.25
new: 2.8
path: .metrics.cyclomatic.sum
old: 90.0
new: 14.0
path: .metrics.mi.mi_sei
old: 104.349844606786
new: 39.695189073586135
path: .metrics.mi.mi_visual_studio
old: 50.79868427371272
new: 34.75401024028914
path: .metrics.mi.mi_original
old: 86.86575010804876
new: 59.429357510894434
path: .metrics.nexits.average
old: 1.4285714285714286
new: 0.25
path: .metrics.nexits.sum
old: 20.0
new: 1.0
path: .metrics.nom.closures
old: 6.0
new: 0.0
path: .metrics.nom.functions
old: 8.0
new: 4.0
path: .metrics.nom.total
old: 14.0
new: 4.0
path: .metrics.loc.cloc
old: 46.0
new: 12.0
path: .metrics.loc.lloc
old: 164.0
new: 28.0
path: .metrics.loc.blank
old: 0.0
new: 12.0
path: .metrics.loc.ploc
old: 447.0
new: 56.0
path: .metrics.loc.sloc
old: 2.0
new: 80.0

# Spaces Data

## Minimal test - lines (32, 32)

path: .spaces[1].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[1].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[1].metrics.nexits.sum
old: 7.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 7.0
new: 0.0
path: .spaces[1].metrics.cognitive.average
old: 69.0
new: 0.0
path: .spaces[1].metrics.cognitive.sum
old: 69.0
new: 0.0
path: .spaces[1].metrics.loc.ploc
old: 127.0
new: 1.0
path: .spaces[1].metrics.loc.cloc
old: 18.0
new: 0.0
path: .spaces[1].metrics.loc.sloc
old: 165.0
new: 1.0
path: .spaces[1].metrics.loc.blank
old: 20.0
new: 0.0
path: .spaces[1].metrics.loc.lloc
old: 77.0
new: 0.0
path: .spaces[1].metrics.mi.mi_original
old: 35.62545380083672
new: 158.02045369261705
path: .spaces[1].metrics.mi.mi_visual_studio
old: 20.833598713939605
new: 92.40962204246613
path: .spaces[1].metrics.mi.mi_sei
old: 3.6399021109565233
new: 152.37629276875444
path: .spaces[1].metrics.halstead.volume
old: 5556.570867540266
new: 11.60964047443681
path: .spaces[1].metrics.halstead.time
old: 13804.059702379906
new: 1.289960052715201
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.097405977107085
new: 1.6
path: .spaces[1].metrics.halstead.N2
old: 316.0
new: 1.0
path: .spaces[1].metrics.halstead.difficulty
old: 44.716981132075475
new: 2.0
path: .spaces[1].metrics.halstead.N1
old: 468.0
new: 4.0
path: .spaces[1].metrics.halstead.length
old: 784.0
new: 5.0
path: .spaces[1].metrics.halstead.effort
old: 248473.0746428383
new: 23.21928094887362
path: .spaces[1].metrics.halstead.bugs
old: 1.317442394437097
new: 0.002712967490108627
path: .spaces[1].metrics.halstead.estimated_program_length
old: 860.3662860519546
new: 8.0
path: .spaces[1].metrics.halstead.n1
old: 30.0
new: 4.0
path: .spaces[1].metrics.halstead.n2
old: 106.0
new: 1.0
path: .spaces[1].metrics.halstead.vocabulary
old: 136.0
new: 5.0
path: .spaces[1].metrics.halstead.level
old: 0.022362869198312235
new: 0.5
path: .spaces[1].metrics.cyclomatic.sum
old: 34.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.average
old: 34.0
new: 1.0

### Code

    void VTuneProfiler::Shutdown() {}

## Minimal test - lines (18, 30)

path: .spaces[0].metrics.mi.mi_visual_studio
old: 92.40962204246613
new: 60.1920772322561
path: .spaces[0].metrics.mi.mi_original
old: 158.02045369261705
new: 102.92845206715792
path: .spaces[0].metrics.mi.mi_sei
old: 152.37629276875444
new: 110.86767431893416
path: .spaces[0].metrics.halstead.volume
old: 11.60964047443681
new: 150.11730005192322
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.6
new: 1.584962500721156
path: .spaces[0].metrics.halstead.vocabulary
old: 5.0
new: 18.0
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 9.0
path: .spaces[0].metrics.halstead.effort
old: 23.21928094887362
new: 1125.879750389424
path: .spaces[0].metrics.halstead.level
old: 0.5
new: 0.13333333333333333
path: .spaces[0].metrics.halstead.n1
old: 4.0
new: 9.0
path: .spaces[0].metrics.halstead.time
old: 1.289960052715201
new: 62.54887502163467
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 15.0
path: .spaces[0].metrics.halstead.length
old: 5.0
new: 36.0
path: .spaces[0].metrics.halstead.N1
old: 4.0
new: 21.0
path: .spaces[0].metrics.halstead.bugs
old: 0.002712967490108627
new: 0.0360750341363372
path: .spaces[0].metrics.halstead.difficulty
old: 2.0
new: 7.5
path: .spaces[0].metrics.halstead.estimated_program_length
old: 8.0
new: 57.05865002596162
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 4.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 8.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 13.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 2.0

### Code

    void VTuneProfiler::Initialize() {
      // This is just a 'dirty trick' to find out if the ittnotify DLL was found.
      // If it wasn't this function always returns 0, otherwise it returns
      // incrementing numbers, if the library was found this wastes 2 events but
      // that should be okay.
      __itt_event testEvent =
          __itt_event_create("Test event", strlen("Test event"));
      testEvent = __itt_event_create("Test event 2", strlen("Test event 2"));

      if (testEvent) {
        mInstance = new VTuneProfiler();
      }
    }

## Minimal test - lines (56, 80)

path: .spaces[3].metrics.cognitive.average
old: 2.0
new: 3.0
path: .spaces[3].metrics.cognitive.sum
old: 2.0
new: 3.0
path: .spaces[3].metrics.halstead.time
old: 112.80700660994437
new: 245.0980392156863
path: .spaces[3].metrics.halstead.N2
old: 21.0
new: 25.0
path: .spaces[3].metrics.halstead.difficulty
old: 8.25
new: 11.029411764705882
path: .spaces[3].metrics.halstead.effort
old: 2030.5261189789985
new: 4411.764705882353
path: .spaces[3].metrics.halstead.volume
old: 246.1243780580604
new: 400.0
path: .spaces[3].metrics.halstead.level
old: 0.12121212121212122
new: 0.09066666666666667
path: .spaces[3].metrics.halstead.estimated_program_length
old: 91.35671671381672
new: 128.09022723538357
path: .spaces[3].metrics.halstead.vocabulary
old: 25.0
new: 32.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.7237116361097495
new: 1.6011278404422946
path: .spaces[3].metrics.halstead.N1
old: 32.0
new: 55.0
path: .spaces[3].metrics.halstead.bugs
old: 0.05345042122894763
new: 0.08966445366441993
path: .spaces[3].metrics.halstead.length
old: 53.0
new: 80.0
path: .spaces[3].metrics.halstead.n1
old: 11.0
new: 15.0
path: .spaces[3].metrics.halstead.n2
old: 14.0
new: 17.0
path: .spaces[3].metrics.cyclomatic.sum
old: 3.0
new: 6.0
path: .spaces[3].metrics.cyclomatic.average
old: 3.0
new: 6.0
path: .spaces[3].metrics.mi.mi_visual_studio
old: 54.472973518314014
new: 50.4787111065343
path: .spaces[3].metrics.mi.mi_original
old: 93.14878471631695
new: 86.31859599217366
path: .spaces[3].metrics.mi.mi_sei
old: 75.96606780783563
new: 64.68672705410182
path: .spaces[3].metrics.nexits.average
old: 2.0
new: 1.0
path: .spaces[3].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[3].metrics.loc.sloc
old: 20.0
new: 25.0
path: .spaces[3].metrics.loc.blank
old: 5.0
new: 1.0
path: .spaces[3].metrics.loc.ploc
old: 14.0
new: 23.0
path: .spaces[3].metrics.loc.lloc
old: 9.0
new: 18.0

### Code

    void VTuneProfiler::RegisterThreadInternal(const char* aName) {
      std::string str(aName);

      if (!str.compare("GeckoMain")) {
        // Process main thread.
        switch (XRE_GetProcessType()) {
          case GeckoProcessType::GeckoProcessType_Default:
            __itt_thread_set_name("Main Process");
            break;
          case GeckoProcessType::GeckoProcessType_Content:
            __itt_thread_set_name("Content Process");
            break;
          case GeckoProcessType::GeckoProcessType_GMPlugin:
            __itt_thread_set_name("Plugin Process");
            break;
          case GeckoProcessType::GeckoProcessType_GPU:
            __itt_thread_set_name("GPU Process");
            break;
          default:
            __itt_thread_set_name("Unknown Process");
        }
        return;
      }
      __itt_thread_set_name(aName);
    }

## Minimal test - lines (34, 54)

path: .spaces[2].metrics.mi.mi_original
old: 61.241604461135054
new: 89.15512736462273
path: .spaces[2].metrics.mi.mi_visual_studio
old: 35.81380377844155
new: 52.13750138282031
path: .spaces[2].metrics.mi.mi_sei
old: 24.50102438808713
new: 76.33436035517367
path: .spaces[2].metrics.halstead.N2
old: 129.0
new: 36.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 457.1150399296564
new: 145.04192083187502
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.4465665820558746
new: 1.7063755391985296
path: .spaces[2].metrics.halstead.effort
old: 52855.34387378157
new: 5885.852261944349
path: .spaces[2].metrics.halstead.length
old: 316.0
new: 85.0
path: .spaces[2].metrics.halstead.n2
old: 59.0
new: 20.0
path: .spaces[2].metrics.halstead.volume
old: 2014.512460305628
new: 435.98905644032214
path: .spaces[2].metrics.halstead.n1
old: 24.0
new: 15.0
path: .spaces[2].metrics.halstead.vocabulary
old: 83.0
new: 35.0
path: .spaces[2].metrics.halstead.time
old: 2936.407992987865
new: 326.99179233024165
path: .spaces[2].metrics.halstead.bugs
old: 0.46946657879634873
new: 0.1086638237318092
path: .spaces[2].metrics.halstead.level
old: 0.03811369509043928
new: 0.07407407407407407
path: .spaces[2].metrics.halstead.difficulty
old: 26.23728813559322
new: 13.5
path: .spaces[2].metrics.halstead.N1
old: 187.0
new: 49.0
path: .spaces[2].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[2].metrics.cyclomatic.sum
old: 18.0
new: 4.0
path: .spaces[2].metrics.cyclomatic.average
old: 18.0
new: 4.0
path: .spaces[2].metrics.nexits.average
old: 1.5
new: 0.0
path: .spaces[2].metrics.nexits.sum
old: 3.0
new: 0.0
path: .spaces[2].metrics.cognitive.average
old: 12.5
new: 5.0
path: .spaces[2].metrics.cognitive.sum
old: 25.0
new: 5.0
path: .spaces[2].metrics.loc.ploc
old: 48.0
new: 16.0
path: .spaces[2].metrics.loc.blank
old: 10.0
new: 3.0
path: .spaces[2].metrics.loc.cloc
old: 1.0
new: 2.0
path: .spaces[2].metrics.loc.sloc
old: 59.0
new: 21.0
path: .spaces[2].metrics.loc.lloc
old: 26.0
new: 7.0
path: .spaces[2].metrics.nom.closures
old: 1.0
new: 0.0
path: .spaces[2].metrics.nom.total
old: 2.0
new: 1.0

### Code

    void VTuneProfiler::TraceInternal(const char* aName, TracingKind aKind) {
      std::string str(aName);

      auto iter = mStrings.find(str);

      __itt_event event;
      if (iter != mStrings.end()) {
        event = iter->second;
      } else {
        event = __itt_event_create(aName, str.length());
        mStrings.insert({str, event});
      }

      if (aKind == TRACING_INTERVAL_START || aKind == TRACING_EVENT) {
        // VTune will consider starts not matched with an end to be single point in
        // time events.
        __itt_event_start(event);
      } else {
        __itt_event_end(event);
      }
    }