class StopwatchEvent

Represents an Event managed by Stopwatch.

Methods

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

Constructor.

string
getCategory()

Gets the category.

integer
getOrigin()

Gets the origin.

start()

Starts a new event period.

stop()

Stops the last started event period.

bool
isStarted()

Checks if the event was started

lap()

Stops the current period and then starts a new one.

ensureStopped()

Stops all non already stopped periods.

getPeriods()

Gets all event periods.

integer
getStartTime()

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

integer
getEndTime()

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

integer
getDuration()

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

integer
getMemory()

Gets the max memory usage of all periods.

Details

at line line 49
__construct(float $origin, string $category = null)

Constructor.

Parameters

float $origin The origin time in milliseconds
string $category The event category

Exceptions

InvalidArgumentException When the raw time is not valid

at line line 62
string getCategory()

Gets the category.

Return Value

string The category

at line line 72
integer getOrigin()

Gets the origin.

Return Value

integer The origin in milliseconds

at line line 82
StopwatchEvent start()

Starts a new event period.

Return Value

StopwatchEvent The event

at line line 98
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()

at line line 114
bool isStarted()

Checks if the event was started

Return Value

bool

at line line 124
StopwatchEvent lap()

Stops the current period and then starts a new one.

Return Value

StopwatchEvent The event

at line line 132
ensureStopped()

Stops all non already stopped periods.

at line line 144
StopwatchPeriod[] getPeriods()

Gets all event periods.

Return Value

StopwatchPeriod[] An array of StopwatchPeriod instances

at line line 154
integer getStartTime()

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

Return Value

integer The time (in milliseconds)

at line line 164
integer getEndTime()

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

Return Value

integer The time (in milliseconds)

at line line 174
integer getDuration()

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

Return Value

integer The duration (in milliseconds)

at line line 189
integer getMemory()

Gets the max memory usage of all periods.

Return Value

integer The memory usage (in bytes)