Package | flash.sampler |
Class | public final class DeleteObjectSample |
Inheritance | DeleteObjectSample Sample Object |
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0 Flash Player 9.0.115.0 |
getSamples()
stream; each
DeleteObjectSample object corresponds to a NewObjectSample object. For Flash Player debugger version only.
See also
Public Properties
Public Methods
Public Constants
Constant | Defined By | ||
---|---|---|---|
id : Number
The unique identification number that matches up with a NewObjectSample's identification number. | DeleteObjectSample | ||
size : Number
The size of the DeleteObjectSample object before it is deleted. | DeleteObjectSample | ||
stack : Array
Contains information about the methods executed by Flash Player over a specified period of time. | Sample | ||
time : Number
The microseconds that define the duration of the Sample instance. | Sample |
Constant Detail
id | Constant |
public const id:Number
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0 Flash Player 9.0.115.0 |
The unique identification number that matches up with a NewObjectSample's identification number. For Flash Player debugger version only.
See also
size | Constant |
public const size:Number
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0 Flash Player 9.0.115.0 |
The size of the DeleteObjectSample object before it is deleted. For Flash Player debugger version only.
See also
Examples ( How to use this example )
SampleTypesExample.as
The following example uses the
stack
and time
properties of a Sample object
s
to collect memory samples. The samples contain NewObjectSample objects (the
newSamples
array), DeleteObjectSample objects (the delSamples
array), and CPU memory sample
objects (the cpuSamples
array). To use
the memory profiler, you need to have Flash Player debugger version 9.0.115.0 or later installed.
package { import flash.sampler.* import flash.system.* import flash.utils.* import flash.display.Sprite public class sampleTypes extends Sprite { var b:Boolean = true public function sampleTypes() { flash.sampler.startSampling(); for(var i:int=0;i<10000;i++) new Object(); var cpuSamples:Array=[]; var newSamples:Array=[]; var delSamples:Array=[]; var ids:Array=[] var lastTime:Number=0; for each(var s:Sample in getSamples()) { assert(s.time > 0); // positive assert(Math.floor(s.time) == s.time, s.time); // integral assert(s.time >= lastTime, s.time + ":" + lastTime); // ascending assert(s.stack == null || s.stack is Array) if(s.stack) { assert(s.stack[0] is StackFrame); assert(s.stack[0].name is String); } if(s is NewObjectSample) { var nos = NewObjectSample(s); assert(s.id > 0, s.id); assert(s.type is Class, getQualifiedClassName(s.type)); newSamples.push(s); ids[s.id] = "got one"; } else if(s is DeleteObjectSample) { var dos = DeleteObjectSample(s); delSamples.push(s); assert(ids[dos.id] == "got one"); } else if(s is Sample) cpuSamples.push(s); else { assert(false); } lastTime = s.time; } trace(b) trace(newSamples.length > 0) trace(cpuSamples.length > 0) trace(delSamples.length > 0) } private function assert(e:Boolean, mess:String=null):void { b = e && b; if(true && !e) { if(mess) trace(mess); trace(new Error().getStackTrace()); } } } }
Fri Mar 19 2010, 02:45 AM -07:00