StopwatchEvent
in package
Represents an Event managed by Stopwatch.
Tags
Table of Contents
Properties
- $category : string
- $morePrecision : bool
- $name : string
- $origin : float
- $periods : array<string|int, StopwatchPeriod>
- $started : array<string|int, float>
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.
- 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
= false
$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
__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|floatgetMemory()
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
Return values
floatformatTime()
Formats a time.
private
formatTime(float $time) : float
Parameters
- $time : float