function timer_read

7.x timer_read($name)
5.x timer_read($name)
6.x timer_read($name)

Reads the current timer value without stopping the timer.


$name: The name of the timer.

Return value

The current timer value in ms.

5 calls to timer_read()
BootstrapTimerTestCase::testTimer in drupal/modules/simpletest/tests/bootstrap.test
Test timer_read() to ensure it properly accumulates time when the timer started and stopped multiple times.
DrupalHTTPRequestTestCase::testDrupalHTTPRequest in drupal/modules/simpletest/tests/common.test
drupal_http_request in drupal/includes/
Performs an HTTP request.
statistics_exit in drupal/modules/statistics/statistics.module
Implements hook_exit().
_batch_process in drupal/includes/
Processes sets in a batch.


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


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'];