Package | com.hexagonstar.util.debug |
Class | public class StopWatch |
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");
Property | Defined 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 |
Method | Defined 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 |
started | property |
started:Boolean
[read-only]Returns whether the Stopwatch has been started or not.
Implementation public function get started():Boolean
timeInMilliSeconds | property |
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
timeInSeconds | property |
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
StopWatch | () | constructor |
public function StopWatch()
Constructs a new StopWatch instance.
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.
Parameterstitle: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.
ReturnsString — the string representation of the Stopwatch.
|