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()
BootstrapTimerTestCase::testTimer in 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 modules/simpletest/tests/common.test
drupal_http_request in includes/common.inc
Performs an HTTP request.
_batch_process in includes/batch.inc
Processes sets in a batch.

File

includes/bootstrap.inc, line 497

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.