StopwatchEvent
in package
Represents an Event managed by Stopwatch.
Tags
Table of Contents
Methods
- __construct() : mixed
- __toString() : string
- ensureStopped() : void
- Stops all non already stopped periods.
- getCategory() : string
- Gets the category.
- getDuration() : int|float
- Gets the duration of the events in milliseconds (including all periods).
- getEndTime() : int|float
- Gets the relative time of the end of the last period in milliseconds.
- getLastPeriod() : StopwatchPeriod|null
- Gets the last event period.
- getMemory() : int
- Gets the max memory usage of all periods in bytes.
- getName() : string
- Gets the event name.
- getOrigin() : float
- Gets the origin in milliseconds.
- getPeriods() : array<string|int, StopwatchPeriod>
- Gets all event periods.
- getStartTime() : int|float
- Gets the relative time of the start of the first period in milliseconds.
- isStarted() : bool
- Checks if the event was started.
- lap() : $this
- Stops the current period and then starts a new one.
- start() : $this
- Starts a new event period.
- stop() : $this
- Stops the last started event period.
- getNow() : float
- Return the current time relative to origin in milliseconds.
Methods
__construct()
public
__construct(float $origin[, string|null $category = null ][, bool $morePrecision = false ][, string|null $name = null ]) : mixed
Parameters
- $origin : float
-
The origin time in milliseconds
- $category : string|null = null
-
The event category or null to use the default
- $morePrecision : bool = false
-
If true, time is stored as float to keep the original microsecond precision
- $name : string|null = null
-
The event name or null to define the name as default
Tags
__toString()
public
__toString() : string
Return values
stringensureStopped()
Stops all non already stopped periods.
public
ensureStopped() : void
getCategory()
Gets the category.
public
getCategory() : string
Return values
stringgetDuration()
Gets the duration of the events in milliseconds (including all periods).
public
getDuration() : int|float
Return values
int|floatgetEndTime()
Gets the relative time of the end of the last period in milliseconds.
public
getEndTime() : int|float
Return values
int|floatgetLastPeriod()
Gets the last event period.
public
getLastPeriod() : StopwatchPeriod|null
Return values
StopwatchPeriod|nullgetMemory()
Gets the max memory usage of all periods in bytes.
public
getMemory() : int
Return values
intgetName()
Gets the event name.
public
getName() : string
Return values
stringgetOrigin()
Gets the origin in milliseconds.
public
getOrigin() : float
Return values
floatgetPeriods()
Gets all event periods.
public
getPeriods() : array<string|int, StopwatchPeriod>
Return values
array<string|int, StopwatchPeriod>getStartTime()
Gets the relative time of the start of the first period in milliseconds.
public
getStartTime() : int|float
Return values
int|floatisStarted()
Checks if the event was started.
public
isStarted() : bool
Return values
boollap()
Stops the current period and then starts a new one.
public
lap() : $this
Return values
$thisstart()
Starts a new event period.
public
start() : $this
Return values
$thisstop()
Stops the last started event period.
public
stop() : $this
Tags
Return values
$thisgetNow()
Return the current time relative to origin in milliseconds.
protected
getNow() : float