Documentation

StopwatchEvent
in package

Represents an Event managed by Stopwatch.

Tags
author

Fabien Potencier fabien@symfony.com

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 (including all periods).
getEndTime()  : int|float
Gets the relative time of the end of the last period.
getMemory()  : int
Gets the max memory usage of all periods.
getName()  : string
Gets the event name.
getOrigin()  : float
Gets the origin.
getPeriods()  : array<string|int, StopwatchPeriod>
Gets all event periods.
getStartTime()  : int|float
Gets the relative time of the start of the first period.
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.
formatTime()  : float
Formats a time.

Properties

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
throws
InvalidArgumentException

When the raw time is not valid

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

The category

getDuration()

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

public getDuration() : int|float
Return values
int|float

The duration (in milliseconds)

getEndTime()

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

public getEndTime() : int|float
Return values
int|float

The time (in milliseconds)

getMemory()

Gets the max memory usage of all periods.

public getMemory() : int
Return values
int

The memory usage (in bytes)

getName()

Gets the event name.

public getName() : string
Return values
string

getOrigin()

Gets the origin.

public getOrigin() : float
Return values
float

The origin in milliseconds

getStartTime()

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

public getStartTime() : int|float
Return values
int|float

The time (in milliseconds)

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
throws
LogicException

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

Return values
$this

getNow()

Return the current time relative to origin.

protected getNow() : float
Return values
float

Time in ms

formatTime()

Formats a time.

private formatTime(float $time) : float
Parameters
$time : float
Tags
throws
InvalidArgumentException

When the raw time is not valid

Return values
float

Search results