зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1774329 - Add minimal test for GC and CC markers - r=florian
This covers the gc stats' JSONPrinter changes, and would trigger the verifyJSONStringIsCompact assertion (see next patch) without these changes. Differential Revision: https://phabricator.services.mozilla.com/D152844
This commit is contained in:
Родитель
7b301dc561
Коммит
fc7747606f
|
@ -18,6 +18,8 @@ support-files = single_frame.html
|
|||
|
||||
[browser_test_markers_parent_process.js]
|
||||
|
||||
[browser_test_markers_gc_cc.js]
|
||||
|
||||
[browser_test_profile_capture_by_pid.js]
|
||||
skip-if = os == "win" && os_version == "6.1" # No thread names on win7, needed for these tests
|
||||
https_first_disabled = true
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
add_task(async function test_markers_gc_cc() {
|
||||
info("Test GC&CC markers.");
|
||||
|
||||
info("Create a throwaway profile.");
|
||||
await startProfiler({});
|
||||
let tempProfileContainer = { profile: null };
|
||||
tempProfileContainer.profile = await waitSamplingAndStopAndGetProfile();
|
||||
|
||||
info("Restart the profiler.");
|
||||
await startProfiler({});
|
||||
|
||||
info("Throw away the previous profile, which should be garbage-collected.");
|
||||
Assert.equal(
|
||||
typeof tempProfileContainer.profile,
|
||||
"object",
|
||||
"Previously-captured profile should be an object"
|
||||
);
|
||||
delete tempProfileContainer.profile;
|
||||
Assert.equal(
|
||||
typeof tempProfileContainer.profile,
|
||||
"undefined",
|
||||
"Deleted profile should now be undefined"
|
||||
);
|
||||
|
||||
info("Force GC&CC");
|
||||
SpecialPowers.gc();
|
||||
SpecialPowers.forceShrinkingGC();
|
||||
SpecialPowers.forceCC();
|
||||
SpecialPowers.gc();
|
||||
SpecialPowers.forceShrinkingGC();
|
||||
SpecialPowers.forceCC();
|
||||
|
||||
info("Stop the profiler and get the profile.");
|
||||
const profile = await waitSamplingAndStopAndGetProfile();
|
||||
|
||||
const markers = getInflatedMarkerData(profile.threads[0]);
|
||||
Assert.ok(
|
||||
markers.some(({ data }) => data?.type === "GCSlice"),
|
||||
"A GCSlice marker was recorded"
|
||||
);
|
||||
Assert.ok(
|
||||
markers.some(({ data }) => data?.type === "CCSlice"),
|
||||
"A CCSlice marker was recorded"
|
||||
);
|
||||
});
|
Загрузка…
Ссылка в новой задаче