You are here

function performance_shutdown in Devel 5

1 string reference to 'performance_shutdown'
performance_init in performance/performance.module

File

performance/performance.module, line 124

Code

function performance_shutdown() {
  global $queries;
  if ($_GET['q']) {

    // q= has a value, use that for the path
    $path = $_GET['q'];
  }
  else {

    // q= is empty, use whatever the site_frontpage is set to
    $path = variable_get('site_frontpage', 'node');
  }
  $params = array(
    'timer' => timer_read('page'),
    'path' => $path,
  );

  // Memory
  if (function_exists('memory_get_peak_usage')) {
    $params['mem'] = memory_get_peak_usage(TRUE);
  }
  else {
    $params['mem'] = 0;
  }

  // Query time and count
  $query_count = 0;
  $query_timer = 0;
  if (variable_get('dev_query', 0) && is_array($queries)) {
    foreach ($queries as $query) {
      $sum += $query[1];
    }
    $query_count = count($queries);
    $query_timer = round($sum * 1000, 2);
  }
  $params['query_count'] = $query_count;
  $params['query_timer'] = $query_timer;
  if (variable_get('performance_detail', 0)) {
    performance_log_details($params);
  }
  if (variable_get('performance_summary_db', 0)) {
    performance_log_summary_db($params);
  }
  if (variable_get('performance_summary_apc', 0)) {
    if (function_exists('apc_cache_info')) {
      performance_log_summary_apc($params);
    }
  }
}