StopwatchEvent
in package
Represents an Event managed by Stopwatch.
Tags
Table of Contents
- $category : string
- $morePrecision : bool
- $name : string
- $origin : float
- $periods : array<string|int, StopwatchPeriod>
- $started : array<string|int, float>
- __construct() : mixed
- __toString() : string
- ensureStopped() : mixed
- 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.
- 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.
- formatTime() : float
- Formats a time.
Properties
$category
private
string
$category
$morePrecision
private
bool
$morePrecision
$name
private
string
$name
$origin
private
float
$origin
$periods
private
array<string|int, StopwatchPeriod>
$periods
= []
$started
private
array<string|int, float>
$started
= []
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
Return values
mixed —__toString()
public
__toString() : string
Return values
string —ensureStopped()
Stops all non already stopped periods.
public
ensureStopped() : mixed
Return values
mixed —getCategory()
Gets the category.
public
getCategory() : string
Return values
string —getDuration()
Gets the duration of the events in milliseconds (including all periods).
public
getDuration() : int|float
Return values
int|float —getEndTime()
Gets the relative time of the end of the last period in milliseconds.
public
getEndTime() : int|float
Return values
int|float —getMemory()
Gets the max memory usage of all periods in bytes.
public
getMemory() : int
Return values
int —getName()
Gets the event name.
public
getName() : string
Return values
string —getOrigin()
Gets the origin in milliseconds.
public
getOrigin() : float
Return values
float —getPeriods()
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|float —isStarted()
Checks if the event was started.
public
isStarted() : bool
Return values
bool —lap()
Stops the current period and then starts a new one.
public
lap() : $this
Return values
$this —start()
Starts a new event period.
public
start() : $this
Return values
$this —stop()
Stops the last started event period.
public
stop() : $this
Tags
Return values
$this —getNow()
Return the current time relative to origin in milliseconds.
protected
getNow() : float
Return values
float —formatTime()
Formats a time.
private
formatTime(float $time) : float
Parameters
- $time : float