Global Metrics
path: .metrics.nargs.average
old: null
new: 1.434782608695652
path: .metrics.nargs.sum
old: 0.0
new: 198.0
path: .metrics.mi.mi_sei
old: -8.245253459227861
new: -158.49643990639643
path: .metrics.mi.mi_original
old: 26.031077078471057
new: -101.2935945108798
path: .metrics.mi.mi_visual_studio
old: 15.222852092673133
new: 0.0
path: .metrics.cyclomatic.average
old: 1.05
new: 2.1893491124260356
path: .metrics.cyclomatic.sum
old: 21.0
new: 370.0
path: .metrics.loc.blank
old: 102.0
new: 396.0
path: .metrics.loc.lloc
old: 0.0
new: 708.0
path: .metrics.loc.ploc
old: 218.0
new: 2043.0
path: .metrics.loc.sloc
old: 374.0
new: 2775.0
path: .metrics.loc.cloc
old: 54.0
new: 336.0
path: .metrics.nom.functions
old: 0.0
new: 137.0
path: .metrics.nom.total
old: 0.0
new: 138.0
path: .metrics.nom.closures
old: 0.0
new: 1.0
path: .metrics.cognitive.sum
old: 1.0
new: 254.0
path: .metrics.cognitive.average
old: null
new: 1.8405797101449275
path: .metrics.halstead.time
old: 3200.893518143896
new: 366328.78631419066
path: .metrics.halstead.N1
old: 327.0
new: 4642.0
path: .metrics.halstead.n2
old: 135.0
new: 953.0
path: .metrics.halstead.bugs
old: 0.4972497422670312
new: 11.721263973212908
path: .metrics.halstead.estimated_program_length
old: 983.899430614843
new: 9678.338170261008
path: .metrics.halstead.purity_ratio
old: 1.4447862417251731
new: 1.1945616107456194
path: .metrics.halstead.effort
old: 57616.08332659013
new: 6593918.153655432
path: .metrics.halstead.level
old: 0.0847457627118644
new: 0.012241490044958251
path: .metrics.halstead.volume
old: 4882.718925982214
new: 80719.38343524247
path: .metrics.halstead.length
old: 681.0
new: 8102.0
path: .metrics.halstead.n1
old: 9.0
new: 45.0
path: .metrics.halstead.difficulty
old: 11.8
new: 81.6894018887723
path: .metrics.halstead.N2
old: 354.0
new: 3460.0
path: .metrics.halstead.vocabulary
old: 144.0
new: 998.0
path: .metrics.nexits.average
old: null
new: 1.2246376811594204
path: .metrics.nexits.sum
old: 0.0
new: 169.0
Spaces Data
Minimal test - lines (209, 216)
path: .spaces[8].metrics.loc.ploc
old: 1.0
new: 8.0
path: .spaces[8].metrics.loc.sloc
old: 1.0
new: 8.0
path: .spaces[8].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[8].metrics.halstead.n2
old: 1.0
new: 10.0
path: .spaces[8].metrics.halstead.bugs
old: 0.0
new: 0.03488166209605841
path: .spaces[8].metrics.halstead.purity_ratio
old: null
new: 1.7642458846244125
path: .spaces[8].metrics.halstead.estimated_program_length
old: null
new: 61.74860596185444
path: .spaces[8].metrics.halstead.n1
old: 0.0
new: 9.0
path: .spaces[8].metrics.halstead.vocabulary
old: 1.0
new: 19.0
path: .spaces[8].metrics.halstead.time
old: 0.0
new: 59.47098518821019
path: .spaces[8].metrics.halstead.N1
old: 0.0
new: 19.0
path: .spaces[8].metrics.halstead.difficulty
old: 0.0
new: 7.2
path: .spaces[8].metrics.halstead.N2
old: 1.0
new: 16.0
path: .spaces[8].metrics.halstead.length
old: 1.0
new: 35.0
path: .spaces[8].metrics.halstead.volume
old: 0.0
new: 148.67746297052548
path: .spaces[8].metrics.halstead.level
old: null
new: 0.1388888888888889
path: .spaces[8].metrics.halstead.effort
old: 0.0
new: 1070.4777333877837
path: .spaces[8].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[8].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[8].metrics.nargs.average
old: null
new: 1.0
path: .spaces[8].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[8].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[8].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[8].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[8].metrics.cognitive.average
old: null
new: 1.0
path: .spaces[8].metrics.nexits.average
old: null
new: 1.0
path: .spaces[8].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[8].metrics.mi.mi_sei
old: null
new: 84.41658074108682
path: .spaces[8].metrics.mi.mi_original
old: null
new: 110.84379476050222
path: .spaces[8].metrics.mi.mi_visual_studio
old: null
new: 64.82093260848083
Code
[[nodiscard]] static nsresult VsizeDistinguishedAmount(int64_t* aN) {
KINFO_PROC proc;
nsresult rv = GetKinfoProcSelf(&proc);
if (NS_SUCCEEDED(rv)) {
*aN = KP_SIZE(proc);
}
return rv;
}
Minimal test - lines (265, 271)
path: .spaces[12].metrics.nargs.average
old: null
new: 1.0
path: .spaces[12].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[12].metrics.mi.mi_visual_studio
old: 63.087161982197514
new: 65.91787083380372
path: .spaces[12].metrics.mi.mi_sei
old: 109.59388983581886
new: 87.02091682937993
path: .spaces[12].metrics.mi.mi_original
old: 107.87904698955776
new: 112.71955912580437
path: .spaces[12].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[12].metrics.loc.ploc
old: 9.0
new: 7.0
path: .spaces[12].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[12].metrics.loc.sloc
old: 12.0
new: 7.0
path: .spaces[12].metrics.loc.blank
old: 1.0
new: 0.0
path: .spaces[12].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[12].metrics.nexits.average
old: null
new: 1.0
path: .spaces[12].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[12].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[12].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[12].metrics.halstead.vocabulary
old: 13.0
new: 20.0
path: .spaces[12].metrics.halstead.N2
old: 9.0
new: 17.0
path: .spaces[12].metrics.halstead.estimated_program_length
old: 36.529325012980806
new: 66.58307281799108
path: .spaces[12].metrics.halstead.length
old: 21.0
new: 38.0
path: .spaces[12].metrics.halstead.level
old: 0.5
new: 0.14379084967320263
path: .spaces[12].metrics.halstead.difficulty
old: 2.0
new: 6.954545454545454
path: .spaces[12].metrics.halstead.n1
old: 4.0
new: 9.0
path: .spaces[12].metrics.halstead.effort
old: 155.41846816192586
new: 1142.1677247125058
path: .spaces[12].metrics.halstead.time
old: 8.634359342329214
new: 63.4537624840281
path: .spaces[12].metrics.halstead.purity_ratio
old: 1.7394916672848002
new: 1.752186126789239
path: .spaces[12].metrics.halstead.volume
old: 77.70923408096293
new: 164.2332676057198
path: .spaces[12].metrics.halstead.bugs
old: 0.00963563842219266
new: 0.0364221295215853
path: .spaces[12].metrics.halstead.n2
old: 9.0
new: 11.0
path: .spaces[12].metrics.halstead.N1
old: 12.0
new: 21.0
Code
[[nodiscard]] static nsresult PrivateDistinguishedAmount(int64_t* aN) {
int64_t priv;
nsresult rv = GetKinfoVmentrySelf(&priv, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
*aN = priv * getpagesize();
return NS_OK;
}
Minimal test - lines (218, 225)
path: .spaces[9].metrics.nargs.average
old: null
new: 1.0
path: .spaces[9].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[9].metrics.halstead.difficulty
old: 4.090909090909091
new: 7.2
path: .spaces[9].metrics.halstead.vocabulary
old: 17.0
new: 19.0
path: .spaces[9].metrics.halstead.estimated_program_length
old: 53.5635228093372
new: 61.74860596185444
path: .spaces[9].metrics.halstead.purity_ratio
old: 1.5303863659810628
new: 1.7642458846244125
path: .spaces[9].metrics.halstead.level
old: 0.24444444444444444
new: 0.1388888888888889
path: .spaces[9].metrics.halstead.N2
old: 15.0
new: 16.0
path: .spaces[9].metrics.halstead.volume
old: 143.06119944376186
new: 148.67746297052548
path: .spaces[9].metrics.halstead.n1
old: 6.0
new: 9.0
path: .spaces[9].metrics.halstead.effort
old: 585.250361360844
new: 1070.4777333877837
path: .spaces[9].metrics.halstead.n2
old: 11.0
new: 10.0
path: .spaces[9].metrics.halstead.time
old: 32.51390896449133
new: 59.47098518821019
path: .spaces[9].metrics.halstead.bugs
old: 0.023322398174749733
new: 0.03488166209605841
path: .spaces[9].metrics.halstead.N1
old: 20.0
new: 19.0
path: .spaces[9].metrics.loc.ploc
old: 5.0
new: 8.0
path: .spaces[9].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[9].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[9].metrics.loc.sloc
old: 5.0
new: 8.0
path: .spaces[9].metrics.nexits.average
old: null
new: 1.0
path: .spaces[9].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[9].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[9].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[9].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[9].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[9].metrics.cognitive.average
old: null
new: 1.0
path: .spaces[9].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[9].metrics.mi.mi_visual_studio
old: 69.5251981186954
new: 64.82093260848083
path: .spaces[9].metrics.mi.mi_original
old: 118.88808878296912
new: 110.84379476050222
path: .spaces[9].metrics.mi.mi_sei
old: 127.8557145081984
new: 84.41658074108682
Code
[[nodiscard]] static nsresult ResidentDistinguishedAmount(int64_t* aN) {
KINFO_PROC proc;
nsresult rv = GetKinfoProcSelf(&proc);
if (NS_SUCCEEDED(rv)) {
*aN = KP_RSS(proc);
}
return rv;
}
Minimal test - lines (358, 360)
path: .spaces[17].metrics.halstead.effort
old: 0.0
new: 161.90139975222553
path: .spaces[17].metrics.halstead.length
old: 1.0
new: 13.0
path: .spaces[17].metrics.halstead.n1
old: 0.0
new: 6.0
path: .spaces[17].metrics.halstead.volume
old: 0.0
new: 44.97261104228487
path: .spaces[17].metrics.halstead.vocabulary
old: 1.0
new: 11.0
path: .spaces[17].metrics.halstead.estimated_program_length
old: null
new: 27.11941547876375
path: .spaces[17].metrics.halstead.level
old: null
new: 0.2777777777777778
path: .spaces[17].metrics.halstead.n2
old: 1.0
new: 5.0
path: .spaces[17].metrics.halstead.difficulty
old: 0.0
new: 3.6
path: .spaces[17].metrics.halstead.N2
old: 1.0
new: 6.0
path: .spaces[17].metrics.halstead.bugs
old: 0.0
new: 0.00990176194569736
path: .spaces[17].metrics.halstead.time
old: 0.0
new: 8.994522208456974
path: .spaces[17].metrics.halstead.N1
old: 0.0
new: 7.0
path: .spaces[17].metrics.halstead.purity_ratio
old: null
new: 2.0861088829818266
path: .spaces[17].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[17].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[17].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[17].metrics.nexits.average
old: null
new: 1.0
path: .spaces[17].metrics.loc.ploc
old: 1.0
new: 3.0
path: .spaces[17].metrics.loc.sloc
old: 1.0
new: 3.0
path: .spaces[17].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[17].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[17].metrics.nargs.average
old: null
new: 1.0
path: .spaces[17].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[17].metrics.mi.mi_sei
old: null
new: 116.54053882973936
path: .spaces[17].metrics.mi.mi_original
old: null
new: 133.18100188654878
path: .spaces[17].metrics.mi.mi_visual_studio
old: null
new: 77.88362683423905
Code
[[nodiscard]] static nsresult ResidentFastDistinguishedAmount(int64_t* aN) {
return ResidentDistinguishedAmount(aN);
}
Minimal test - lines (348, 356)
path: .spaces[16].metrics.cognitive.average
old: null
new: 1.0
path: .spaces[16].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[16].metrics.loc.lloc
old: 0.0
new: 5.0
path: .spaces[16].metrics.loc.sloc
old: 6.0
new: 9.0
path: .spaces[16].metrics.loc.ploc
old: 4.0
new: 9.0
path: .spaces[16].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[16].metrics.mi.mi_visual_studio
old: 70.39280557712797
new: 63.19738737903169
path: .spaces[16].metrics.mi.mi_sei
old: 137.05315148649436
new: 80.4112808275601
path: .spaces[16].metrics.mi.mi_original
old: 120.37169753688885
new: 108.06753241814418
path: .spaces[16].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[16].metrics.nargs.average
old: null
new: 1.0
path: .spaces[16].metrics.halstead.vocabulary
old: 12.0
new: 21.0
path: .spaces[16].metrics.halstead.N2
old: 9.0
new: 17.0
path: .spaces[16].metrics.halstead.effort
old: 195.892593789406
new: 1357.625385222526
path: .spaces[16].metrics.halstead.n2
old: 7.0
new: 11.0
path: .spaces[16].metrics.halstead.estimated_program_length
old: 31.26112492884004
new: 71.27302875388389
path: .spaces[16].metrics.halstead.level
old: 0.3111111111111111
new: 0.12941176470588234
path: .spaces[16].metrics.halstead.N1
old: 8.0
new: 23.0
path: .spaces[16].metrics.halstead.bugs
old: 0.011243221234470307
new: 0.04086944234576256
path: .spaces[16].metrics.halstead.n1
old: 5.0
new: 10.0
path: .spaces[16].metrics.halstead.volume
old: 60.94436251225965
new: 175.69269691115042
path: .spaces[16].metrics.halstead.time
old: 10.882921877189224
new: 75.42363251236256
path: .spaces[16].metrics.halstead.length
old: 17.0
new: 40.0
path: .spaces[16].metrics.halstead.purity_ratio
old: 1.838889701696473
new: 1.7818257188470974
path: .spaces[16].metrics.halstead.difficulty
old: 3.2142857142857144
new: 7.727272727272728
path: .spaces[16].metrics.nexits.average
old: null
new: 2.0
path: .spaces[16].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[16].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[16].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[16].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[16].metrics.nom.total
old: 0.0
new: 1.0
Code
[[nodiscard]] static nsresult ResidentDistinguishedAmount(int64_t* aN) {
int64_t vsize, resident, shared;
XMappingIter(vsize, resident, shared);
if (resident == -1) {
return NS_ERROR_FAILURE;
}
*aN = resident;
return NS_OK;
}
Minimal test - lines (130, 145)
path: .spaces[6].metrics.mi.mi_original
old: null
new: 100.17716614316356
path: .spaces[6].metrics.mi.mi_visual_studio
old: null
new: 58.5831380954173
path: .spaces[6].metrics.mi.mi_sei
old: null
new: 116.06385521892028
path: .spaces[6].metrics.nargs.average
old: null
new: 1.0
path: .spaces[6].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[6].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[6].metrics.nexits.average
old: null
new: 1.0
path: .spaces[6].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[6].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[6].metrics.halstead.purity_ratio
old: null
new: 1.7830828133113006
path: .spaces[6].metrics.halstead.time
old: 0.0
new: 48.18580001666672
path: .spaces[6].metrics.halstead.N2
old: 1.0
new: 13.0
path: .spaces[6].metrics.halstead.effort
old: 0.0
new: 867.3444003000009
path: .spaces[6].metrics.halstead.volume
old: 0.0
new: 133.437600046154
path: .spaces[6].metrics.halstead.vocabulary
old: 1.0
new: 18.0
path: .spaces[6].metrics.halstead.difficulty
old: 0.0
new: 6.5
path: .spaces[6].metrics.halstead.n2
old: 1.0
new: 9.0
path: .spaces[6].metrics.halstead.level
old: null
new: 0.15384615384615383
path: .spaces[6].metrics.halstead.n1
old: 0.0
new: 9.0
path: .spaces[6].metrics.halstead.bugs
old: 0.0
new: 0.03031608606033046
path: .spaces[6].metrics.halstead.estimated_program_length
old: null
new: 57.05865002596162
path: .spaces[6].metrics.halstead.length
old: 1.0
new: 32.0
path: .spaces[6].metrics.halstead.N1
old: 0.0
new: 19.0
path: .spaces[6].metrics.loc.ploc
old: 1.0
new: 5.0
path: .spaces[6].metrics.loc.cloc
old: 0.0
new: 10.0
path: .spaces[6].metrics.loc.lloc
old: 0.0
new: 2.0
path: .spaces[6].metrics.loc.sloc
old: 1.0
new: 16.0
path: .spaces[6].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[6].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[6].metrics.nom.total
old: 0.0
new: 1.0
Code
[[nodiscard]] static nsresult SystemHeapSize(int64_t* aSizeOut) {
struct mallinfo info = mallinfo();
// The documentation in the glibc man page makes it sound like |uordblks|
// would suffice, but that only gets the small allocations that are put in
// the brk heap. We need |hblkhd| as well to get the larger allocations
// that are mmapped.
//
// The fields in |struct mallinfo| are all |int|, , so it is
// unreliable if memory usage gets high. However, the system heap size on
// Linux should usually be zero (so long as jemalloc is enabled) so that
// shouldn't be a problem. Nonetheless, cast the |int|s to |size_t| before
// adding them to provide a small amount of extra overflow protection.
*aSizeOut = size_t(info.hblkhd) + size_t(info.uordblks);
return NS_OK;
}
Minimal test - lines (274, 282)
path: .spaces[13].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[13].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[13].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[13].metrics.nargs.average
old: null
new: 1.0
path: .spaces[13].metrics.halstead.estimated_program_length
old: 12.754887502163468
new: 66.43856189774725
path: .spaces[13].metrics.halstead.level
old: 0.6666666666666666
new: 0.13333333333333333
path: .spaces[13].metrics.halstead.length
old: 8.0
new: 35.0
path: .spaces[13].metrics.halstead.bugs
old: 0.003476944758806696
new: 0.036259068419710376
path: .spaces[13].metrics.halstead.volume
old: 22.458839376460833
new: 151.26748332105768
path: .spaces[13].metrics.halstead.N2
old: 4.0
new: 15.0
path: .spaces[13].metrics.halstead.N1
old: 4.0
new: 20.0
path: .spaces[13].metrics.halstead.effort
old: 33.68825906469125
new: 1134.5061249079326
path: .spaces[13].metrics.halstead.purity_ratio
old: 1.5943609377704335
new: 1.8982446256499217
path: .spaces[13].metrics.halstead.n1
old: 3.0
new: 10.0
path: .spaces[13].metrics.halstead.vocabulary
old: 7.0
new: 20.0
path: .spaces[13].metrics.halstead.n2
old: 4.0
new: 10.0
path: .spaces[13].metrics.halstead.time
old: 1.871569948038403
new: 63.0281180504407
path: .spaces[13].metrics.halstead.difficulty
old: 1.5
new: 7.5
path: .spaces[13].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[13].metrics.loc.sloc
old: 5.0
new: 9.0
path: .spaces[13].metrics.loc.ploc
old: 5.0
new: 9.0
path: .spaces[13].metrics.mi.mi_visual_studio
old: 75.15575883029284
new: 63.65257514531339
path: .spaces[13].metrics.mi.mi_original
old: 128.51634759980075
new: 108.8459034984859
path: .spaces[13].metrics.mi.mi_sei
old: 109.8108652227865
new: 81.53423292514047
path: .spaces[13].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[13].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[13].metrics.cognitive.average
old: null
new: 1.0
path: .spaces[13].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[13].metrics.nexits.average
old: null
new: 1.0
path: .spaces[13].metrics.nexits.sum
old: 0.0
new: 1.0
Code
[[nodiscard]] static nsresult VsizeMaxContiguousDistinguishedAmount(
int64_t* aN) {
uint64_t biggestRegion;
nsresult rv = GetKinfoVmentrySelf(nullptr, &biggestRegion);
if (NS_SUCCEEDED(rv)) {
*aN = biggestRegion;
}
return NS_OK;
}
Minimal test - lines (363, 371)
path: .spaces[18].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[18].metrics.nexits.average
old: null
new: 2.0
path: .spaces[18].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[18].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[18].metrics.nargs.average
old: null
new: 1.0
path: .spaces[18].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[18].metrics.loc.sloc
old: 5.0
new: 9.0
path: .spaces[18].metrics.loc.lloc
old: 0.0
new: 5.0
path: .spaces[18].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[18].metrics.loc.ploc
old: 5.0
new: 9.0
path: .spaces[18].metrics.mi.mi_sei
old: 130.8319459465278
new: 79.93149320129929
path: .spaces[18].metrics.mi.mi_visual_studio
old: 70.731611235755
new: 63.00290583493214
path: .spaces[18].metrics.mi.mi_original
old: 120.95105521314105
new: 107.73496897773396
path: .spaces[18].metrics.cognitive.average
old: null
new: 1.0
path: .spaces[18].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[18].metrics.halstead.effort
old: 371.1012403050067
new: 1685.6651518448982
path: .spaces[18].metrics.halstead.time
old: 20.61673557250037
new: 93.64806399138324
path: .spaces[18].metrics.halstead.purity_ratio
old: 1.352356133028083
new: 1.8120832288100128
path: .spaces[18].metrics.halstead.n1
old: 6.0
new: 11.0
path: .spaces[18].metrics.halstead.N2
old: 9.0
new: 18.0
path: .spaces[18].metrics.halstead.estimated_program_length
old: 35.161259458730164
new: 76.10749561002054
path: .spaces[18].metrics.halstead.vocabulary
old: 13.0
new: 22.0
path: .spaces[18].metrics.halstead.level
old: 0.25925925925925924
new: 0.1111111111111111
path: .spaces[18].metrics.halstead.N1
old: 17.0
new: 24.0
path: .spaces[18].metrics.halstead.length
old: 26.0
new: 42.0
path: .spaces[18].metrics.halstead.n2
old: 7.0
new: 11.0
path: .spaces[18].metrics.halstead.volume
old: 96.2114326716684
new: 187.29612798276648
path: .spaces[18].metrics.halstead.bugs
old: 0.017213678307282557
new: 0.04721278480878513
path: .spaces[18].metrics.halstead.difficulty
old: 3.857142857142857
new: 9.0
path: .spaces[18].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[18].metrics.nom.total
old: 0.0
new: 1.0
Code
[[nodiscard]] static nsresult ResidentUniqueDistinguishedAmount(int64_t* aN) {
int64_t vsize, resident, shared;
XMappingIter(vsize, resident, shared);
if (resident == -1) {
return NS_ERROR_FAILURE;
}
*aN = resident - shared;
return NS_OK;
}
Minimal test - lines (183, 206)
path: .spaces[7].metrics.mi.mi_sei
old: 136.89174787581987
new: 48.21269040580927
path: .spaces[7].metrics.mi.mi_original
old: 120.25982107921764
new: 85.60801795236074
path: .spaces[7].metrics.mi.mi_visual_studio
old: 70.32738074808049
new: 50.06316839319341
path: .spaces[7].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[7].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[7].metrics.cognitive.average
old: null
new: 3.0
path: .spaces[7].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[7].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[7].metrics.nexits.average
old: null
new: 3.0
path: .spaces[7].metrics.halstead.bugs
old: 0.012300759181837836
new: 0.11456757746196292
path: .spaces[7].metrics.halstead.N1
old: 12.0
new: 61.0
path: .spaces[7].metrics.halstead.time
old: 12.45395382709427
new: 353.99894847263164
path: .spaces[7].metrics.halstead.level
old: 0.2777777777777778
new: 0.08928571428571429
path: .spaces[7].metrics.halstead.n2
old: 5.0
new: 30.0
path: .spaces[7].metrics.halstead.N2
old: 6.0
new: 42.0
path: .spaces[7].metrics.halstead.effort
old: 224.1711688876969
new: 6371.981072507369
path: .spaces[7].metrics.halstead.n1
old: 6.0
new: 16.0
path: .spaces[7].metrics.halstead.difficulty
old: 3.6
new: 11.2
path: .spaces[7].metrics.halstead.vocabulary
old: 11.0
new: 46.0
path: .spaces[7].metrics.halstead.purity_ratio
old: 1.5066341932646528
new: 2.050550658915103
path: .spaces[7].metrics.halstead.volume
old: 62.26976913547135
new: 568.9268814738723
path: .spaces[7].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 211.20671786825557
path: .spaces[7].metrics.halstead.length
old: 18.0
new: 103.0
path: .spaces[7].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[7].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[7].metrics.nargs.average
old: null
new: 1.0
path: .spaces[7].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[7].metrics.loc.sloc
old: 6.0
new: 24.0
path: .spaces[7].metrics.loc.ploc
old: 4.0
new: 24.0
path: .spaces[7].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[7].metrics.loc.lloc
old: 0.0
new: 5.0
Code
[[nodiscard]] static nsresult GetKinfoProcSelf(KINFO_PROC* aProc) {
# if defined(__OpenBSD__) && defined(MOZ_SANDBOX)
static LazyLogModule sPledgeLog("SandboxPledge");
MOZ_LOG(sPledgeLog, LogLevel::Debug,
("%s called when pledged, returning NS_ERROR_FAILURE\n", __func__));
return NS_ERROR_FAILURE;
# endif
int mib[] = {
CTL_KERN,
KERN_PROC,
KERN_PROC_PID,
getpid(),
# if defined(__NetBSD__) || defined(__OpenBSD__)
sizeof(KINFO_PROC),
1,
# endif
};
u_int miblen = sizeof(mib) / sizeof(mib[0]);
size_t size = sizeof(KINFO_PROC);
if (sysctl(mib, miblen, aProc, &size, nullptr, 0)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
Minimal test - lines (123, 126)
path: .spaces[5].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[5].metrics.nexits.average
old: null
new: 1.0
path: .spaces[5].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[5].metrics.nargs.average
old: null
new: 2.0
path: .spaces[5].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[5].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[5].metrics.loc.cloc
old: 2.0
new: 0.0
path: .spaces[5].metrics.loc.sloc
old: 6.0
new: 4.0
path: .spaces[5].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[5].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[5].metrics.halstead.difficulty
old: 3.5
new: 5.0
path: .spaces[5].metrics.halstead.volume
old: 68.11428751370197
new: 80.0
path: .spaces[5].metrics.halstead.vocabulary
old: 12.0
new: 16.0
path: .spaces[5].metrics.halstead.N2
old: 7.0
new: 10.0
path: .spaces[5].metrics.halstead.time
old: 13.244444794330938
new: 22.22222222222222
path: .spaces[5].metrics.halstead.estimated_program_length
old: 31.019550008653873
new: 48.0
path: .spaces[5].metrics.halstead.length
old: 19.0
new: 20.0
path: .spaces[5].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[5].metrics.halstead.purity_ratio
old: 1.632607895192309
new: 2.4
path: .spaces[5].metrics.halstead.effort
old: 238.40000629795688
new: 400.0
path: .spaces[5].metrics.halstead.n2
old: 6.0
new: 8.0
path: .spaces[5].metrics.halstead.N1
old: 12.0
new: 10.0
path: .spaces[5].metrics.halstead.level
old: 0.2857142857142857
new: 0.2
path: .spaces[5].metrics.halstead.bugs
old: 0.012815914074285069
new: 0.01809611744396604
path: .spaces[5].metrics.mi.mi_original
old: 119.79332423431566
new: 125.5254928495536
path: .spaces[5].metrics.mi.mi_sei
old: 136.21873519108948
new: 105.49597390658572
path: .spaces[5].metrics.mi.mi_visual_studio
old: 70.05457557562319
new: 73.40672096465123
Code
[[nodiscard]] static nsresult ResidentUniqueDistinguishedAmount(
int64_t* aN, pid_t aPid = 0) {
return GetProcSelfSmapsPrivate(aN, aPid);
}
Minimal test - lines (118, 120)
path: .spaces[4].metrics.nargs.average
old: null
new: 1.0
path: .spaces[4].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[4].metrics.nexits.average
old: null
new: 1.0
path: .spaces[4].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[4].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[4].metrics.loc.sloc
old: 1.0
new: 3.0
path: .spaces[4].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[4].metrics.loc.ploc
old: 1.0
new: 3.0
path: .spaces[4].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[4].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[4].metrics.mi.mi_original
old: null
new: 133.18100188654878
path: .spaces[4].metrics.mi.mi_sei
old: null
new: 116.54053882973936
path: .spaces[4].metrics.mi.mi_visual_studio
old: null
new: 77.88362683423905
path: .spaces[4].metrics.halstead.n1
old: 0.0
new: 6.0
path: .spaces[4].metrics.halstead.difficulty
old: 0.0
new: 3.6
path: .spaces[4].metrics.halstead.effort
old: 0.0
new: 161.90139975222553
path: .spaces[4].metrics.halstead.bugs
old: 0.0
new: 0.00990176194569736
path: .spaces[4].metrics.halstead.N2
old: 1.0
new: 6.0
path: .spaces[4].metrics.halstead.estimated_program_length
old: null
new: 27.11941547876375
path: .spaces[4].metrics.halstead.time
old: 0.0
new: 8.994522208456974
path: .spaces[4].metrics.halstead.purity_ratio
old: null
new: 2.0861088829818266
path: .spaces[4].metrics.halstead.vocabulary
old: 1.0
new: 11.0
path: .spaces[4].metrics.halstead.length
old: 1.0
new: 13.0
path: .spaces[4].metrics.halstead.n2
old: 1.0
new: 5.0
path: .spaces[4].metrics.halstead.N1
old: 0.0
new: 7.0
path: .spaces[4].metrics.halstead.level
old: null
new: 0.2777777777777778
path: .spaces[4].metrics.halstead.volume
old: 0.0
new: 44.97261104228487
Code
[[nodiscard]] static nsresult ResidentFastDistinguishedAmount(int64_t* aN) {
return ResidentDistinguishedAmount(aN);
}
Minimal test - lines (110, 112)
path: .spaces[2].metrics.mi.mi_sei
old: null
new: 114.96175347633942
path: .spaces[2].metrics.mi.mi_original
old: null
new: 132.0866712701303
path: .spaces[2].metrics.mi.mi_visual_studio
old: null
new: 77.24366740943293
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.nexits.average
old: null
new: 1.0
path: .spaces[2].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[2].metrics.halstead.vocabulary
old: 1.0
new: 13.0
path: .spaces[2].metrics.halstead.volume
old: 0.0
new: 55.506595772116384
path: .spaces[2].metrics.halstead.estimated_program_length
old: null
new: 35.161259458730164
path: .spaces[2].metrics.halstead.length
old: 1.0
new: 15.0
path: .spaces[2].metrics.halstead.effort
old: 0.0
new: 226.65193273614187
path: .spaces[2].metrics.halstead.n1
old: 0.0
new: 7.0
path: .spaces[2].metrics.halstead.N2
old: 1.0
new: 7.0
path: .spaces[2].metrics.halstead.bugs
old: 0.0
new: 0.01239134255641574
path: .spaces[2].metrics.halstead.difficulty
old: 0.0
new: 4.083333333333333
path: .spaces[2].metrics.halstead.level
old: null
new: 0.2448979591836735
path: .spaces[2].metrics.halstead.N1
old: 0.0
new: 8.0
path: .spaces[2].metrics.halstead.purity_ratio
old: null
new: 2.3440839639153443
path: .spaces[2].metrics.halstead.n2
old: 1.0
new: 6.0
path: .spaces[2].metrics.halstead.time
old: 0.0
new: 12.591774040896771
path: .spaces[2].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[2].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.ploc
old: 1.0
new: 3.0
path: .spaces[2].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.sloc
old: 1.0
new: 3.0
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.nargs.average
old: null
new: 1.0
Code
[[nodiscard]] static nsresult VsizeDistinguishedAmount(int64_t* aN) {
return GetProcSelfStatmField(0, aN);
}
Minimal test - lines (291, 335)
path: .spaces[14].metrics.loc.ploc
old: 5.0
new: 41.0
path: .spaces[14].metrics.loc.lloc
old: 0.0
new: 25.0
path: .spaces[14].metrics.loc.sloc
old: 5.0
new: 45.0
path: .spaces[14].metrics.loc.cloc
old: 0.0
new: 4.0
path: .spaces[14].metrics.cognitive.sum
old: 0.0
new: 29.0
path: .spaces[14].metrics.cognitive.average
old: null
new: 29.0
path: .spaces[14].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[14].metrics.nargs.average
old: null
new: 3.0
path: .spaces[14].metrics.halstead.N1
old: 4.0
new: 140.0
path: .spaces[14].metrics.halstead.difficulty
old: 1.5
new: 33.75806451612903
path: .spaces[14].metrics.halstead.length
old: 8.0
new: 231.0
path: .spaces[14].metrics.halstead.time
old: 1.871569948038403
new: 2493.181249290771
path: .spaces[14].metrics.halstead.N2
old: 4.0
new: 91.0
path: .spaces[14].metrics.halstead.vocabulary
old: 7.0
new: 54.0
path: .spaces[14].metrics.halstead.n2
old: 4.0
new: 31.0
path: .spaces[14].metrics.halstead.volume
old: 22.458839376460833
new: 1329.3790129997612
path: .spaces[14].metrics.halstead.estimated_program_length
old: 12.754887502163468
new: 257.6220106113044
path: .spaces[14].metrics.halstead.n1
old: 3.0
new: 23.0
path: .spaces[14].metrics.halstead.purity_ratio
old: 1.5943609377704335
new: 1.115246799183136
path: .spaces[14].metrics.halstead.bugs
old: 0.003476944758806696
new: 0.42094916269895377
path: .spaces[14].metrics.halstead.effort
old: 33.68825906469125
new: 44877.26248723388
path: .spaces[14].metrics.halstead.level
old: 0.6666666666666666
new: 0.029622551361681796
path: .spaces[14].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[14].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[14].metrics.mi.mi_sei
old: 109.8108652227865
new: 48.05559329176697
path: .spaces[14].metrics.mi.mi_original
old: 128.51634759980075
new: 69.63123820148068
path: .spaces[14].metrics.mi.mi_visual_studio
old: 75.15575883029284
new: 40.72002234004718
path: .spaces[14].metrics.nexits.average
old: null
new: 0.0
path: .spaces[14].metrics.cyclomatic.sum
old: 1.0
new: 10.0
path: .spaces[14].metrics.cyclomatic.average
old: 1.0
new: 5.0
Code
static void XMappingIter(int64_t& aVsize, int64_t& aResident,
int64_t& aShared) {
aVsize = -1;
aResident = -1;
aShared = -1;
int mapfd = open("/proc/self/xmap", O_RDONLY);
struct stat st;
prxmap_t* prmapp = nullptr;
if (mapfd >= 0) {
if (!fstat(mapfd, &st)) {
int nmap = st.st_size / sizeof(prxmap_t);
while (1) {
// stat(2) on /proc//xmap returns an incorrect value,
// prior to the release of Solaris 11.
// Here is a workaround for it.
nmap *= 2;
prmapp = (prxmap_t*)malloc((nmap + 1) * sizeof(prxmap_t));
if (!prmapp) {
// out of memory
break;
}
int n = pread(mapfd, prmapp, (nmap + 1) * sizeof(prxmap_t), 0);
if (n < 0) {
break;
}
if (nmap >= n / sizeof(prxmap_t)) {
aVsize = 0;
aResident = 0;
aShared = 0;
for (int i = 0; i < n / sizeof(prxmap_t); i++) {
aVsize += prmapp[i].pr_size;
aResident += prmapp[i].pr_rss * prmapp[i].pr_pagesize;
if (prmapp[i].pr_mflags & MA_SHARED) {
aShared += prmapp[i].pr_rss * prmapp[i].pr_pagesize;
}
}
break;
}
free(prmapp);
}
free(prmapp);
}
close(mapfd);
}
}
Minimal test - lines (235, 262)
path: .spaces[11].metrics.loc.ploc
old: 7.0
new: 26.0
path: .spaces[11].metrics.loc.lloc
old: 0.0
new: 14.0
path: .spaces[11].metrics.loc.blank
old: 1.0
new: 2.0
path: .spaces[11].metrics.loc.sloc
old: 13.0
new: 28.0
path: .spaces[11].metrics.loc.cloc
old: 5.0
new: 0.0
path: .spaces[11].metrics.mi.mi_visual_studio
old: 58.420911214469825
new: 47.65087341090616
path: .spaces[11].metrics.mi.mi_sei
old: 109.5074695098984
new: 42.77063742896836
path: .spaces[11].metrics.mi.mi_original
old: 99.8997581767434
new: 81.48299353264953
path: .spaces[11].metrics.nargs.average
old: null
new: 2.0
path: .spaces[11].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[11].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[11].metrics.cyclomatic.sum
old: 1.0
new: 9.0
path: .spaces[11].metrics.cognitive.sum
old: 0.0
new: 8.0
path: .spaces[11].metrics.cognitive.average
old: null
new: 8.0
path: .spaces[11].metrics.nexits.average
old: null
new: 2.0
path: .spaces[11].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[11].metrics.halstead.estimated_program_length
old: 68.81274391313339
new: 167.14918465317538
path: .spaces[11].metrics.halstead.n1
old: 6.0
new: 19.0
path: .spaces[11].metrics.halstead.bugs
old: 0.04493489375128556
new: 0.18462179510130144
path: .spaces[11].metrics.halstead.effort
old: 1565.1553886484949
new: 13034.858952158076
path: .spaces[11].metrics.halstead.level
old: 0.1794871794871795
new: 0.04784688995215311
path: .spaces[11].metrics.halstead.vocabulary
old: 20.0
new: 39.0
path: .spaces[11].metrics.halstead.length
old: 65.0
new: 118.0
path: .spaces[11].metrics.halstead.N1
old: 39.0
new: 74.0
path: .spaces[11].metrics.halstead.n2
old: 14.0
new: 20.0
path: .spaces[11].metrics.halstead.difficulty
old: 5.571428571428571
new: 20.9
path: .spaces[11].metrics.halstead.purity_ratio
old: 1.0586575986635909
new: 1.4165185140099608
path: .spaces[11].metrics.halstead.N2
old: 26.0
new: 44.0
path: .spaces[11].metrics.halstead.volume
old: 280.9253261676786
new: 623.6774618257454
path: .spaces[11].metrics.halstead.time
old: 86.9530771471386
new: 724.1588306754487
path: .spaces[11].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[11].metrics.nom.total
old: 0.0
new: 1.0
Code
[[nodiscard]] static nsresult GetKinfoVmentrySelf(int64_t* aPrss,
uint64_t* aMaxreg) {
int cnt;
struct kinfo_vmentry* vmmap;
struct kinfo_vmentry* kve;
if (!(vmmap = kinfo_getvmmap(getpid(), &cnt))) {
return NS_ERROR_FAILURE;
}
if (aPrss) {
*aPrss = 0;
}
if (aMaxreg) {
*aMaxreg = 0;
}
for (int i = 0; i < cnt; i++) {
kve = &vmmap[i];
if (aPrss) {
*aPrss += kve->kve_private_resident;
}
if (aMaxreg) {
*aMaxreg = std::max(*aMaxreg, kve->kve_end - kve->kve_start);
}
}
free(vmmap);
return NS_OK;
}
Minimal test - lines (227, 229)
path: .spaces[10].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[10].metrics.nexits.average
old: null
new: 1.0
path: .spaces[10].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[10].metrics.loc.sloc
old: 1.0
new: 3.0
path: .spaces[10].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[10].metrics.loc.ploc
old: 1.0
new: 3.0
path: .spaces[10].metrics.halstead.level
old: null
new: 0.2777777777777778
path: .spaces[10].metrics.halstead.length
old: 1.0
new: 13.0
path: .spaces[10].metrics.halstead.n2
old: 1.0
new: 5.0
path: .spaces[10].metrics.halstead.bugs
old: 0.0
new: 0.00990176194569736
path: .spaces[10].metrics.halstead.vocabulary
old: 1.0
new: 11.0
path: .spaces[10].metrics.halstead.n1
old: 0.0
new: 6.0
path: .spaces[10].metrics.halstead.N1
old: 0.0
new: 7.0
path: .spaces[10].metrics.halstead.time
old: 0.0
new: 8.994522208456974
path: .spaces[10].metrics.halstead.difficulty
old: 0.0
new: 3.6
path: .spaces[10].metrics.halstead.N2
old: 1.0
new: 6.0
path: .spaces[10].metrics.halstead.purity_ratio
old: null
new: 2.0861088829818266
path: .spaces[10].metrics.halstead.volume
old: 0.0
new: 44.97261104228487
path: .spaces[10].metrics.halstead.effort
old: 0.0
new: 161.90139975222553
path: .spaces[10].metrics.halstead.estimated_program_length
old: null
new: 27.11941547876375
path: .spaces[10].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[10].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[10].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[10].metrics.nargs.average
old: null
new: 1.0
path: .spaces[10].metrics.mi.mi_original
old: null
new: 133.18100188654878
path: .spaces[10].metrics.mi.mi_visual_studio
old: null
new: 77.88362683423905
path: .spaces[10].metrics.mi.mi_sei
old: null
new: 116.54053882973936
Code
[[nodiscard]] static nsresult ResidentFastDistinguishedAmount(int64_t* aN) {
return ResidentDistinguishedAmount(aN);
}
Minimal test - lines (72, 88)
path: .spaces[0].metrics.mi.mi_original
old: null
new: 92.54732275481548
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 83.4578707113012
path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 54.12124137708507
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 10.020833333333334
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 24.0
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 51.0
path: .spaces[0].metrics.halstead.level
old: null
new: 0.09979209979209978
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 88.0
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 37.0
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 4593.869626257129
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 37.0
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.0921151766175215
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 255.2149792365072
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 458.4318961753476
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 13.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 158.14481635314195
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.7971001858311586
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 2.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 15.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 17.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 7.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[0].metrics.nexits.average
old: null
new: 2.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 3.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[0].metrics.nargs.average
old: null
new: 2.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0
Code
[[nodiscard]] static nsresult GetProcSelfStatmField(int aField, int64_t* aN) {
// There are more than two fields, but we're only interested in the first
// two.
static const int MAX_FIELD = 2;
size_t fields[MAX_FIELD];
MOZ_ASSERT(aField < MAX_FIELD, "bad field number");
FILE* f = fopen("/proc/self/statm", "r");
if (f) {
int nread = fscanf(f, "%zu %zu", &fields[0], &fields[1]);
fclose(f);
if (nread == MAX_FIELD) {
*aN = fields[aField] * getpagesize();
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
Minimal test - lines (90, 107)
path: .spaces[1].metrics.nexits.average
old: null
new: 1.0
path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[1].metrics.mi.mi_sei
old: 147.11054410250853
new: 96.44460167180556
path: .spaces[1].metrics.mi.mi_visual_studio
old: 76.0995275030597
new: 54.92654395409528
path: .spaces[1].metrics.mi.mi_original
old: 130.13019203023208
new: 93.92439016150291
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[1].metrics.halstead.n1
old: 4.0
new: 15.0
path: .spaces[1].metrics.halstead.vocabulary
old: 8.0
new: 33.0
path: .spaces[1].metrics.halstead.level
old: 0.4
new: 0.08888888888888889
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.4545454545454546
new: 2.191180474755564
path: .spaces[1].metrics.halstead.difficulty
old: 2.5
new: 11.25
path: .spaces[1].metrics.halstead.bugs
old: 0.006317055768674653
new: 0.07627923415498045
path: .spaces[1].metrics.halstead.volume
old: 33.0
new: 307.70804128086564
path: .spaces[1].metrics.halstead.N2
old: 5.0
new: 27.0
path: .spaces[1].metrics.halstead.N1
old: 6.0
new: 34.0
path: .spaces[1].metrics.halstead.effort
old: 82.5
new: 3461.7154644097386
path: .spaces[1].metrics.halstead.length
old: 11.0
new: 61.0
path: .spaces[1].metrics.halstead.n2
old: 4.0
new: 18.0
path: .spaces[1].metrics.halstead.time
old: 4.583333333333333
new: 192.31752580054103
path: .spaces[1].metrics.halstead.estimated_program_length
old: 16.0
new: 133.6620089600894
path: .spaces[1].metrics.loc.ploc
old: 4.0
new: 11.0
path: .spaces[1].metrics.loc.sloc
old: 4.0
new: 18.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[1].metrics.loc.cloc
old: 1.0
new: 5.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 5.0
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[1].metrics.nargs.average
old: null
new: 2.0
path: .spaces[1].metrics.cognitive.average
old: null
new: 0.0
Code
[[nodiscard]] static nsresult GetProcSelfSmapsPrivate(int64_t* aN, pid_t aPid) {
// You might be tempted to calculate USS by subtracting the "shared" value
// from the "resident" value in /proc//statm. But at least on Linux,
// statm's "shared" value actually counts pages backed by files, which has
// little to do with whether the pages are actually shared. /proc/self/smaps
// on the other hand appears to give us the correct information.
nsTArray mappings(1024);
MOZ_TRY(GetMemoryMappings(mappings, aPid));
int64_t amount = 0;
for (auto& mapping : mappings) {
amount += mapping.Private_Clean();
amount += mapping.Private_Dirty();
}
*aN = amount;
return NS_OK;
}
Minimal test - lines (338, 346)
path: .spaces[15].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[15].metrics.nexits.average
old: null
new: 2.0
path: .spaces[15].metrics.nargs.average
old: null
new: 1.0
path: .spaces[15].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[15].metrics.halstead.purity_ratio
old: null
new: 1.7818257188470974
path: .spaces[15].metrics.halstead.length
old: 1.0
new: 40.0
path: .spaces[15].metrics.halstead.difficulty
old: 0.0
new: 7.727272727272728
path: .spaces[15].metrics.halstead.effort
old: 0.0
new: 1357.625385222526
path: .spaces[15].metrics.halstead.n1
old: 0.0
new: 10.0
path: .spaces[15].metrics.halstead.N2
old: 1.0
new: 17.0
path: .spaces[15].metrics.halstead.n2
old: 1.0
new: 11.0
path: .spaces[15].metrics.halstead.estimated_program_length
old: null
new: 71.27302875388389
path: .spaces[15].metrics.halstead.time
old: 0.0
new: 75.42363251236256
path: .spaces[15].metrics.halstead.volume
old: 0.0
new: 175.69269691115042
path: .spaces[15].metrics.halstead.vocabulary
old: 1.0
new: 21.0
path: .spaces[15].metrics.halstead.level
old: null
new: 0.12941176470588234
path: .spaces[15].metrics.halstead.N1
old: 0.0
new: 23.0
path: .spaces[15].metrics.halstead.bugs
old: 0.0
new: 0.04086944234576256
path: .spaces[15].metrics.loc.lloc
old: 0.0
new: 5.0
path: .spaces[15].metrics.loc.ploc
old: 1.0
new: 9.0
path: .spaces[15].metrics.loc.sloc
old: 1.0
new: 9.0
path: .spaces[15].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[15].metrics.cognitive.average
old: null
new: 1.0
path: .spaces[15].metrics.mi.mi_original
old: null
new: 108.06753241814418
path: .spaces[15].metrics.mi.mi_visual_studio
old: null
new: 63.19738737903169
path: .spaces[15].metrics.mi.mi_sei
old: null
new: 80.4112808275601
path: .spaces[15].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[15].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[15].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[15].metrics.cyclomatic.sum
old: 1.0
new: 2.0
Code
[[nodiscard]] static nsresult VsizeDistinguishedAmount(int64_t* aN) {
int64_t vsize, resident, shared;
XMappingIter(vsize, resident, shared);
if (vsize == -1) {
return NS_ERROR_FAILURE;
}
*aN = vsize;
return NS_OK;
}
Minimal test - lines (114, 116)
path: .spaces[3].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[3].metrics.loc.sloc
old: 4.0
new: 3.0
path: .spaces[3].metrics.loc.ploc
old: 4.0
new: 3.0
path: .spaces[3].metrics.mi.mi_original
old: 128.13519085763062
new: 132.0866712701303
path: .spaces[3].metrics.mi.mi_sei
old: 109.2609722810562
new: 114.96175347633942
path: .spaces[3].metrics.mi.mi_visual_studio
old: 74.93286015066118
new: 77.24366740943293
path: .spaces[3].metrics.halstead.level
old: 0.2777777777777778
new: 0.2448979591836735
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.937101105625982
new: 2.3440839639153443
path: .spaces[3].metrics.halstead.length
old: 14.0
new: 15.0
path: .spaces[3].metrics.halstead.n2
old: 5.0
new: 6.0
path: .spaces[3].metrics.halstead.bugs
old: 0.010403247639062117
new: 0.01239134255641574
path: .spaces[3].metrics.halstead.volume
old: 48.43204266092216
new: 55.506595772116384
path: .spaces[3].metrics.halstead.effort
old: 174.3553535793198
new: 226.65193273614187
path: .spaces[3].metrics.halstead.N2
old: 6.0
new: 7.0
path: .spaces[3].metrics.halstead.n1
old: 6.0
new: 7.0
path: .spaces[3].metrics.halstead.vocabulary
old: 11.0
new: 13.0
path: .spaces[3].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 35.161259458730164
path: .spaces[3].metrics.halstead.difficulty
old: 3.6
new: 4.083333333333333
path: .spaces[3].metrics.halstead.time
old: 9.686408532184434
new: 12.591774040896771
path: .spaces[3].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[3].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[3].metrics.nargs.average
old: null
new: 1.0
path: .spaces[3].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[3].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[3].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[3].metrics.nexits.average
old: null
new: 1.0
Code
[[nodiscard]] static nsresult ResidentDistinguishedAmount(int64_t* aN) {
return GetProcSelfStatmField(1, aN);
}