class StopwatchEvent

Represents an Event managed by Stopwatch.

Methods

__construct(float $origin, string $category = null, bool $morePrecision = false)

No description

string
getCategory()

Gets the category.

float
getOrigin()

Gets the origin.

$this
start()

Starts a new event period.

$this
stop()

Stops the last started event period.

bool
isStarted()

Checks if the event was started.

$this
lap()

Stops the current period and then starts a new one.

ensureStopped()

Stops all non already stopped periods.

getPeriods()

Gets all event periods.

int|float
getStartTime()

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

int|float
getEndTime()

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

int|float
getDuration()

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

int
getMemory()

Gets the max memory usage of all periods.

float
getNow()

Return the current time relative to origin.

string
__toString()

No description

Details

__construct(float $origin, string $category = null, bool $morePrecision = false)

Parameters

float $origin The origin time in milliseconds
string $category The event category or null to use the default
bool $morePrecision If true, time is stored as float to keep the original microsecond precision

Exceptions

InvalidArgumentException When the raw time is not valid

string getCategory()

Gets the category.

Return Value

string The category

float getOrigin()

Gets the origin.

Return Value

float The origin in milliseconds

$this start()

Starts a new event period.

Return Value

$this

$this stop()

Stops the last started event period.

Return Value

$this

Exceptions

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

bool isStarted()

Checks if the event was started.

Return Value

bool

$this lap()

Stops the current period and then starts a new one.

Return Value

$this

ensureStopped()

Stops all non already stopped periods.

StopwatchPeriod[] getPeriods()

Gets all event periods.

Return Value

StopwatchPeriod[] An array of StopwatchPeriod instances

int|float getStartTime()

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

Return Value

int|float The time (in milliseconds)

int|float getEndTime()

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

Return Value

int|float The time (in milliseconds)

int|float getDuration()

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

Return Value

int|float The duration (in milliseconds)

int getMemory()

Gets the max memory usage of all periods.

Return Value

int The memory usage (in bytes)

protected float getNow()

Return the current time relative to origin.

Return Value

float Time in ms

string __toString()

Return Value

string