Bug 1132764 - Part 1: MemoryActor.prototype.startRecordingAllocations should be

able to control the allocations log length; r=vp
This commit is contained in:
Nick Fitzgerald 2015-02-25 11:13:31 -08:00
parent 90babec9cb
commit 4bc86519d3

View File

@ -43,7 +43,12 @@ types.addDictType("AllocationsRecordingOptions", {
// The probability we sample any given allocation when recording // The probability we sample any given allocation when recording
// allocations. Must be between 0.0 and 1.0. Defaults to 1.0, or sampling // allocations. Must be between 0.0 and 1.0. Defaults to 1.0, or sampling
// every allocation. // every allocation.
probability: "number" probability: "number",
// The maximum number of of allocation events to keep in the allocations
// log. If new allocations arrive, when we are already at capacity, the oldest
// allocation event is lost. This number must fit in a 32 bit signed integer.
maxLogLength: "number"
}); });
/** /**
@ -164,6 +169,9 @@ let MemoryActor = protocol.ActorClass({
this.dbg.memory.allocationSamplingProbability = options.probability != null this.dbg.memory.allocationSamplingProbability = options.probability != null
? options.probability ? options.probability
: 1.0; : 1.0;
if (options.maxLogLength != null) {
this.dbg.memory.maxAllocationsLogLength = options.maxLogLength;
}
this.dbg.memory.trackingAllocationSites = true; this.dbg.memory.trackingAllocationSites = true;
return Date.now(); return Date.now();