function timer_stop

timer_stop($name)

Stops the timer with the specified name.

Parameters

$name: The name of the timer.

Return value

A timer array. The array contains the number of times the timer has been started and stopped (count) and the accumulated timer value in ms (time).

File

includes/bootstrap.inc, line 510
Functions that need to be loaded on every Drupal request.

Code

function timer_stop($name) {
  global $timers;

  if (isset($timers[$name]['start'])) {
    $stop = microtime(TRUE);
    $diff = round(($stop - $timers[$name]['start']) * 1000, 2);
    if (isset($timers[$name]['time'])) {
      $timers[$name]['time'] += $diff;
    }
    else {
      $timers[$name]['time'] = $diff;
    }
    unset($timers[$name]['start']);
  }

  return $timers[$name];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/timer_stop/7.x