W3cubDocs

/Symfony 3.0

Symfony\Component\Stopwatch\StopwatchEvent

class StopwatchEvent

Represents an Event managed by Stopwatch.

Methods

__construct(float $origin, string|null $category = null)

Constructor.

string getCategory()

Gets the category.

float getOrigin()

Gets the origin.

StopwatchEvent start()

Starts a new event period.

StopwatchEvent stop()

Stops the last started event period.

bool isStarted()

Checks if the event was started.

StopwatchEvent lap()

Stops the current period and then starts a new one.

ensureStopped()

Stops all non already stopped periods.

StopwatchPeriod[] getPeriods()

Gets all event periods.

int getStartTime()

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

int getEndTime()

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

int getDuration()

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

int getMemory()

Gets the max memory usage of all periods.

string __toString()

Details

public __construct(float $origin, string|null $category = null)

Constructor.

Parameters

float $origin The origin time in milliseconds
string|null $category The event category or null to use the default

Exceptions

InvalidArgumentException When the raw time is not valid

public string getCategory()

Gets the category.

Return Value

string The category

public float getOrigin()

Gets the origin.

Return Value

float The origin in milliseconds

public StopwatchEvent start()

Starts a new event period.

Return Value

StopwatchEvent The event

public StopwatchEvent stop()

Stops the last started event period.

Return Value

StopwatchEvent The event

Exceptions

LogicException When start wasn't called before stopping
LogicException When stop() is called without a matching call to start()

public bool isStarted()

Checks if the event was started.

Return Value

bool

public StopwatchEvent lap()

Stops the current period and then starts a new one.

Return Value

StopwatchEvent The event

public ensureStopped()

Stops all non already stopped periods.

public StopwatchPeriod[] getPeriods()

Gets all event periods.

Return Value

StopwatchPeriod[] An array of StopwatchPeriod instances

public int getStartTime()

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

Return Value

int The time (in milliseconds)

public int getEndTime()

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

Return Value

int The time (in milliseconds)

public int getDuration()

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

Return Value

int The duration (in milliseconds)

public int getMemory()

Gets the max memory usage of all periods.

Return Value

int The memory usage (in bytes)

public string __toString()

Return Value

string

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Stopwatch/StopwatchEvent.html