Api‎ > ‎Util‎ > ‎

Timer

Class RTimer

Static class to do performance testing. Can take time multiple time measurements and display the results.

Example
<?php

require_once("rawdev/RawDev.php");
require_once(RAWDEV_LIB.'/Core/ErrorReporting.php'); 
require_once(RAWDEV_LIB.'/Util/Timer.php'); 

RErrorReporting::singleton()->initialize();

RTimer::start();

usleep(123);

RTimer::lap('sleep');

RTimer::display();

?>

Vars

static double $start

Start time (microseconds)

static double $current

Last lap or stopped time (microseconds)

static bool $stopped

Whether the timer has been stopped.

static array $laps=array()

An array of array($label, $lapTime (microseconds))

Functions

static void function start()

Starts the timer. This is required to use for this class. Multiple starts function as resets.

static void function stop()

Stops the timer. All future laps are ignored. @var $label string Short label for identifying lap in the report display().

static void function lap()

Marks a lap time. @var $label string Short label for identifying lap in the report display().

static void function _display()

Marks a lap time. @var $label string Short label for identifying lap . @var $laps double time in milliseconds. @var $digits int The number of digits displayed (e.g. 3=milliseconds, 6=microseconds).

static void function display()

Display a report of all laps and total time. @var $digits int The number of digits displayed (e.g. 3=milliseconds, 6=microseconds).

Comments