\CodeIgniter\DebugTimer

Class Timer

Provides a simple way to measure the amount of time that elapses between two points.

NOTE: All methods are static since the class is intended to measure throughout an entire application's life cycle.

Summary

Methods
Properties
Constants
start()
stop()
getElapsedTime()
getTimers()
has()
No public properties found
No constants found
No protected methods found
$timers
N/A
No private methods found
No private properties found
N/A

Properties

$timers

$timers : array

List of all timers.

Type

array

Methods

start()

start(string  $name, float  $time = null) : \CodeIgniter\Debug\Timer

Starts a timer running.

Multiple calls can be made to this method so that several execution points can be measured.

Parameters

string $name

The name of this timer.

float $time

Allows user to provide time.

Returns

\CodeIgniter\Debug\Timer

stop()

stop(string  $name) : \CodeIgniter\Debug\Timer

Stops a running timer.

If the timer is not stopped before the timers() method is called, it will be automatically stopped at that point.

Parameters

string $name

The name of this timer.

Returns

\CodeIgniter\Debug\Timer

getElapsedTime()

getElapsedTime(string  $name, integer  $decimals = 4) : null|float

Returns the duration of a recorded timer.

Parameters

string $name

The name of the timer.

integer $decimals

Number of decimal places.

Returns

null|float —

Returns null if timer exists by that name. Returns a float representing the number of seconds elapsed while that timer was running.

getTimers()

getTimers(integer  $decimals = 4) : array

Returns the array of timers, with the duration pre-calculated for you.

Parameters

integer $decimals

Number of decimal places

Returns

array

has()

has(string  $name) : boolean

Checks whether or not a timer with the specified name exists.

Parameters

string $name

Returns

boolean