PHP Class DebugKit\DebugTimer

Show file Open project: cakephp/debug_kit Class Usage Examples

Protected Properties

Property Type Description
$_timers array Internal timers array

Public Methods

Method Description
clear ( ) : boolean Clear all existing timers
elapsedTime ( string $name = 'default', integer $precision = 5 ) : float Get the difference in time between the timer start and timer end.
getAll ( boolean $clear = false ) : array Get all timers that have been started and stopped.
requestStartTime ( ) : float get the time the current request started.
requestTime ( ) : float Get the total execution time until this point
start ( string $name = null, string $message = null ) : boolean Start an benchmarking timer.
stop ( string $name = null ) : boolean Stop a benchmarking timer.

Method Details

clear() public static method

Clear all existing timers
public static clear ( ) : boolean
return boolean true

elapsedTime() public static method

Get the difference in time between the timer start and timer end.
public static elapsedTime ( string $name = 'default', integer $precision = 5 ) : float
$name string the name of the timer you want elapsed time for.
$precision integer the number of decimal places to return, defaults to 5.
return float number of seconds elapsed for timer name, 0 on missing key

getAll() public static method

Calculates elapsed time for each timer. If clear is true, will delete existing timers
public static getAll ( boolean $clear = false ) : array
$clear boolean false
return array

requestStartTime() public static method

get the time the current request started.
public static requestStartTime ( ) : float
return float time of request start

requestTime() public static method

Get the total execution time until this point
public static requestTime ( ) : float
return float elapsed time in seconds since script start.

start() public static method

Start an benchmarking timer.
public static start ( string $name = null, string $message = null ) : boolean
$name string The name of the timer to start.
$message string A message for your timer
return boolean Always true

stop() public static method

$name should be the same as the $name used in startTimer().
public static stop ( string $name = null ) : boolean
$name string The name of the timer to end.
return boolean true if timer was ended, false if timer was not started.

Property Details

$_timers protected static property

Internal timers array
protected static array $_timers
return array