package com.ericfeminella.diagnostics
{
/**
*
* Creates a snap shot of the total allocated memory used
* by Flash Player which is used for diagnostic purposes.
*
* @example The following example demonstrates how to create
* a MemorySnapshot
at a specific point in time
*
* <listing version="3.0">
*
* var ms:MemorySnapshot = new MemorySnapshot();
* // execute additional code...
*
* trace( ms.memoryAtSnapshot );
* trace( ms.timeOfSnapshot );
*
* </listing>
*
*/
public final class MemorySnapshot
{
/**
*
* @private
*
* Defines the total memory allocated by Flash Player
* at the time of the memory snap shot.
*
*/
private var memory:Number;
/**
*
* @private
*
* Defines the <code>Date</code> in which the memory snap
* shot was taken.
*
*/
private var timestamp:Date;
/**
*
* <code>MemorySnapShot</code> constructor takes a snap shot
* of the current memory allocated to Flash Player.
*
*/
public function MemorySnapshot()
{
this.memory = SystemDiagnostics.allocatedMemory();
this.timestamp = new Date();
}
/**
*
* Retrieves the total memory allocated by Flash Player
* at the time of the memory snap shot.
*
* @return memory used by Flash Player at time of snapshot
*
*/
public function get memoryAtSnapshot() : Number
{
return memory;
}
/**
*
* Retrieves the Date
in which the memory snap
* shot was taken.
*
* @return exact time the snap shot was taken
*
*/
public function get timeOfSnapshot() : Date
{
return timestamp;
}
}
}