Global Metrics

path: .metrics.nom.total
old: 3.0
new: 2.0

path: .metrics.nom.functions
old: 3.0
new: 2.0

path: .metrics.nargs.average
old: 0.6666666666666666
new: 1.0

path: .metrics.halstead.effort
old: 3757.7260167261447
new: 23211.873061335187

path: .metrics.halstead.N2
old: 34.0
new: 82.0

path: .metrics.halstead.vocabulary
old: 38.0
new: 69.0

path: .metrics.halstead.N1
old: 47.0
new: 116.0

path: .metrics.halstead.estimated_program_length
old: 164.20212108020232
new: 359.17317163886946

path: .metrics.halstead.length
old: 81.0
new: 198.0

path: .metrics.halstead.volume
old: 425.0821285889304
new: 1209.4878424420774

path: .metrics.halstead.purity_ratio
old: 2.027186680002498
new: 1.8140059173680276

path: .metrics.halstead.difficulty
old: 8.84
new: 19.19148936170213

path: .metrics.halstead.bugs
old: 0.08056792024430093
new: 0.2712390428688488

path: .metrics.halstead.time
old: 208.76255648478585
new: 1289.5485034075105

path: .metrics.halstead.n1
old: 13.0
new: 22.0

path: .metrics.halstead.n2
old: 25.0
new: 47.0

path: .metrics.halstead.level
old: 0.11312217194570136
new: 0.05210643015521064

path: .metrics.nexits.average
old: 0.6666666666666666
new: 0.0

path: .metrics.nexits.sum
old: 2.0
new: 0.0

path: .metrics.loc.sloc
old: 27.0
new: 73.0

path: .metrics.loc.blank
old: 6.0
new: 12.0

path: .metrics.loc.cloc
old: 6.0
new: 25.0

path: .metrics.loc.ploc
old: 15.0
new: 36.0

path: .metrics.loc.lloc
old: 4.0
new: 7.0

path: .metrics.cyclomatic.sum
old: 5.0
new: 11.0

path: .metrics.cyclomatic.average
old: 1.0
new: 3.6666666666666665

path: .metrics.cognitive.sum
old: 0.0
new: 6.0

path: .metrics.cognitive.average
old: 0.0
new: 3.0

path: .metrics.mi.mi_visual_studio
old: 49.69916627015295
new: 36.28959368792599

path: .metrics.mi.mi_original
old: 84.98557432196154
new: 62.05520520635345

path: .metrics.mi.mi_sei
old: 80.77105048542953
new: 54.31642774484474

Spaces Data

Minimal test - lines (24, 63)

path: .spaces[0].metrics.nom.total
old: 3.0
new: 1.0

path: .spaces[0].metrics.nom.functions
old: 3.0
new: 1.0

path: .spaces[0].metrics.nexits.sum
old: 2.0
new: 0.0

path: .spaces[0].metrics.nexits.average
old: 0.6666666666666666
new: 0.0

path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 1.0

path: .spaces[0].metrics.nargs.average
old: 0.6666666666666666
new: 1.0

path: .spaces[0].metrics.mi.mi_sei
old: 58.91347311496298
new: 67.25316168604301

path: .spaces[0].metrics.mi.mi_original
old: 93.02523531699524
new: 73.29373549332435

path: .spaces[0].metrics.mi.mi_visual_studio
old: 54.40072240759955
new: 42.8618336218271

path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 6.0

path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 6.0

path: .spaces[0].metrics.halstead.n1
old: 13.0
new: 22.0

path: .spaces[0].metrics.halstead.N1
old: 47.0
new: 101.0

path: .spaces[0].metrics.halstead.n2
old: 22.0
new: 35.0

path: .spaces[0].metrics.halstead.volume
old: 400.08407532170736
new: 991.591302408006

path: .spaces[0].metrics.halstead.time
old: 203.5781342861718
new: 1194.6314262344074

path: .spaces[0].metrics.halstead.N2
old: 31.0
new: 69.0

path: .spaces[0].metrics.halstead.length
old: 78.0
new: 170.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: 146.21321194585474
new: 277.63240120309433

path: .spaces[0].metrics.halstead.level
old: 0.10918114143920596
new: 0.0461133069828722

path: .spaces[0].metrics.halstead.bugs
old: 0.07922845164364474
new: 0.2577605039407028

path: .spaces[0].metrics.halstead.difficulty
old: 9.159090909090908
new: 21.685714285714287

path: .spaces[0].metrics.halstead.effort
old: 3664.406417151092
new: 21503.365672219337

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.874528358280189
new: 1.633131771782908

path: .spaces[0].metrics.halstead.vocabulary
old: 35.0
new: 57.0

path: .spaces[0].metrics.cyclomatic.sum
old: 4.0
new: 9.0

path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 9.0

path: .spaces[0].metrics.loc.lloc
old: 4.0
new: 6.0

path: .spaces[0].metrics.loc.blank
old: 5.0
new: 7.0

path: .spaces[0].metrics.loc.ploc
old: 12.0
new: 22.0

path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 11.0

path: .spaces[0].metrics.loc.sloc
old: 17.0
new: 40.0

Code

void read_procmaps(lul::LUL* aLUL) {
  MOZ_ASSERT(aLUL->CountMappings() == 0);

#if defined(GP_OS_linux) || defined(GP_OS_android) || defined(GP_OS_freebsd)
  SharedLibraryInfo info = SharedLibraryInfo::GetInfoForSelf();

  for (size_t i = 0; i < info.GetSize(); i++) {
    const SharedLibrary& lib = info.GetEntry(i);

    std::string nativePath = lib.GetNativeDebugPath();

    // We can use the standard POSIX-based mapper.
    AutoObjectMapperPOSIX mapper(aLUL->mLog);

    // Ask |mapper| to map the object.  Then hand its mapped address
    // to NotifyAfterMap().
    void* image = nullptr;
    size_t size = 0;
    bool ok = mapper.Map(&image, &size, nativePath);
    if (ok && image && size > 0) {
      aLUL->NotifyAfterMap(lib.GetStart(), lib.GetEnd() - lib.GetStart(),
                           nativePath.c_str(), image);
    } else if (!ok && lib.GetDebugName().IsEmpty()) {
      // The object has no name and (as a consequence) the mapper failed to map
      // it.  This happens on Linux, where GetInfoForSelf() produces such a
      // mapping for the VDSO.  This is a problem on x86-{linux,android} because
      // lack of knowledge about the mapped area inhibits LUL's special
      // __kernel_syscall handling.  Hence notify |aLUL| at least of the
      // mapping, even though it can't read any unwind information for the area.
      aLUL->NotifyExecutableArea(lib.GetStart(), lib.GetEnd() - lib.GetStart());
    }

    // |mapper| goes out of scope at this point and so its destructor
    // unmaps the object.
  }

#else
#  error "Unknown platform"
#endif
}