mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 917646 - Unbreak reading of old memory report files. r=khuey.
This commit is contained in:
parent
c428bc08dc
commit
c23b3a2dac
@ -483,6 +483,9 @@ function updateAboutMemoryFromReporters()
|
||||
}
|
||||
|
||||
// Increment this if the JSON format changes.
|
||||
//
|
||||
// If/when this changes to 2, the beLenient() function and its use can be
|
||||
// removed.
|
||||
var gCurrentFileFormatVersion = 1;
|
||||
|
||||
/**
|
||||
@ -958,8 +961,29 @@ function getPCollsByProcess(aProcessReports)
|
||||
"non-sentence explicit description");
|
||||
|
||||
} else {
|
||||
assertInput(gSentenceRegExp.test(aDescription),
|
||||
"non-sentence other description");
|
||||
const kLenientPrefixes =
|
||||
['rss/', 'pss/', 'size/', 'swap/', 'compartments/', 'ghost-windows/'];
|
||||
let beLenient = function(aUnsafePath) {
|
||||
for (let i = 0; i < kLenientPrefixes.length; i++) {
|
||||
if (aUnsafePath.startsWith(kLenientPrefixes[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// In general, non-explicit reports should have a description that is a
|
||||
// complete sentence. However, we want to be able to read old saved
|
||||
// reports, so we are lenient in a couple of situations where we used to
|
||||
// allow non-sentence descriptions:
|
||||
// - smaps reports (which were removed in bug 912165);
|
||||
// - compartment and ghost-window reports (which had empty descriptions
|
||||
// prior to bug 911641).
|
||||
if (!beLenient(aUnsafePath)) {
|
||||
assertInput(gSentenceRegExp.test(aDescription),
|
||||
"non-sentence other description: " + aUnsafePath + ", " +
|
||||
aDescription);
|
||||
}
|
||||
}
|
||||
|
||||
assert(aPresence === undefined ||
|
||||
|
@ -7,6 +7,13 @@
|
||||
{"process": "Main Process (pid NNN)", "path": "other/a", "kind": 2, "units": 0, "amount": 209715, "description": "Other a."},
|
||||
{"process": "Main Process (pid NNN)", "path": "explicit/a/b", "kind": 1, "units": 0, "amount": 52428800, "description": "A b."},
|
||||
|
||||
{"process": "Main Process (pid NNN)", "path": "size/a", "kind": 1, "units": 0, "amount": 1024, "description": "non-sentence"},
|
||||
{"process": "Main Process (pid NNN)", "path": "rss/a", "kind": 1, "units": 0, "amount": 1024, "description": "non-sentence"},
|
||||
{"process": "Main Process (pid NNN)", "path": "pss/a", "kind": 1, "units": 0, "amount": 1024, "description": "non-sentence"},
|
||||
{"process": "Main Process (pid NNN)", "path": "swap/a", "kind": 1, "units": 0, "amount": 1024, "description": "non-sentence"},
|
||||
{"process": "Main Process (pid NNN)", "path": "compartments/system/a", "kind": 1, "units": 0, "amount": 1024, "description": ""},
|
||||
{"process": "Main Process (pid NNN)", "path": "ghost-windows/a", "kind": 1, "units": 0, "amount": 1024, "description": ""},
|
||||
|
||||
{"process": "Explicit-only process", "path": "explicit/a/b", "kind": 1, "units": 0, "amount": 100000, "description": "A b."},
|
||||
|
||||
{"process": "Other-only process", "path": "a/b", "kind": 1, "units": 0, "amount": 100000, "description": "A b."},
|
||||
|
@ -213,10 +213,28 @@ Explicit Allocations\n\
|
||||
\n\
|
||||
Other Measurements\n\
|
||||
\n\
|
||||
1,024 B (100.0%) -- compartments\n\
|
||||
└──1,024 B (100.0%) ── system/a\n\
|
||||
\n\
|
||||
1,024 B (100.0%) -- ghost-windows\n\
|
||||
└──1,024 B (100.0%) ── a\n\
|
||||
\n\
|
||||
314,572 B (100.0%) -- other\n\
|
||||
├──209,715 B (66.67%) ── a\n\
|
||||
└──104,857 B (33.33%) ── b\n\
|
||||
\n\
|
||||
1,024 B (100.0%) -- pss\n\
|
||||
└──1,024 B (100.0%) ── a\n\
|
||||
\n\
|
||||
1,024 B (100.0%) -- rss\n\
|
||||
└──1,024 B (100.0%) ── a\n\
|
||||
\n\
|
||||
1,024 B (100.0%) -- size\n\
|
||||
└──1,024 B (100.0%) ── a\n\
|
||||
\n\
|
||||
1,024 B (100.0%) -- swap\n\
|
||||
└──1,024 B (100.0%) ── a\n\
|
||||
\n\
|
||||
262,144,000 B ── heap-allocated\n\
|
||||
\n\
|
||||
Other-only process\n\
|
||||
@ -309,12 +327,13 @@ Other Measurements\n\
|
||||
// This loads a pre-existing file that is valid.
|
||||
{ filename: "memory-reports-good.json", expected: expectedGood, dumpFirst: false },
|
||||
|
||||
// This dumps to a file and then reads it back in. The output is the same as the first test.
|
||||
// This dumps to a file and then reads it back in.
|
||||
{ filename: "memory-reports-dumped.json.gz", expected: expectedGood2, dumpFirst: true },
|
||||
|
||||
// This loads a pre-existing file that is invalid.
|
||||
{ filename: "memory-reports-bad.json", expected: expectedBad, dumpFirst: false },
|
||||
|
||||
// This loads a pre-existing diff file.
|
||||
{ filename: "memory-reports-diff1.json", filename2: "memory-reports-diff2.json", expected: expectedDiff, dumpFirst: false }
|
||||
];
|
||||
|
||||
|
@ -108,10 +108,28 @@ Explicit Allocations\n\
|
||||
\n\
|
||||
Other Measurements\n\
|
||||
\n\
|
||||
0.00 MB (100.0%) -- compartments\n\
|
||||
└──0.00 MB (100.0%) ── system/a\n\
|
||||
\n\
|
||||
0.00 MB (100.0%) -- ghost-windows\n\
|
||||
└──0.00 MB (100.0%) ── a\n\
|
||||
\n\
|
||||
0.30 MB (100.0%) -- other\n\
|
||||
├──0.20 MB (66.67%) ── a\n\
|
||||
└──0.10 MB (33.33%) ── b\n\
|
||||
\n\
|
||||
0.00 MB (100.0%) -- pss\n\
|
||||
└──0.00 MB (100.0%) ── a\n\
|
||||
\n\
|
||||
0.00 MB (100.0%) -- rss\n\
|
||||
└──0.00 MB (100.0%) ── a\n\
|
||||
\n\
|
||||
0.00 MB (100.0%) -- size\n\
|
||||
└──0.00 MB (100.0%) ── a\n\
|
||||
\n\
|
||||
0.00 MB (100.0%) -- swap\n\
|
||||
└──0.00 MB (100.0%) ── a\n\
|
||||
\n\
|
||||
250.00 MB ── heap-allocated\n\
|
||||
\n\
|
||||
Other-only process\n\
|
||||
|
Loading…
Reference in New Issue
Block a user