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.

$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
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()

No description

Details

at line line 49
__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

at line line 60
string getCategory()

Gets the category.

Return Value

string The category

at line line 70
float getOrigin()

Gets the origin.

Return Value

float The origin in milliseconds

at line line 80
$this start()

Starts a new event period.

Return Value

$this

at line line 94
$this stop()

Stops the last started event period.

Return Value

$this

Exceptions

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

at line line 110
bool isStarted()

Checks if the event was started.

Return Value

bool

at line line 120
$this lap()

Stops the current period and then starts a new one.

Return Value

$this

at line line 128
ensureStopped()

Stops all non already stopped periods.

at line line 140
StopwatchPeriod[] getPeriods()

Gets all event periods.

Return Value

StopwatchPeriod[] An array of StopwatchPeriod instances

at line line 150
int getStartTime()

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

Return Value

int The time (in milliseconds)

at line line 160
int getEndTime()

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

Return Value

int The time (in milliseconds)

at line line 172
int getDuration()

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

Return Value

int The duration (in milliseconds)

at line line 196
int getMemory()

Gets the max memory usage of all periods.

Return Value

int The memory usage (in bytes)

at line line 239
string __toString()

Return Value

string