Packagecom.hexagonstar.util.debug
Classpublic class StopWatch

Stopwatch can be used to stop the time. Instantiate this class as follows:

      import com.hexagonstar.util.StopWatch;
      var stopWatch:StopWatch = new StopWatch();
  
This will create a still standing stopwatch. You can start and stop the stopwatch to record time as you please:

      stopWatch.start();
      // Do something
      stopWatch.stop();
  
The recored time is available in milliseconds and seconds.

      Debug.trace(stopWatch.getTimeInMilliSeconds() + " ms");
      Debug.trace(stopWatch.getTimeInSeconds() + " s");
  



Public Properties
 PropertyDefined by
  started : Boolean
[read-only] Returns whether the Stopwatch has been started or not.
StopWatch
  timeInMilliSeconds : int
[read-only] Calculates and returns the elapsed time in milliseconds.
StopWatch
  timeInSeconds : Number
[read-only] Calculates and returns the elapsed time in seconds.
StopWatch
Public Methods
 MethodDefined by
  
Constructs a new StopWatch instance.
StopWatch
  
reset():void
Resets the Stopwatch total running time.
StopWatch
  
start(title:String = ""):void
Starts the time recording process.
StopWatch
  
stop():void
Stops the time recording process if the process has been started before.
StopWatch
  
toString():String
Generates a string representation of the Stopwatch that includes all start and stop times in milliseconds.
StopWatch
Property detail
startedproperty
started:Boolean  [read-only]

Returns whether the Stopwatch has been started or not.

Implementation
    public function get started():Boolean
timeInMilliSecondsproperty 
timeInMilliSeconds:int  [read-only]

Calculates and returns the elapsed time in milliseconds. The Stopwatch will not be stopped by calling this method. If the Stopwatch is still running it takes the current time as stoptime for the result.

Implementation
    public function get timeInMilliSeconds():int
timeInSecondsproperty 
timeInSeconds:Number  [read-only]

Calculates and returns the elapsed time in seconds. The Stopwatch will not be stopped by calling this method. If the Stopwatch is still running it takes the current time as stoptime for the result.

Implementation
    public function get timeInSeconds():Number
Constructor detail
StopWatch()constructor
public function StopWatch()

Constructs a new StopWatch instance.

Method detail
reset()method
public function reset():void

Resets the Stopwatch total running time.

start()method 
public function start(title:String = ""):void

Starts the time recording process.

Parameters
title:String (default = "") — An optional title for the Stopwatch.
stop()method 
public function stop():void

Stops the time recording process if the process has been started before.

toString()method 
public function toString():String

Generates a string representation of the Stopwatch that includes all start and stop times in milliseconds.

Returns
String — the string representation of the Stopwatch.