Created
July 27, 2015 22:14
-
-
Save fitzgen/80a5c15baacb96541807 to your computer and use it in GitHub Desktop.
record allocations for 5s -> take a census
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbg = null; | |
Components.utils.forceGC(); | |
Components.utils.import("resource://gre/modules/devtools/Loader.jsm"); | |
Debugger = devtools.require("Debugger"); | |
dbg = devtools.require("devtools/server/actors/utils/make-debugger")({ | |
findDebuggees: dbg => dbg.findAllGlobals(), | |
shouldAddNewGlobalAsDebuggee: () => true | |
}); | |
dbg.addDebuggees(); | |
console.log(dbg); | |
dbg.memory.allocationSamplingProbability = 1; | |
dbg.memory.trackingAllocationSites = true; | |
devtools.require("sdk/timers").setTimeout(() => { | |
console.log("====================================================================================="); | |
console.time("census"); | |
let census = dbg.memory.takeCensus({ | |
breakdown: { | |
by: "allocationStack", | |
then: { by: "count", count: true, bytes: true }, | |
noStack: { by: "count", count: true, bytes: true } | |
}, | |
}); | |
console.timeEnd("census"); | |
console.log(census); | |
console.log("====================================================================================="); | |
let i = 0; | |
census.forEach((v, k) => { | |
if (i++ >= 10) | |
return; | |
console.log(k.toString()) | |
console.log(v); | |
console.log(); | |
}) | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment