function drush_print_timers

8.0.x drush.inc drush_print_timers()
6.x drush.inc drush_print_timers()
7.x drush.inc drush_print_timers()
3.x drush.inc drush_print_timers()
4.x drush.inc drush_print_timers()
5.x drush.inc drush_print_timers()
master drush.inc drush_print_timers()

Related topics

1 call to drush_print_timers()
BaseBoot::bootstrap_and_dispatch in lib/Drush/Boot/BaseBoot.php
Main entrypoint to bootstrap the selected CMS and execute the selected command.

File

includes/drush.inc, line 1365
The drush API implementation and helpers.

Code

function drush_print_timers() {
  global $timers;
  $temparray = array();
  foreach ((array) $timers as $name => $timerec) {
    // We have to use timer_read() for active timers, and check the record for others
    if (isset($timerec['start'])) {
      $temparray[$name] = timer_read($name);
    }
    else {
      $temparray[$name] = $timerec['time'];
    }
  }
  // Go no farther if there were no timers
  if (count($temparray) > 0) {
    // Put the highest cumulative times first
    arsort($temparray);
    $table = array();
    $table[] = array('Timer', 'Cum (sec)', 'Count', 'Avg (msec)');
    foreach ($temparray as $name => $time) {
      $cum = round($time / 1000, 3);
      $count = $timers[$name]['count'];
      if ($count > 0) {
        $avg = round($time / $count, 3);
      }
      else {
        $avg = 'N/A';
      }
      $table[] = array($name, $cum, $count, $avg);
    }
    drush_print_table($table, TRUE, array(), STDERR);
  }
}