Packagecom.gskinner.performance
Classpublic class MethodTest
InheritanceMethodTest Inheritance AbstractTest Inheritance flash.events.EventDispatcher

Represents a method execution test, which times how long it takes to run a function one or more times (as specified by loops).



Public Properties
 PropertyDefined by
 Inheriteddescription : String
Optional description for this test.
AbstractTest
 Inheriteddeviation : Number = 0
Provides a rough indication of how much the results of different iterations varied from the norm as a fraction of the average time.
AbstractTest
 Inheritederror : Error
If an error occurs in any iteration of the test, the error property will contain the resulting Error object.
AbstractTest
 Inheritediterations : uint
The number of iterations to run with this test.
AbstractTest
 Inheritedloops : uint
Specifies how many times to repeat the test within a single iteration.
AbstractTest
 Inheritedmax : int = -1
The highest time for all iterations, or -1 if the test has not yet run successfully.
AbstractTest
  memory : int
The average increase in System.totalMemory (in kb), that occured while running the test.
MethodTest
  memoryLog : Array
An array of int values indicating the memory values for each iteration that was run.
MethodTest
  method : Function
The function / method to execute.
MethodTest
 Inheritedmin : int = -1
The lowest time for all iterations, or -1 if the test has not yet run successfully.
AbstractTest
 Inheritedname : String
Optional name for this test.
AbstractTest
  params : Array
An array of parameters (if any) to call the method with.
MethodTest
  retainedMemory : int
The average increase in System.totalMemory (in kb), that was not recovered after running the test.
MethodTest
  retainedMemoryLog : Array
An array of int values indicating the retainedMemory values for each iteration that was run.
MethodTest
 Inheritedtime : Number = -1
The average time for all iterations, or -1 if the test has not yet run successfully.
AbstractTest
 InheritedtimeLog : Array
An array of int values indicating the times for each iteration that was run.
AbstractTest
Public Methods
 MethodDefined by
  
MethodTest(method:Function, params:Array = null, name:String = null, iterations:uint = 0, loops:uint = 1, description:String = null)
Creates a new instance of Test.
MethodTest
 Inherited
complete():void
PerformanceTest calls complete() when all of the iterations of the test have been run.
AbstractTest
  
run():int
PerformanceTest calls run() on tests to run and time them.
MethodTest
  
toString():String
Returns a string representation of this Test.
MethodTest
  
toXML():XML
Returns XML containing all of the information about this test.
MethodTest
Events
 EventSummaryDefined by
 Inherited Dispatched when the test completes.AbstractTest
Property detail
memoryproperty
public var memory:int

The average increase in System.totalMemory (in kb), that occured while running the test. Note that System.totalMemory allocated memory for the Flash player process. This means that small increases in memory use may not be measured (because an additional block of memory was not allocated).

When examining memory usage, it is often worthwhile to use the toXML method to view the output from each iteration separately. You will often see different memory characteristics on the first iteration than subsequent runs.

memoryLogproperty 
public var memoryLog:Array

An array of int values indicating the memory values for each iteration that was run.

methodproperty 
public var method:Function

The function / method to execute.

paramsproperty 
public var params:Array

An array of parameters (if any) to call the method with.

retainedMemoryproperty 
public var retainedMemory:int

The average increase in System.totalMemory (in kb), that was not recovered after running the test. Note that System.totalMemory allocated memory for the Flash player process. This means that small increases in memory use may not be measured (because an additional block of memory was not allocated). Flash player also may not deallocate memory immediately, causing innacurate results.

When examining memory usage, it is often worthwhile to use the toXML method to view the output from each iteration separately. You will often see different memory characteristics on the first iteration than subsequent runs.

retainedMemoryLogproperty 
public var retainedMemoryLog:Array

An array of int values indicating the retainedMemory values for each iteration that was run.

Constructor detail
MethodTest()constructor
public function MethodTest(method:Function, params:Array = null, name:String = null, iterations:uint = 0, loops:uint = 1, description:String = null)

Creates a new instance of Test. See properties for parameter information.

Parameters
method:Function
 
params:Array (default = null)
 
name:String (default = null)
 
iterations:uint (default = 0)
 
loops:uint (default = 1)
 
description:String (default = null)
Method detail
run()method
public override function run():int

PerformanceTest calls run() on tests to run and time them. The run() method returns the time for that iteration, or -1 if an error occurred. You would not generally call the run() method directly.

Returns
int
toString()method 
public override function toString():String

Returns a string representation of this Test. Very handy for tracing:
trace(myTest);

Returns
String
toXML()method 
public override function toXML():XML

Returns XML containing all of the information about this test. This is very useful for building analysis tools, and for saving out results to compare them in the future.

I might document the format some day, but for now it's simple enough to just trace the output of this function to see it.

Returns
XML