function timer_read

Reads the current timer value without stopping the timer.

Parameters

$name: The name of the timer.

Return value

The current timer value in ms.

4 calls to timer_read()
drupal_http_request in drupal/core/includes/common.inc
Performs an HTTP request.
HttpRequestTest::testDrupalHTTPRequest in drupal/core/modules/system/lib/Drupal/system/Tests/Common/HttpRequestTest.php
Checks HTTP requests.
TimerUnitTest::testTimer in drupal/core/modules/system/lib/Drupal/system/Tests/Bootstrap/TimerUnitTest.php
Tests timer_read() time accumulation accuracy across multiple restarts.
_batch_process in drupal/core/includes/batch.inc
Processes sets in a batch.

File

drupal/core/includes/bootstrap.inc, line 368
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'];
}