Global Metrics
path: .metrics.halstead.length
old: 181.0
new: 186.0
path: .metrics.halstead.n1
old: 16.0
new: 18.0
path: .metrics.halstead.vocabulary
old: 55.0
new: 57.0
path: .metrics.halstead.bugs
old: 0.19516293171448423
new: 0.24584147859434083
path: .metrics.halstead.difficulty
old: 13.538461538461538
new: 18.46153846153846
path: .metrics.halstead.level
old: 0.07386363636363637
new: 0.05416666666666667
path: .metrics.halstead.N2
old: 66.0
new: 80.0
path: .metrics.halstead.volume
old: 1046.4261081479635
new: 1084.917542634642
path: .metrics.halstead.estimated_program_length
old: 270.13068653562766
new: 281.1893365615893
path: .metrics.halstead.N1
old: 115.0
new: 106.0
path: .metrics.halstead.effort
old: 14166.999618003198
new: 20029.246940947232
path: .metrics.halstead.purity_ratio
old: 1.4924347322410367
new: 1.5117706266752111
path: .metrics.halstead.time
old: 787.055534333511
new: 1112.735941163735
path: .metrics.nargs.sum
old: 3.0
new: 1.0
path: .metrics.nargs.average
old: 0.75
new: 1.0
path: .metrics.cyclomatic.sum
old: 14.0
new: 9.0
path: .metrics.cyclomatic.average
old: 1.5555555555555556
new: 3.0
path: .metrics.nexits.sum
old: 7.0
new: 1.0
path: .metrics.nexits.average
old: 1.75
new: 1.0
path: .metrics.mi.mi_original
old: 56.54108355031768
new: 64.2298269954699
path: .metrics.mi.mi_sei
old: 40.1138634491527
new: 45.867263914649214
path: .metrics.mi.mi_visual_studio
old: 33.06496114053665
new: 37.56130233653211
path: .metrics.loc.ploc
old: 62.0
new: 47.0
path: .metrics.loc.sloc
old: 103.0
new: 68.0
path: .metrics.loc.blank
old: 19.0
new: 11.0
path: .metrics.loc.lloc
old: 21.0
new: 15.0
path: .metrics.loc.cloc
old: 22.0
new: 10.0
path: .metrics.cognitive.average
old: 1.25
new: 9.0
path: .metrics.cognitive.sum
old: 5.0
new: 9.0
path: .metrics.nom.functions
old: 4.0
new: 1.0
path: .metrics.nom.total
old: 4.0
new: 1.0
Spaces Data
Minimal test - lines (22, 66)
path: .spaces[0].metrics.mi.mi_original
old: 124.51705364749066
new: 71.30711061514155
path: .spaces[0].metrics.mi.mi_sei
old: 104.14292353013596
new: 47.45903886324095
path: .spaces[0].metrics.mi.mi_visual_studio
old: 72.81699043712904
new: 41.700064687217285
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 15.0
path: .spaces[0].metrics.loc.ploc
old: 5.0
new: 34.0
path: .spaces[0].metrics.loc.sloc
old: 7.0
new: 45.0
path: .spaces[0].metrics.loc.blank
old: 2.0
new: 8.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 9.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 9.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: null
new: 1.0
path: .spaces[0].metrics.halstead.n2
old: 2.0
new: 37.0
path: .spaces[0].metrics.halstead.effort
old: 24.380244996317305
new: 19451.61913560157
path: .spaces[0].metrics.halstead.n1
old: 3.0
new: 18.0
path: .spaces[0].metrics.halstead.N1
old: 5.0
new: 106.0
path: .spaces[0].metrics.halstead.length
old: 7.0
new: 182.0
path: .spaces[0].metrics.halstead.time
old: 1.3544580553509613
new: 1080.6455075334204
path: .spaces[0].metrics.halstead.vocabulary
old: 5.0
new: 55.0
path: .spaces[0].metrics.halstead.N2
old: 2.0
new: 76.0
path: .spaces[0].metrics.halstead.difficulty
old: 1.5
new: 18.486486486486488
path: .spaces[0].metrics.halstead.bugs
old: 0.002802662411680566
new: 0.24109188002461196
path: .spaces[0].metrics.halstead.estimated_program_length
old: 6.754887502163468
new: 267.8084245542328
path: .spaces[0].metrics.halstead.level
old: 0.6666666666666666
new: 0.054093567251461985
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.9649839288804954
new: 1.4714748601880925
path: .spaces[0].metrics.halstead.volume
old: 16.253496664211536
new: 1052.207467861488
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 8.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 4.0
Code
namespace mozilla {
inline void NoteIntentionalCrash(const char* aProcessType) {
// In opt builds we don't actually have the leak checking enabled, and the
// sandbox doesn't allow writing to this path, so we just disable this
// function's behaviour.
#ifdef MOZ_DEBUG
char* f = getenv("XPCOM_MEM_BLOAT_LOG");
if (!f) {
return;
}
fprintf(stderr, "XPCOM_MEM_BLOAT_LOG: %s\n", f);
std::ostringstream bloatName;
std::string processType(aProcessType);
if (!processType.compare("default")) {
bloatName << f;
} else {
std::string bloatLog(f);
bool hasExt = false;
if (bloatLog.size() >= 4 &&
bloatLog.compare(bloatLog.size() - 4, 4, ".log", 4) == 0) {
hasExt = true;
bloatLog.erase(bloatLog.size() - 4, 4);
}
bloatName << bloatLog << "_" << processType << "_pid" << getpid();
if (hasExt) {
bloatName << ".log";
}
}
fprintf(stderr, "Writing to log: %s\n", bloatName.str().c_str());
FILE* processfd = fopen(bloatName.str().c_str(), "a");
if (processfd) {
fprintf(processfd, "==> process %d will purposefully crash\n", getpid());
fclose(processfd);
}
#endif
}
} // namespace mozilla
Minimal test - lines (24, 64)
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 7.0
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 7.0
path: .spaces[0].spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 9.0
path: .spaces[0].spaces[0].metrics.cognitive.average
old: null
new: 9.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 3.0
new: 32.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 0.0
new: 6.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 0.0
new: 15.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 3.0
new: 41.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 126.6999002570717
new: 50.8561404762176
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 82.00171614982087
new: 42.764034810078535
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 140.22293461619367
new: 73.1264995252343
path: .spaces[0].spaces[0].metrics.halstead.time
old: 0.9674700395364008
new: 1079.0414066556505
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 17.414460711655217
new: 19422.745319801707
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 2.0
new: 75.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 11.60964047443681
new: 1035.8797503894243
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 6.754887502163468
new: 261.17595007788486
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.6666666666666666
new: 0.05333333333333334
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.3509775004326936
new: 1.4509775004326937
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 1.5
new: 18.75
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 2.0
new: 36.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 3.0
new: 18.0
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.002239505320238735
new: 0.2408532378212832
path: .spaces[0].spaces[0].metrics.halstead.length
old: 5.0
new: 180.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 5.0
new: 54.0
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 3.0
new: 105.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: null
new: 1.0
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: null
new: 1.0
Code
inline void NoteIntentionalCrash(const char* aProcessType) {
// In opt builds we don't actually have the leak checking enabled, and the
// sandbox doesn't allow writing to this path, so we just disable this
// function's behaviour.
#ifdef MOZ_DEBUG
char* f = getenv("XPCOM_MEM_BLOAT_LOG");
if (!f) {
return;
}
fprintf(stderr, "XPCOM_MEM_BLOAT_LOG: %s\n", f);
std::ostringstream bloatName;
std::string processType(aProcessType);
if (!processType.compare("default")) {
bloatName << f;
} else {
std::string bloatLog(f);
bool hasExt = false;
if (bloatLog.size() >= 4 &&
bloatLog.compare(bloatLog.size() - 4, 4, ".log", 4) == 0) {
hasExt = true;
bloatLog.erase(bloatLog.size() - 4, 4);
}
bloatName << bloatLog << "_" << processType << "_pid" << getpid();
if (hasExt) {
bloatName << ".log";
}
}
fprintf(stderr, "Writing to log: %s\n", bloatName.str().c_str());
FILE* processfd = fopen(bloatName.str().c_str(), "a");
if (processfd) {
fprintf(processfd, "==> process %d will purposefully crash\n", getpid());
fclose(processfd);
}
#endif
}