function timer_read

timer_read($name)

Reads the current timer value without stopping the timer.

Parameters

$name: The name of the timer.

Return value

The current timer value in ms.

File

includes/bootstrap.inc, line 485
Functions that need to be loaded on every Drupal request.

Code

function timer_read($name) {
  global $timers;

  if (isset($timers[$name]['start'])) {
    $stop = microtime(TRUE);
    $diff = round(($stop - $timers[$name]['start']) * 1000, 2);

    if (isset($timers[$name]['time'])) {
      $diff += $timers[$name]['time'];
    }
    return $diff;
  }
  return $timers[$name]['time'];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/timer_read/7.x