\app\framework\Component\StopwatchStopwatchEvent

Represents an Event managed by Stopwatch.

Summary

Methods
Properties
Constants
__construct()
getCategory()
getOrigin()
start()
stop()
isStarted()
lap()
ensureStopped()
getPeriods()
getStartTime()
getEndTime()
getDuration()
getMemory()
__toString()
No public properties found
No constants found
serialize()
unserialize()
getNow()
No protected properties found
N/A
formatTime()
$periods
$origin
$category
$started
N/A

Properties

$origin

$origin : float

Type

float

$category

$category : string

Type

string

$started

$started : array<mixed,float>

Type

array<mixed,float>

Methods

__construct()

__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

Throws

\InvalidArgumentException

When the raw time is not valid

getCategory()

getCategory() : string

Gets the category.

Returns

string —

The category

getOrigin()

getOrigin() : float

Gets the origin.

Returns

float —

The origin in milliseconds

start()

start() : $this

Starts a new event period.

Returns

$this

stop()

stop() : $this

Stops the last started event period.

Returns

$this —

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

isStarted()

isStarted() : boolean

Checks if the event was started.

Returns

boolean

lap()

lap() : $this

Stops the current period and then starts a new one.

Returns

$this

ensureStopped()

ensureStopped() 

Stops all non already stopped periods.

getStartTime()

getStartTime() : integer

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

Returns

integer —

The time (in milliseconds)

getEndTime()

getEndTime() : integer

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

Returns

integer —

The time (in milliseconds)

getDuration()

getDuration() : integer

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

Returns

integer —

The duration (in milliseconds)

getMemory()

getMemory() : integer

Gets the max memory usage of all periods.

Returns

integer —

The memory usage (in bytes)

__toString()

__toString() : string

Returns

string

serialize()

serialize(  $value) : string

Serializes the given value.

Parameters

$value

Returns

string

unserialize()

unserialize(string  $string) : array|mixed

Unserializes the given string and returns the array.

Parameters

string $string

String to serialize.

Returns

array|mixed

getNow()

getNow() : float

Return the current time relative to origin.

Returns

float —

Time in ms

formatTime()

formatTime(integer|float  $time) : float

Formats a time.

Parameters

integer|float $time

A raw time

Returns

float —

The formatted time

InvalidArgumentException When the raw time is not valid