class Timer (View source)

Provides helpers to use timers throughout a request.

Properties

static protected $timers

Methods

static 
start($name)

Starts the timer with the specified name.

static int
read(string $name)

Reads the current timer value without stopping the timer.

static array
stop(string $name)

Stops the timer with the specified name.

Details

static start($name)

Starts the timer with the specified name.

If you start and stop the same timer multiple times, the measured intervals will be accumulated.

Parameters

$name

The name of the timer.

static int read(string $name)

Reads the current timer value without stopping the timer.

Parameters

string $name

The name of the timer.

Return Value

int

The current timer value in ms.

static array stop(string $name)

Stops the timer with the specified name.

Parameters

string $name

The name of the timer.

Return Value

array

A timer array. The array contains the number of times the timer has been started and stopped (count) and the accumulated timer value in ms (time).