Skip to content

Instantly share code, notes, and snippets.

@ncalexan
Created August 28, 2020 22:39
Show Gist options
  • Save ncalexan/05cf2703b0e91810bd5d4267c6918054 to your computer and use it in GitHub Desktop.
Save ncalexan/05cf2703b0e91810bd5d4267c6918054 to your computer and use it in GitHub Desktop.
(() => {
let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].
getService(Ci.nsIMemoryReporterManager);
let amounts = [
"vsize",
// "vsizeMaxContiguous",
"resident",
// "residentFast",
"residentPeak",
"residentUnique",
"heapAllocated",
"heapOverheadFraction",
// "JSMainRuntimeGCHeap",
// "JSMainRuntimeTemporaryPeak",
// "JSMainRuntimeRealmsSystem",
// "JSMainRuntimeRealmsUser",
// "imagesContentUsedUncompressed",
// "storageSQLite",
// "lowMemoryEventsVirtual",
// "lowMemoryEventsCommitSpace",
// "lowMemoryEventsPhysical",
// "ghostWindows",
// "pageFaultsHard",
];
// There's something unsettling about actually wanting the
// notorious leftpad dependency.
let padding = " ";
for (let i = 0; i < amounts.length; i++) {
let amount = mgr[amounts[i]];
dump(`amounts: ${amounts[i]}: ${padding.substring(amounts[i].length)} ${amount}\n`);
}
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
// Can't use app info from xpcshell.
// let appInfo = Cc["@mozilla.org/xre/app-info;1"]
// .getService(Ci.nsIXULAppInfo);
dump(`version: ${AppConstants.MOZ_APP_VERSION} (${AppConstants.MOZ_BUILDID})\n`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment