Class Symfony\Component\Stopwatch\StopwatchEvent

InheritanceSymfony\Component\Stopwatch\StopwatchEvent

Represents an Event managed by Stopwatch.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Stopwatch\StopwatchEvent
__toString() Symfony\Component\Stopwatch\StopwatchEvent
ensureStopped() Stops all non already stopped periods. Symfony\Component\Stopwatch\StopwatchEvent
getCategory() Gets the category. Symfony\Component\Stopwatch\StopwatchEvent
getDuration() Gets the duration of the events (including all periods). Symfony\Component\Stopwatch\StopwatchEvent
getEndTime() Gets the relative time of the end of the last period. Symfony\Component\Stopwatch\StopwatchEvent
getMemory() Gets the max memory usage of all periods. Symfony\Component\Stopwatch\StopwatchEvent
getOrigin() Gets the origin. Symfony\Component\Stopwatch\StopwatchEvent
getPeriods() Gets all event periods. Symfony\Component\Stopwatch\StopwatchEvent
getStartTime() Gets the relative time of the start of the first period. Symfony\Component\Stopwatch\StopwatchEvent
isStarted() Checks if the event was started. Symfony\Component\Stopwatch\StopwatchEvent
lap() Stops the current period and then starts a new one. Symfony\Component\Stopwatch\StopwatchEvent
start() Starts a new event period. Symfony\Component\Stopwatch\StopwatchEvent
stop() Stops the last started event period. Symfony\Component\Stopwatch\StopwatchEvent

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getNow() Return the current time relative to origin. Symfony\Component\Stopwatch\StopwatchEvent

Method Details

__construct() public method

Constructor.

public void __construct ( $origin, $category null )
$origin float

The origin time in milliseconds

$category string|null

The event category or null to use the default

throws InvalidArgumentException

When the raw time is not valid

__toString() public method

public string __toString ( )
ensureStopped() public method

Stops all non already stopped periods.

public void ensureStopped ( )
getCategory() public method

Gets the category.

public string getCategory ( )
return string

The category

getDuration() public method

Gets the duration of the events (including all periods).

public int getDuration ( )
return int

The duration (in milliseconds)

getEndTime() public method

Gets the relative time of the end of the last period.

public int getEndTime ( )
return int

The time (in milliseconds)

getMemory() public method

Gets the max memory usage of all periods.

public int getMemory ( )
return int

The memory usage (in bytes)

getNow() protected method

Return the current time relative to origin.

protected float getNow ( )
return float

Time in ms

getOrigin() public method

Gets the origin.

public float getOrigin ( )
return float

The origin in milliseconds

getPeriods() public method

Gets all event periods.

public Symfony\Component\Stopwatch\StopwatchPeriod[] getPeriods ( )
return Symfony\Component\Stopwatch\StopwatchPeriod[]

An array of StopwatchPeriod instances

getStartTime() public method

Gets the relative time of the start of the first period.

public int getStartTime ( )
return int

The time (in milliseconds)

isStarted() public method

Checks if the event was started.

public bool isStarted ( )
lap() public method

Stops the current period and then starts a new one.

public Symfony\Component\Stopwatch\StopwatchEvent lap ( )
return Symfony\Component\Stopwatch\StopwatchEvent

The event

start() public method

Starts a new event period.

public Symfony\Component\Stopwatch\StopwatchEvent start ( )
return Symfony\Component\Stopwatch\StopwatchEvent

The event

stop() public method

Stops the last started event period.

public Symfony\Component\Stopwatch\StopwatchEvent stop ( )
return Symfony\Component\Stopwatch\StopwatchEvent

The event

throws LogicException

When stop() is called without a matching call to start()