startSampling() method and the Flash Player debugger version 9.0.115.0 or later, to collect memory usage samples. Then use the getSamples() method to retrieve memory usage samples. The samples reveal the memory usage of distinct intervals of a running application. Then use the other methods in the flash.sampler package to analyze the memory usage information.Note: If you create your own custom profiling agent, preload the agent SWF file by setting the PreloadSwf property in the mm.cfg file:
PreloadSwf=C:/Documents and Settings/username/testingagent.swf?aparam=asetting
Each preloaded agent SWF file has its own security domain and runs in a distinct security sandbox from the main SWF file being profiled. To run the methods of the flash.sampler package, the agent SWF file must be in a localTrusted file path (see the Flash Player 9 Security white paper).
| 函数 | 定义方 | ||
|---|---|---|---|
清除当前的 Sample 对象集合。 | flash.sampler | ||
getGetterInvocationCount(obj:Object, qname:QName):Number
返回 get 函数的执行次数。 | flash.sampler | ||
getInvocationCount(obj:Object, qname:QName):Number
返回方法的执行次数。 | flash.sampler | ||
getMemberNames(o:Object, instanceNames:Boolean = false):Object
返回一个对象,其中包含指定对象的所有成员(包括私有成员)。 | flash.sampler | ||
getSampleCount():Number
返回收集的样本数。 | flash.sampler | ||
getSamples():Object
从上次采样会话中返回内存使用 Sample 实例的对象。 | flash.sampler | ||
getSetterInvocationCount(obj:Object, qname:QName):Number
返回 set 函数的执行次数。 | flash.sampler | ||
当所指定对象用于 Flash Player 9.0.115.0 或更高调试器版本时,返回该对象所占用的内存大小。 | flash.sampler | ||
isGetterSetter(obj:Object, qname:QName):Boolean
检查以确定 get/set 函数是否定义了属性。 | flash.sampler | ||
立即停止采样过程。 | flash.sampler | ||
开始收集内存使用 Sample 对象的过程。 | flash.sampler | ||
结束收集内存使用 Sample 对象的过程,并释放采样过程的专用资源。 | flash.sampler | ||
| clearSamples | () | 函数 |
function clearSamples():void
清除当前的 Sample 对象集合。通常在调用 getSamples() 并遍历 Sample 对象之后调用此方法。仅适用于 Flash Player 调试版。
另请参见
| getGetterInvocationCount | () | 函数 |
function getGetterInvocationCount(obj:Object, qname:QName):Number
返回 get 函数的执行次数。在使用 getGetterInvocationCount() 之前使用 isGetterSetter() 验证是否具有 get/set 函数。仅适用于 Flash Player 调试版。
参数
obj:Object — 方法实例或类。
| |
qname:QName — 如果 qname 为 undefined,则返回构造函数的迭代次数。
|
Number — get 函数的执行次数。
|
另请参见
| getInvocationCount | () | 函数 |
function getInvocationCount(obj:Object, qname:QName):Number
返回方法的执行次数。如果参数 obj 为类并且参数 qname 为 undefined,则此方法返回构造函数的迭代次数。仅适用于 Flash Player 调试版。
参数
obj:Object — 方法实例或类。在方法实例不可用时,可以使用类来获取实例函数的调用计数。如果 obj 为 undefined,则此方法返回由 qname 命名的范围限于包的函数计数。
| |
qname:QName — 如果 qname 为 undefined,则返回构造函数的迭代次数。
|
Number — 方法的执行次数。
|
| getMemberNames | () | 函数 |
function getMemberNames(o:Object, instanceNames:Boolean = false):Object返回一个对象,其中包含指定对象的所有成员(包括私有成员)。然后可以遍历返回的对象以查看所有的值。此方法与 flash.utils.describeType() 方法类似,不过使用它还可以查看私有成员并跳过创建 XML 对象的中间步骤。仅适用于 Flash Player 调试版。
参数
o:Object — 要分析的对象。
| |
instanceNames:Boolean (default = false) — 如果对象是类并且 instanceNames 为 true,则将 o 视为类的实例来报告实例名称而不是类的成员名称。
|
Object — 一个对象,必须使用 for each..in 循环进行遍历以检索每个属性的 QName。
|
另请参见
| getSampleCount | () | 函数 |
function getSampleCount():Number返回收集的样本数。仅适用于 Flash Player 调试版。
返回Number — Sample 实例的迭代器。
|
另请参见
| getSamples | () | 函数 |
function getSamples():Object从上次采样会话中返回内存使用 Sample 实例的对象。仅适用于 Flash Player 调试版。
返回Object — Sample 实例的迭代器。
|
另请参见
| getSetterInvocationCount | () | 函数 |
function getSetterInvocationCount(obj:Object, qname:QName):Number
返回 set 函数的执行次数。在使用 getSetterInvocationCount() 之前使用 isGetterSetter() 验证是否具有 get/set 函数。仅适用于 Flash Player 调试版。
参数
obj:Object — 方法实例或类。
| |
qname:QName — 如果 qname 为 undefined,则返回构造函数的迭代次数。
|
Number — set 方法的执行次数。
|
另请参见
| getSize | () | 函数 |
function getSize(o:*):Number
当所指定对象用于 Flash Player 9.0.115.0 或更高调试器版本时,返回该对象所占用的内存大小。如果与非调试版的 Flash Player 一起使用,则此方法返回 0。
参数
o:* — 要分析其内存使用量的对象。
|
Number — 指定对象使用的内存字节计数。
|
| isGetterSetter | () | 函数 |
function isGetterSetter(obj:Object, qname:QName):Boolean
检查以确定 get/set 函数是否定义了属性。如果要对某一属性的 get/set 函数使用 getInvocationCount(),请首先调用 isGetterSetter() 以检查它是否为 get/set 函数,然后使用 getSetterInvocationCount 或 getGetterInvocationCount 来获取各自的计数。仅适用于 Flash Player 调试版。
参数
obj:Object — 方法实例或类。
| |
qname:QName — 如果 qname 为 undefined,则返回构造函数的迭代次数。
|
Boolean — 一个布尔值,指示 get/set 函数是否定义了该属性;如果是,则为 true,否则为 false。
|
另请参见
| pauseSampling | () | 函数 |
| startSampling | () | 函数 |
| stopSampling | () | 函数 |
function stopSampling():void
结束收集内存使用 Sample 对象的过程,并释放采样过程的专用资源。使用 startSampling() 启动采样过程。仅适用于 Flash Player 调试版。
另请参见