performance_shutdown

Versions
mediamosa-21
performance_shutdown()

Code

sites/all/modules/devel/performance/performance.module, line 130

<?php
function performance_shutdown() {
  $queries = Database::getLog('performance', 'default');

  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 (drupal_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;
  $sum = 0;

  if (variable_get('performance_query', 0) && is_array($queries)) {
    foreach ($queries as $query) {
      $sum += $query['time'];
      $query_count++;
    }
    $query_timer = round($sum * 1000, 2);
  }

  $params['query_count'] = $query_count;
  $params['query_timer'] = $query_timer;

  $anon = (!empty($data['anon'])) ? t('Yes') : t('No');

  $header = array(
    'path' => $path,
    'timer' => $params['timer'],
    'anon' => $anon,
  );
  module_invoke_all('performance', 'header', $header);

  if (variable_get('performance_detail', 0)) {
    $data = module_invoke_all('performance', 'data');
    if (!empty($data[0])) {
      $params['data'] = $data[0];
    }

    performance_log_details($params);
  }
  else {
    module_invoke_all('performance', 'disable');
  }

  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 (drupal_function_exists('apc_cache_info')) {
      performance_log_summary_apc($params);
    }
  }
}
?>