function timer_read

7.x bootstrap.inc timer_read($name)
6.x bootstrap.inc 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 calls to timer_read()
drupal_http_request in drupal-6.x/includes/common.inc
Perform an HTTP request.
statistics_exit in drupal-6.x/modules/statistics/statistics.module
Implementation of hook_exit().
timer_stop in drupal-6.x/includes/bootstrap.inc
Stop the timer with the specified name.
_batch_process in drupal-6.x/includes/batch.inc
Advance batch processing for 1 second (or process the whole batch if it was not set for progressive execution - e.g forms submitted by drupal_execute).

File

drupal-6.x/includes/bootstrap.inc, line 245
Functions that need to be loaded on every Drupal request.

Code

function timer_read($name) {
  global $timers;

  if (isset($timers[$name]['start'])) {
    list($usec, $sec) = explode(' ', microtime());
    $stop = (float) $usec + (float) $sec;
    $diff = round(($stop - $timers[$name]['start']) * 1000, 2);

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