timer_read

Versions
4.7 – 7
timer_read($name)

Read the current timer value without stopping the timer.

Parameters

name The name of the timer.

Return value

The current timer value in ms.

▾ 4 functions call timer_read()

drupal_http_request in includes/common.inc
Perform an HTTP request.
statistics_exit in modules/statistics/statistics.module
Implement hook_exit().
timer_stop in includes/bootstrap.inc
Stop the timer with the specified name.
_batch_process in includes/batch.inc
Process sets in a batch.

Code

includes/bootstrap.inc, line 263

<?php
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'];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.